Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::ulsvolume Class Reference

Unlimited surfaces volume. More...

#include <surface.h>

+ Inheritance diagram for Heed::ulsvolume:

Public Member Functions

 ulsvolume ()
 Default constructor.
 
 ulsvolume (surface *fsurf[pqqsurf], int fqsurf, char *fname, vfloat fprec)
 
 ulsvolume (ulsvolume &f)
 
 ulsvolume (const ulsvolume &fv)
 
virtual ~ulsvolume ()
 Destructor.
 
int check_point_inside (const point &fpt, const vec &dir) const
 
int range_ext (trajestep &fts, int s_ext) const
 
void ulsvolume_init (surface *fsurf[pqqsurf], int fqsurf, const std::string &fname, vfloat fprec)
 
virtual void income (gparticle *)
 
virtual void chname (char *nm) const
 
virtual void print (std::ostream &file, int l) const
 
virtual ulsvolumecopy () const
 
- Public Member Functions inherited from Heed::absvol
virtual ~absvol ()
 Destructor.
 
virtual int check_point_inside (const point &fpt, const vec &dir) const =0
 
virtual int find_embed_vol (const point &fpt, const vec &dir, manip_absvol_treeid *atid) const
 
virtual int range (trajestep &fts, int s_ext, int &sb, PassivePtr< manip_absvol > &faeid) const
 
virtual int range_ext (trajestep &fts, int s_ext) const =0
 
virtual void income (gparticle *)
 
virtual void chname (char *nm) const
 
virtual void print (std::ostream &file, int l) const
 
virtual absvolcopy () const
 
virtual std::vector< manip_absvol * > Gamanip_embed () const
 
- Public Member Functions inherited from Heed::absref
virtual ~absref ()
 Destructor.
 
virtual void down (const abssyscoor *fasc)
 Convert numbering representation of object to basical system of fasc.
 
virtual void up (const abssyscoor *fasc)
 Convert numbering representation of objects to new system.
 
virtual void turn (const vec &dir, vfloat angle)
 Turn around axis doing via center of coordinate system along dir.
 
virtual void shift (const vec &dir)
 
- Public Member Functions inherited from Heed::RegPassivePtr
 RegPassivePtr (void)
 
 RegPassivePtr (char fs_ban_del, char fs_ban_sub, char fs_ban_cop=0)
 
 RegPassivePtr (const RegPassivePtr &f)
 
RegPassivePtroperator= (const RegPassivePtr &f)
 
CountPP_ns::CountPassivePtrbook (void) const
 
void clear_pointers (void) const
 
virtual RegPassivePtrcopy () const
 
virtual ~RegPassivePtr ()
 
virtual void print (std::ostream &file, int l=1) const
 
void set_s_ban_del (char fs_ban_del)
 
char get_s_ban_del (void) const
 
void set_s_ban_sub (char fs_ban_sub)
 
char get_s_ban_sub (void) const
 
void set_s_ban_cop (char fs_ban_cop)
 
char get_s_ban_cop (void) const
 
void set_s_allow_del_at_zero_count (char fs_allow_del_at_zero_count)
 
char get_s_allow_del_at_zero_count (void) const
 
long get_total_number_of_references (void) const
 

Public Attributes

int qsurf
 
ActivePtr< surfacesurf [pqqsurf]
 
std::string name
 
- Public Attributes inherited from Heed::absvol
vfloat prec
 
bool s_sensitive
 

Protected Member Functions

virtual void get_components (ActivePtr< absref_transmit > &aref_tran)
 

Protected Attributes

surfaceadrsurf [pqqsurf]
 

Additional Inherited Members

- Static Public Member Functions inherited from Heed::RegPassivePtr
static void set_s_ban_del_ignore (char fs_ban_del_ignore)
 
static char get_s_ban_del_ignore (void)
 
static void set_s_print_adr_cpp (char fs_print_adr_cpp)
 
static char get_s_print_adr_cpp (void)
 

Detailed Description

Unlimited surfaces volume.

Definition at line 124 of file surface.h.

Constructor & Destructor Documentation

◆ ulsvolume() [1/4]

