Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
volume.cpp File Reference

Go to the source code of this file.

Functions

int operator== (manip_absvol_treeid &tid1, manip_absvol_treeid &tid2)
 
 macro_copy_body_not_defined (absvol) int manip_absvol
 

Function Documentation

◆ macro_copy_body_not_defined()

macro_copy_body_not_defined ( absvol  )

Definition at line 172 of file volume.cpp.

176 {
177 const abssyscoor* asc = Gasc();
178 const absvol* avol = Gavol();
179 if (asc != NULL) {
180 point pt = fpt;
181 vec dir = fdir;
182 pt.up(asc);
183 dir.up(asc);
184 return avol->check_point_inside(pt, dir);
185 }
186 return avol->check_point_inside(fpt, fdir);
187}
188
189int manip_absvol::m_find_embed_vol(const point& fpt, const vec& fdir,
190 manip_absvol_treeid* atid) const {
191 mfunname("int manip_absvol::m_find_embed_vol(...)");
192 absvol* avol = Gavol();
193 point pt = fpt;
194 up_absref(&pt);
195 vec dir = fdir;
196 up_absref(&dir);
197 atid->eid[atid->qeid++].amvol.put((manip_absvol*)this); // to kill const
198 int s = atid->qeid;
199 int iret = avol->find_embed_vol(pt, dir, atid);
200 if (iret == 0) {
201 if (atid->qeid < s) {
202 mcerr << "manip_absvol::m_find_embed_vol: should never happen\n";
203 exit(1);
204 }
205 atid->qeid--;
206 return 0;
207 } else {
208 if (atid->qeid < s) {
209 mcerr << "manip_absvol::m_find_embed_vol: should never happen\n";
210 exit(1);
211 }
212 return 1;
213 }
214}
215
216int manip_absvol::m_range(trajestep& fts, int s_ext, int& sb,
217 manip_absvol_eid* faeid) const {
218 trajestep ts(fts);
219 up_absref(&ts);
220 absvol* avol = Gavol();
221
222 int s = avol->range(ts, s_ext, sb, faeid);
223 if (s == 1) {
224 down_absref(&ts);
225 fts = ts;
226 }
227 return s;
228}
229
230int manip_absvol::m_range_ext(trajestep& fts, int s_ext) const {
231 trajestep ts(fts);
232 up_absref(&ts);
233 absvol* avol = Gavol();
234 int s = avol->range_ext(ts, s_ext);
235 if (s == 1) {
236 down_absref(&ts);
237 fts = ts;
238 }
239 return s;
240}
241
242void manip_absvol::m_chname(char* nm) const {
243 strcpy(nm, "mvol->");
244 Gavol()->chname(&nm[6]);
245}
246
247void manip_absvol::m_print(std::ostream& file, int l) const {
248 if (l <= 0) return;
249 char s[1000];
250 m_chname(s);
251 Ifile << "manip_absvol::m_print(l=" << l << "): " << s << '\n';
252 --l;
253 if (l > 0) {
254 indn.n += 2;
255 const abssyscoor* asys = Gasc();
256 if (asys != NULL)
257 asys->print(file, l - 1);
258 else
259 mcout << "manip_absvol::m_print: system==NULL\n";
260 absvol* avol = Gavol();
261 if (avol != NULL)
262 avol->print(file, l - 1);
263 else
264 mcout << "manip_absvol::m_print: avol==NULL\n";
265 indn.n -= 2;
266 }
267 file.flush();
268
269}
270
272
273// ********* sh_manip_absvol *********
274void sh_manip_absvol::get_components(ActivePtr<absref_transmit>& aref_tran) {
275 aref_ptr[0] = &csys;
276 aref_tran.pass(new absref_transmit(1, aref_ptr));
277}
#define macro_copy_body_not_defined(type)
Definition: AbsPtr.h:299
#define mfunname(string)
Definition: FunNameStack.h:67
virtual void print(std::ostream &file, int l) const
Definition: vec.cpp:572
Definition: volume.h:91
virtual int find_embed_vol(const point &fpt, const vec &dir, manip_absvol_treeid *atid) const
Definition: volume.cpp:92
virtual int range_ext(trajestep &fts, int s_ext) const =0
virtual int check_point_inside(const point &fpt, const vec &dir) const =0
virtual int range(trajestep &fts, int s_ext, int &sb, manip_absvol_eid *faeid) const
Definition: volume.cpp:118
virtual void chname(char *nm) const
Definition: volume.h:143
virtual void print(std::ostream &file, int l) const
Definition: volume.cpp:144
PassivePtr< manip_absvol > amvol
Definition: volume.h:39
manip_absvol_eid eid[pqamvol]
Definition: volume.h:52
void down_absref(absref *f) const
Definition: volume.h:216
virtual const abssyscoor * Gasc(void) const
Definition: volume.h:198
void up_absref(absref *f) const
Definition: volume.h:220
virtual int m_range_ext(trajestep &fts, int s_ext) const
void m_chname(char *nm) const
virtual absvol * Gavol(void) const =0
virtual int m_range(trajestep &fts, int s_ext, int &sb, manip_absvol_eid *faeid) const
virtual void m_print(std::ostream &file, int l) const
virtual int m_find_embed_vol(const point &fpt, const vec &fdir, manip_absvol_treeid *atid) const
Definition: vec.h:477
virtual void up(const abssyscoor *fasc)
Definition: vec.cpp:550
absref * aref_ptr[1]
Definition: volume.h:241
fixsyscoor csys
Definition: volume.h:233
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: vec.h:248
void up(const basis *fabas_new)
Definition: vec.cpp:269
indentation indn
Definition: prstream.cpp:13
#define mcout
Definition: prstream.h:133
#define Ifile
Definition: prstream.h:207
#define mcerr
Definition: prstream.h:135

◆ operator==()

int operator== ( manip_absvol_treeid tid1,
manip_absvol_treeid tid2 
)

Definition at line 56 of file volume.cpp.

56 {
57 // checks total route
58 // first to make fast rejection
59 if (tid1.qeid != tid2.qeid) return 0;
60 if (tid1.G_laeid()->nembed != tid2.G_laeid()->nembed) return 0;
61 if (tid1.G_lamvol() != tid2.G_lamvol()) return 0;
62 // more thoroughly
63 for (int n = 0; n < tid1.qeid - 1; ++n) {
64 // the last is checked
65 if (tid1.eid[n].amvol.get() != tid2.eid[n].amvol.get()) return 0;
66 }
67 return 1;
68}
const manip_absvol_eid * G_laeid() const
Definition: volume.h:54
manip_absvol * G_lamvol() const
Definition: volume.h:58