Heed::ulsvolume::ulsvolume ( void  )

Default constructor.

Definition at line 335 of file surface.cpp.

335 : qsurf(0) {
336 name = std::string("not inited ulsvolume");
337}
std::string name
Definition: surface.h:146

Referenced by copy().

◆ ulsvolume() [2/4]

Heed::ulsvolume::ulsvolume ( surface fsurf[pqqsurf],
int  fqsurf,
char *  fname,
vfloat  fprec 
)

Definition at line 352 of file surface.cpp.

354 : qsurf(fqsurf), name(fname) {
355 mfunname("ulsvolume::ulsvolume(...)");
356 check_econd12(fqsurf, >, pqqsurf, mcerr);
357 prec = fprec;
358 for (int n = 0; n < qsurf; ++n) surf[n].put(fsurf[n]);
359}
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:163
#define mfunname(string)
Definition: FunNameStack.h:45
vfloat prec
Definition: volume.h:74
ActivePtr< surface > surf[pqqsurf]
Definition: surface.h:145
const int pqqsurf
Definition: surface.h:22
#define mcerr
Definition: prstream.h:128

◆ ulsvolume() [3/4]

Heed::ulsvolume::ulsvolume ( ulsvolume f)

Definition at line 361 of file surface.cpp.

362 : absref(f), absvol(f), qsurf(f.qsurf), name(f.name) {
363 mfunname("ulsvolume::ulsvolume(...)");
364 check_econd12(f.qsurf, >, pqqsurf, mcerr);
365 prec = f.prec;
366 for (int n = 0; n < qsurf; ++n) surf[n].put(f.surf[n].get());
367}

◆ ulsvolume() [4/4]

Heed::ulsvolume::ulsvolume ( const ulsvolume fv)

Definition at line 369 of file surface.cpp.

370 : absref(f), absvol(f), qsurf(f.qsurf), name(f.name) {
371 mfunname("ulsvolume::ulsvolume(...)");
372 check_econd12(f.qsurf, >, pqqsurf, mcerr);
373 prec = f.prec;
374 for (int n = 0; n < qsurf; ++n) surf[n].put(f.surf[n].get());
375}

◆ ~ulsvolume()

virtual Heed::ulsvolume::~ulsvolume ( )
inlinevirtual

Destructor.

Definition at line 159 of file surface.h.

159{}

Member Function Documentation

◆ check_point_inside()

int Heed::ulsvolume::check_point_inside ( const point fpt,
const vec dir 
) const
virtual

Check if a point is inside the volume. If two volumes are adjacent, it may happen that a point belongs to both. To avoid this confusion the parameter dir is used. If dir == (0, 0, 0), and the point is exactly on the border, the behaviour is in general not specified. If dir != (0, 0, 0), and the point is on the border with precision prec, the exiting volume is ignored.

Implements Heed::absvol.

Definition at line 194 of file surface.cpp.

194 {
195 mfunname("ulsvolume::check_point_inside(...)");
196 check_econd11(qsurf, <= 0, mcerr);
197 for (int n = 0; n < qsurf; n++) {
198 if (!(surf[n].get()->check_point_inside(fpt, dir, prec))) {
199 return 0;
200 }
201 }
202#ifdef TRACE_find_embed_vol
203 indn.n++;
204 Imcout << "ulsvolume::check_point_inside: the point is in volume\n";
205 Imcout << "point:" << fpt;
206 print(mcout, 0);
207 indn.n--;
208#endif
209 return 1;
210}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
virtual void print(std::ostream &file, int l) const
Definition: surface.cpp:377
int check_point_inside(const point &fpt, const vec &dir) const
Definition: surface.cpp:194
indentation indn
Definition: prstream.cpp:15
#define mcout
Definition: prstream.h:126
#define Imcout
Definition: prstream.h:197

Referenced by check_point_inside(), and range_ext().

◆ chname()

virtual void Heed::ulsvolume::chname ( char *  nm) const
inlinevirtual

Reimplemented from Heed::absvol.

Reimplemented in Heed::manip_ulsvolume.

Definition at line 170 of file surface.h.

170 {
171 strcpy(nm, "ulsvolume: ");
172 strcat(nm, name.c_str());
173 }

Referenced by print().

◆ copy()

virtual ulsvolume * Heed::ulsvolume::copy ( ) const
inlinevirtual

Reimplemented from Heed::absvol.

Reimplemented in Heed::manip_ulsvolume.

Definition at line 175 of file surface.h.

175{ return new ulsvolume(*this); }
ulsvolume()
Default constructor.
Definition: surface.cpp:335

◆ get_components()

void Heed::ulsvolume::get_components ( ActivePtr< absref_transmit > &  aref_tran)
protectedvirtual

Reimplemented from Heed::absref.

Definition at line 189 of file surface.cpp.

189 {
190 for (int n = 0; n < qsurf; n++) adrsurf[n] = surf[n].get();
191 aref_tran.pass(new absref_transmit(qsurf, (absref**)adrsurf));
192}
surface * adrsurf[pqqsurf]
Definition: surface.h:149

◆ income()

virtual void Heed::ulsvolume::income ( gparticle )
inlinevirtual

Reimplemented from Heed::absvol.

Definition at line 169 of file surface.h.

169{}

◆ print()

void Heed::ulsvolume::print ( std::ostream &  file,
int  l 
) const
virtual

Reimplemented from Heed::absvol.

Reimplemented in Heed::manip_ulsvolume.

Definition at line 377 of file surface.cpp.

377 {
378 char s[1000];
379 chname(s);
380 Ifile << "ulsvolume::print(l=" << l << "): " << s << '\n';
381 if (l > 0) {
382 indn.n += 2;
383 Ifile << "qsurf=" << qsurf << " prec=" << prec << '\n';
384 for (int n = 0; n < qsurf; ++n) {
385 Ifile << " nsurf=" << n << '\n';
386 surf[n].get()->print(file, l);
387 }
388 absvol::print(file, l);
389 indn.n -= 2;
390 }
391}
virtual void print(std::ostream &file, int l) const
Definition: volume.cpp:118
virtual void chname(char *nm) const
Definition: surface.h:170
#define Ifile
Definition: prstream.h:196

Referenced by check_point_inside(), Heed::box::print(), Heed::manip_ulsvolume::print(), and range_ext().

◆ range_ext()

int Heed::ulsvolume::range_ext ( trajestep fts,
int  s_ext 
) const
virtual

Find cross with current volume ignoring embraced ones. s_ext=1 exit, now point is inside, but embraced volumes are ingnored. s_ext=0 enter, now point is outside

Implements Heed::absvol.

Definition at line 212 of file surface.cpp.

212 {
213 mfunnamep("int ulsvolume::range_ext(trajestep& fts, int s_ext) const");
214 check_econd11(qsurf, <= 0, mcerr);
215#ifdef DEBUG_ulsvolume_range_ext
216 mcout << "ulsvolume::range_ext, START, s_ext=" << s_ext << " qsurf=" << qsurf
217 << '\n';
218 mcout << fts;
219#endif
220 vfloat crange[pqcrossurf];
221 point cpt[pqcrossurf];
222 int fs_ext[pqcrossurf];
223 int n, m, nc;
224 int s = 0; // sign of crossing
225 if (s_ext == 1) {
226 for (n = 0; n < qsurf; n++) {
227 int qc = surf[n].get()->range(fts, crange, cpt, fs_ext);
228 for (m = 0; m < qc; m++) {
229 if (fs_ext[m] == 1) {
230 s = 1;
231 // The last minute change, it was 0 somewhy instead of m
232 fts.mrange = crange[m]; // reduce the range
233 fts.mpoint = cpt[m];
234 break; // take only the first exit point, it should be closest
235 } else if (fs_ext[m] == 0) {
236 if (!(surf[n].get()->check_point_inside(fts.currpos, fts.dir,
237 prec))) {
238 funnw.ehdr(mcerr);
239 mcerr << "\nshould never happen\n"
240 << "It may happen if you call this function with s_ext==1\n"
241 << "for point outside the volume\n";
242 spexit(mcerr);
243 }
244 } else if (fs_ext[m] == 2)
245 break; // don't know what to do, safe to ignore
246 }
247 }
248
249 if (s == 1) {
250 fts.s_prec = 0;
251 }
252 return s;
253 } else { // for if(s_ext==1)
254 int ss = 0; // sign that there is cross with any of the surfaces
255 for (n = 0; n < qsurf; n++) {
256#ifdef DEBUG_ulsvolume_range_ext
257 Iprintn(mcout, n);
258#endif
259 int qc = surf[n].get()->range(fts, crange, cpt, fs_ext);
260#ifdef DEBUG_ulsvolume_range_ext
261 mcout << "ulsvolume::range_ext: qc=" << qc << "\n";
262 surf[n]->print(mcout, 1);
263#endif
264 for (nc = 0; nc < qc; nc++) // loop by crossing points
265 {
266#ifdef DEBUG_ulsvolume_range_ext
267 mcout << "nc=" << nc << " fs_ext[nc]=" << fs_ext[nc] << '\n';
268#endif
269 if (fs_ext[nc] == 0) // thus ignoring exitted surfaces
270 {
271 s = 1;
272 for (m = 0; m < qsurf; m++) // scan other surfaces and verify that
273 { // the crossing point is inside
274 if (m != n) {
275 if (surf[m].get()->check_point_inside1(cpt[nc], fs_ext[nc],
276 prec) == 0) {
277#ifdef DEBUG_ulsvolume_range_ext
278 mcout << "m=" << m << '\n';
279 mcout << "Since the point is outside of the other surface, "
280 << "it can not be border of volume\n";
281#endif
282 s = 0;
283 break;
284 }
285 }
286 }
287#ifdef DEBUG_ulsvolume_range_ext
288 Iprintn(mcout, s);
289#endif
290 if (s == 1) {
291#ifdef DEBUG_ulsvolume_range_ext
292 mcout << "The crossing point is inside all other surfaces, \n"
293 << "so it is good crossing point\n";
294#endif
295 ss = 1;
296 fts.mrange = crange[nc];
297 fts.mpoint = cpt[nc];
298 break; // since points are ordered, go to next surface,
299 // may be there is nearer crossing point
300 }
301 }
302 }
303 }
304 if (ss == 1) {
305 fts.s_prec = 0;
306 }
307#ifdef DEBUG_ulsvolume_range_ext
308 mcout << "ulsvolume::range_ext: at the end\n";
309 print(mcout, 1);
310 mcout << "ss=" << ss << '\n';
311#endif
312 return ss;
313 }
314}
#define mfunnamep(string)
Definition: FunNameStack.h:49
#define spexit(stream)
Definition: FunNameStack.h:256
const int pqcrossurf
Definition: surface.h:23
double vfloat
Definition: vfloat.h:16
#define Iprintn(file, name)
Definition: prstream.h:205

Referenced by Heed::box::range_ext().

◆ ulsvolume_init()

void Heed::ulsvolume::ulsvolume_init ( surface fsurf[pqqsurf],
int  fqsurf,
const std::string &  fname,
vfloat  fprec 
)

Definition at line 339 of file surface.cpp.

340 {
341 prec = fprec;
342 name = fname;
343 if (qsurf > 0) {
344 for (int n = 0; n < qsurf; ++n) surf[n].put(NULL);
345 }
346 qsurf = fqsurf;
347 for (int n = 0; n < qsurf; ++n) {
348 surf[n].put(fsurf[n]);
349 }
350}

Referenced by Heed::box::init_planes().

Member Data Documentation

◆ adrsurf

surface* Heed::ulsvolume::adrsurf[pqqsurf]
protected

Definition at line 149 of file surface.h.

Referenced by get_components().

◆ name

std::string Heed::ulsvolume::name

Definition at line 146 of file surface.h.

Referenced by chname(), Heed::manip_ulsvolume::chname(), ulsvolume(), and ulsvolume_init().

◆ qsurf

int Heed::ulsvolume::qsurf

◆ surf

ActivePtr<surface> Heed::ulsvolume::surf[pqqsurf]

The documentation for this class was generated from the following files: