EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_dynamic_geometry.cpp
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ dynamic_geometry geometry
5 # Copyright (C) 2015 National Research Council Canada
6 #
7 # This file is part of EGSnrc.
8 #
9 # EGSnrc is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU Affero General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ###############################################################################
23 #
24 # Author: Alexandre Demelo, 2023
25 #
26 # Contributors: Reid Townson
27 #
28 ###############################################################################
29 */
30 
31 
37 #include "egs_dynamic_geometry.h"
38 #include "egs_input.h"
39 #include "egs_functions.h"
40 
41 static bool EGS_DYNAMIC_GEOMETRY_LOCAL inputSet = false;
42 
43 // ----------------------------------------------------------------------------
44 // Implementation of EGS_DynamicGeometry methods
45 
46 // ----------------------------------------------------------------------------
47 // Avoid using deprecated methods from the base class
48 void EGS_DynamicGeometry::setMedia(EGS_Input *, int, const int *) {
49  egsWarning("EGS_DynamicGeometry::setMedia: don't use this method. Use the\n"
50  " setMedia() methods of the geometry objects that make up this geometry\n");
51 }
52 
53 void EGS_DynamicGeometry::setRelativeRho(int start, int end, EGS_Float rho) {
54  setRelativeRho(0);
55 }
56 
58  egsWarning("EGS_DynamicGeometry::setRelativeRho(): don't use this "
59  "method. Use the \n setRelativeRho() methods of the underlying "
60  "geometry\n");
61 }
62 
63 void EGS_DynamicGeometry::setBScaling(int start, int end, EGS_Float rho) {
64  setBScaling(0);
65 }
66 
68  egsWarning("EGS_DynamicGeometry::setBScaling(): don't use this "
69  "method. Use the \n setBScaling() methods of the underlying "
70  "geometry\n");
71 }
72 
73 // ----------------------------------------------------------------------------
74 // External C function to create EGS_DynamicGeometry
75 extern "C" {
76 
77  static void setInputs() {
78  inputSet = true;
79 
80  setBaseGeometryInputs(false);
81 
82  geomBlockInput->getSingleInput("library")->setValues({"egs_dynamic_geometry"});
83 
84  // Format: name, isRequired, description, vector string of allowed values
85  geomBlockInput->addSingleInput("base geometry", true, "The name of a previously defined geometry");
86  shared_ptr<EGS_BlockInput> motionBlock = geomBlockInput->addBlockInput("motion", true);
87  motionBlock->addSingleInput("control point", true, "Parameters to define motion: timeIndex xtrans ytrans ztrans xrot yrot zrot");
88  }
89 
90  EGS_DYNAMIC_GEOMETRY_EXPORT string getExample() {
91  string example;
92  example = {
93  R"(
94  # Example of egs_dynamic_geometry
95  #:start geometry:
96  name = my_dynamic
97  library = egs_dynamic_geometry
98  base geometry = geom
99  # geometry geom must be defined before this one
100  # units of cm and degrees
101  :start motion:
102  control point = 0.0 xtrans(1) ytrans(1) ztrans(1) xrot(1) yrot(1) zrot(1)
103  control point = timeIndex(2) xtrans(2) ytrans(2) ztrans(2) xrot(2) yrot(2) zrot(2)
104  ... etc...
105  control point = 1.0 xtrans(N) ytrans(N) ztrans(N) xrot(N) yrot(N) zrot(N)
106  :stop motion:
107  #:stop geometry:
108 )"};
109  return example;
110  }
111 
112  EGS_DYNAMIC_GEOMETRY_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
113  if(!inputSet) {
114  setInputs();
115  }
116  return geomBlockInput;
117  }
118 
119  EGS_DYNAMIC_GEOMETRY_EXPORT EGS_BaseGeometry *createGeometry(EGS_Input *input) {
120  EGS_BaseGeometry *g = 0;
121  EGS_Input *ij = input->takeInputItem("geometry", false);
122  if (ij) {
124  delete ij;
125  if (!g) {
126  egsWarning("createGeometry(EGS_DynamicGeometry): got a null pointer as a geometry?\n");
127  return 0;
128  }
129  }
130  if (!g) {
131  string gname;
132  int err = input->getInput("base geometry", gname);
133  if (err) {
134  err = input->getInput("my geometry", gname);
135  if (err) {
136  egsWarning("createGeometry(EGS_DynamicGeometry):base geometry must be defined\n either inline or using 'base geometry = some_name'\n");
137  return 0;
138  }
139  }
141  if (!g) {
142  egsWarning("createGeometry(EGS_DynamicGeometry): no geometry named %s is defined\n", gname.c_str());
143  return 0;
144  }
145  }
146  g->ref();
147 
148  // Now getting motion information for dynamic component
149  EGS_Input *dyninp = input->takeInputItem("motion");
150 
151  if (dyninp) {
152  EGS_DynamicGeometry *result = new EGS_DynamicGeometry(g, dyninp);
153  result->setName(input);
154  result->setBoundaryTolerance(input);
155  result->setLabels(input);
156  delete dyninp;
157  return result;
158  }
159  else {
160  egsWarning("EGS_DynamicGeometry: no control points input.\n");
161  return 0;
162  }
163  }
164 
165  int EGS_DynamicGeometry::getGlobalRegionOffset(const string geomName) {
166  return g->getGlobalRegionOffset(geomName);
167  }
168 
169  void EGS_DynamicGeometry::getLabelRegions(const string &str, vector<int> &regs, bool sanitize) {
170  // label defined in the geometry being transformed
171  g->getLabelRegions(str, regs, sanitize);
172 
173  // label defined in self (transformation input block)
174  EGS_BaseGeometry::getLabelRegions(str, regs, sanitize);
175  }
176 
178  stringstream itos;
179  ncpts = 0;
180  vector<EGS_Float> point;
181  EGS_ControlPoint cpt;
182  int err;
183  int icpts = 1;
184  itos << icpts;
185  string inputTag = "control point";
186  string inputTag_backCompat = "control point " + itos.str();
187  EGS_Input *currentInput;
188  int rotsize = 0;
189 
190  // Control points read one by one from motion block in dynamic geometry
191  // definition, and saved as a vector to points
192  while (true) {
193  currentInput = dyninp->takeInputItem(inputTag);
194  if (!currentInput || currentInput->getInput(inputTag, point)) {
195  currentInput = dyninp->takeInputItem(inputTag_backCompat);
196  if (!currentInput || currentInput->getInput(inputTag_backCompat, point)) {
197  delete currentInput;
198  break;
199  }
200  }
201  delete currentInput;
202 
203  // Checking the size to make sure it is a valid control point input
204  if (point.size() != 6 && point.size() != 7) {
205  egsWarning("EGS_DynamicGeometry: Control point %i must specify either 6 or 7 values.\n", icpts);
206  }
207  else {
208  if (ncpts == 0) {
209  // Variable to make sure all control point definitions have consistent formats
210  rotsize = point.size();
211  }
212 
213  // Make sure each time index is larger than the last
214  if (ncpts > 0 && point[0] < cpts[ncpts - 1].time) {
215  egsWarning("EGS_DynamicGeometry: Time index of control point %i < time index of control point %i\n", icpts, ncpts);
216  }
217 
218  // Checks that time index is valid (larger than zero)
219  else if (point[0] < 0.0) {
220  egsWarning("EGS_DynamicGeometry: Time index of control point %i < 0.0\n", icpts);
221  }
222 
223  // Checks that control point formats follow the first
224  else if (ncpts > 0 && point.size() != rotsize) {
225  egsWarning("EGS_DynamicGeometry: Rotation definition inconsistent \n");
226  }
227  else {
228  ncpts++;
229  if (ncpts == 1 && point[0] > 0.0) {
230  egsWarning("EGS_DynamicGeometry: Time index of control point 1 > 0.0. This will generate many warning messages.\n");
231  }
232  vector<EGS_Float> T_vect; // Vector storing translation information
233  vector<EGS_Float> R_vect; // Vector storing rotation information
234 
235  // Add translation coordinates to the translation vector
236  T_vect.push_back(point[1]);
237  T_vect.push_back(point[2]);
238  T_vect.push_back(point[3]);
239 
240  // Add rotation coordinates to rotation vector (cases
241  // differentiate cpt formats, 6 is 2 rotation parameters, 7
242  // is 3) In each case vector order is determined by format
243  // of EGS_rotationMatrix constructor (EGS_Float arguments)
244  if (point.size() == 6) {
245  R_vect.push_back(point[6]); // Rotation about z
246  R_vect.push_back(point[4]); // Rotation about x
247  } // 2 number case
248  if (point.size() == 7) {
249  R_vect.push_back(point[4]);
250  R_vect.push_back(point[5]); // Rotation about y
251  R_vect.push_back(point[6]); // Rotation about z
252  } // 3 number case
253 
254  // Add it to the vector of control points
255  cpt.time = point[0];
256  cpt.trnsl = T_vect;
257  cpt.rot = R_vect;
258  cpts.push_back(cpt);
259  icpts++;
260  itos.str("");
261  itos << icpts;
262 
263  // Define next control point i string for getInput in while condition
264  inputTag_backCompat = "control point " + itos.str();
265  }
266  }
267  }
268  if (ncpts <= 1) {
269  egsFatal("EGS_DynamicGeometry: Not enough or missing control points.\n");
270  }
271  if (cpts[ncpts - 1].time == 0.0) {
272  egsFatal("EGS_DynamicGeometry: Time index of last control point = 0. Something's wrong.\n");
273  }
274  else {
275 
276  // Normalize time index to max. value
277  for (int i = 0; i <= ncpts - 1; i++) {
278  cpts[i].time /= cpts[ncpts - 1].time;
279  }
280  }
281 
282  // Sets position to initial time in egs_view upon opening
283  updatePosition(0);
284  }
285 
286  int EGS_DynamicGeometry::getCoordGeom(EGS_Float rand, EGS_ControlPoint &gipt) {
287  int iindex = 0;
288  int i;
289 
290  // The following loop determines which 2 control points the current time
291  // index falls between
292  for (i = 0; i < ncpts; i++) {
293  if (rand < cpts[i].time - epsilon) {
294  iindex = i;
295  break;
296  }
297  }
298 
299  if (i == ncpts) {
300  egsWarning("EGS_DynamicGeometry: could not locate control point.\n");
301  return 1;
302  }
303 
304  // Below 3 vectors are defined, a vector containing the lower bound
305  // translation coordinates, a vector containing the upper bound
306  // translation coordinates, and a vector for the sampled translation
307  // coordinates
308  vector<EGS_Float> translation_LB = cpts[iindex - 1].trnsl;
309  vector<EGS_Float> translation_UB = cpts[iindex].trnsl;
310  vector<EGS_Float> translation_samp;
311 
312  // The following is a factor (between 0 and 1) used for sampling.
313  // Essentially, it represents the fractional position within the
314  // interval
315  EGS_Float factor = (rand - cpts[iindex - 1].time) / (cpts[iindex].time - cpts[iindex - 1].time);
316 
317  // Translations are given as the lower bound plus the length of the
318  // interval multiplied by the fractional position factor. So its
319  // essentially lower bound + n% of the interval length
320  translation_samp.push_back(translation_LB[0] + (translation_UB[0] - translation_LB[0]) * factor);
321  translation_samp.push_back(translation_LB[1] + (translation_UB[1] - translation_LB[1]) * factor);
322  translation_samp.push_back(translation_LB[2] + (translation_UB[2] - translation_LB[2]) * factor);
323 
324  // Update the translation coordinates in the current state control point object
325  gipt.trnsl = translation_samp;
326 
327  // Again 3 vectors defined, lower bound, upper bound, and sampled, this
328  // time for rotation coordinates
329  vector<EGS_Float> rotation_LB = cpts[iindex - 1].rot;
330  vector<EGS_Float> rotation_UB = cpts[iindex].rot;
331  vector<EGS_Float> rotation_samp;
332 
333  // Now set rotations. Current coordinates computed as before
334  // (lowerbound+n% of interval length), but now we also convert degrees
335  // to radians These must be done case by case (since order of arguments
336  // matters)
337  if (cpts[iindex].rot.size() == 2) {
338  rotation_samp.push_back((rotation_LB[0] + (rotation_UB[0] - rotation_LB[0]) * factor) * (M_PI / 180));
339  rotation_samp.push_back((rotation_LB[1] + (rotation_UB[1] - rotation_LB[1]) * factor) * (M_PI / 180));
340  }
341  else if (cpts[iindex].rot.size() == 3) {
342  rotation_samp.push_back((rotation_LB[0] + (rotation_UB[0] - rotation_LB[0]) * factor) * (M_PI / 180));
343  rotation_samp.push_back((rotation_LB[1] + (rotation_UB[1] - rotation_LB[1]) * factor) * (M_PI / 180));
344  rotation_samp.push_back((rotation_LB[2] + (rotation_UB[2] - rotation_LB[2]) * factor) * (M_PI / 180));
345  }
346  else {
347  egsWarning("EGS_DynamicGeometry: Invalid number of rotation parameters\n");
348  }
349 
350  // Update the rotation coordinates in the current state control point object
351  gipt.rot = rotation_samp;
352 
353  return 0;
354  }
355 
356  int EGS_DynamicGeometry::computeIntersections(int ireg, int n, const EGS_Vector &x,
357  const EGS_Vector &u, EGS_GeometryIntersections *isections) {
358  EGS_Vector xt(x), ut(u);
360  T.rotateInverse(ut);
361  return g->computeIntersections(ireg, n, xt, ut, isections);
362  }
363 
364  bool EGS_DynamicGeometry::isRealRegion(int ireg) const {
365  return g->isRealRegion(ireg);
366  }
367 
369  EGS_Vector xt(x);
370  T.inverseTransform(xt);
371  return g->isInside(xt);
372  }
373 
375  EGS_Vector xt(x);
376  T.inverseTransform(xt);
377  return g->isWhere(xt);
378  }
379 
381  return isWhere(x);
382  }
383 
384  int EGS_DynamicGeometry::medium(int ireg) const {
385  return g->medium(ireg);
386  }
387 
388  EGS_Float EGS_DynamicGeometry::howfarToOutside(int ireg, const EGS_Vector &x,
389  const EGS_Vector &u) {
390  return ireg >= 0 ? g->howfarToOutside(ireg, x * T, u * T.getRotation()) : 0;
391  }
392 
393  int EGS_DynamicGeometry::howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u,
394  EGS_Float &t, int *newmed, EGS_Vector *normal) {
395  EGS_Vector xt(x), ut(u);
397  T.rotateInverse(ut);
398  int inew = g->howfar(ireg, xt, ut, t, newmed, normal);
399  if (inew != ireg && normal) {
400  *normal = T.getRotation() * (*normal);
401  }
402  return inew;
403  }
404 
405  EGS_Float EGS_DynamicGeometry::hownear(int ireg, const EGS_Vector &x) {
406  EGS_Vector xt(x);
407  T.inverseTransform(xt);
408  return g->hownear(ireg, xt);
409  }
410 
411  int EGS_DynamicGeometry::getMaxStep() const {
412  return g->getMaxStep();
413  }
414 
415  bool EGS_DynamicGeometry::hasBooleanProperty(int ireg, EGS_BPType prop) const {
416  return g->hasBooleanProperty(ireg, prop);
417  }
418 
419  void EGS_DynamicGeometry::setBooleanProperty(EGS_BPType prop) {
421  }
422 
425  }
426 
427  void EGS_DynamicGeometry::setBooleanProperty(EGS_BPType prop, int start, int end, int step) {
428  g->setBooleanProperty(prop, start, end, step);
429  }
430 
431  void EGS_DynamicGeometry::addBooleanProperty(int bit, int start, int end, int step) {
432  g->addBooleanProperty(bit, start, end, step);
433  }
434 
435  const string &EGS_DynamicGeometry::getType() const {
436  return type;
437  }
438 
439  EGS_Float EGS_DynamicGeometry::getRelativeRho(int ireg) const {
440  return g->getRelativeRho(ireg);
441  }
442 
443  EGS_Float EGS_DynamicGeometry::getBScaling(int ireg) const {
444  return g->getBScaling(ireg);
445  }
446 
448  int errg = 1;
449  EGS_ControlPoint gipt;
450 
451  // Get the source from active application to extract time
453  while (errg) {
454  // Get time from source if it exists (otherwise gives -1)
455  ptime = app->getTimeIndex();
456  if (ptime < 0) {
457  // If no time is given by the source, randomly sample from 0 to 1
458  ptime = rndm->getUniform();
459  // Set randomly sampled time index for all objects in the
460  // simulation (through base source)
462  }
463  // Run the `getCoordGeom` method that will sample the control points
464  // given to find the transformation that will be applied for the
465  // current history
466  errg = getCoordGeom(ptime, gipt);
467  }
468 
469  // Create and set the current geometry transformation using the sampled
470  // coordinates from `getCoordGeom`. This is where the overloaded
471  // `EGS_AffineTransform` is used
472  EGS_AffineTransform *tDG = EGS_AffineTransform::getTransformation(gipt.trnsl, gipt.rot);
473  setTransformation(*tDG);
474  delete tDG;
475 
476  // Call `getNextGeom` on base geometry in case there are lower-level
477  // dynamic geometries
478  g->getNextGeom(rndm);
479  }
480 
481  void EGS_DynamicGeometry::updatePosition(EGS_Float time) {
482  int errg = 1;
483  EGS_ControlPoint gipt;
484 
485  // Run the `getCoordGeom` method that will use the control points given
486  // to find the transformation that will be applied for the current time
487  // index
488  errg = getCoordGeom(time, gipt);
489 
490  // Create and set the geometry transform with the updated coordinates
491  EGS_AffineTransform *tDG = EGS_AffineTransform::getTransformation(gipt.trnsl, gipt.rot);
492  setTransformation(*tDG);
493  delete tDG;
494 
495  // Call `updatePosition` on the base to allow lower-level geometries to
496  // update as needed
497  g->updatePosition(time);
498  }
499 
500  void EGS_DynamicGeometry::containsDynamic(bool &hasdynamic) {
501  // If the dynamic geometry implementation of `containsDynamic` is
502  // called, the simulation does indeed contain a dynamic geometry, so the
503  // boolean flag is set to true
504  hasdynamic = true;
505  }
506 
507  bool EGS_DynamicGeometry::hasRhoScaling() {
508  if (has_rho_scaling) {
509  return has_rho_scaling;
510  }
511 
512  return g->hasRhoScaling();
513  };
514 
515  void EGS_DynamicGeometry::finishInitialization() {
516  g->finishInitialization();
517  };
518 
519 }
A class providing affine transformations.
static EGS_AffineTransform * getTransformation(EGS_Input *inp)
Constructs an affine transformation object from the input pointed to by inp and returns a pointer to ...
const EGS_RotationMatrix & getRotation() const
Returns the rotation matrix of the affine transformation object.
void rotateInverse(EGS_Vector &v) const
Applies the inverse rotation to the vector v.
void inverseTransform(EGS_Vector &v) const
Applies the inverse transformation to the vector v.
Base class for advanced EGSnrc C++ applications.
static EGS_Application * activeApplication()
Get the active application.
EGS_Float getTimeIndex()
Returns the value of the time synchronization parameter.
void setTimeIndex(EGS_Float temp_time)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual int getGlobalRegionOffset(const string geomName)
Get the global region number for the first region in the geometry.
virtual int computeIntersections(int ireg, int n, const EGS_Vector &x, const EGS_Vector &u, EGS_GeometryIntersections *isections)
Calculates intersection distances to region boundaries.
virtual EGS_Float hownear(int ireg, const EGS_Vector &x)=0
Calculate the distance to a boundary for position x in any direction.
virtual bool hasBooleanProperty(int ireg, EGS_BPType prop) const
Is the boolean property prop set for region ireg ?
virtual EGS_Float howfarToOutside(int ireg, const EGS_Vector &x, const EGS_Vector &u)
virtual EGS_Float getBScaling(int ireg) const
Get the B field scaling factor in region ireg.
static EGS_BaseGeometry * createSingleGeometry(EGS_Input *inp)
Create a single geometry from the input inp.
virtual int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)=0
Calculate the distance to a boundary from x along the direction u.
bool has_rho_scaling
Does this geometry have relative mass density scvaling?
virtual bool hasRhoScaling()
Does this geometry object have a mass density scaling feature?
virtual bool isRealRegion(int ireg) const
Returnes true if ireg is a real region, false otherwise.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
virtual bool isInside(const EGS_Vector &x)=0
Is the position x inside the geometry?
virtual EGS_Float getRelativeRho(int ireg) const
Get the relative mass density in region ireg.
virtual void setBooleanProperty(EGS_BPType prop)
Set the boolean properties of the entire geometry to prop.
virtual int getMaxStep() const
Returns the maximum number of steps through the geometry.
EGS_Application * app
The application this object belongs to.
virtual int medium(int ireg) const
Returns the medium index in region ireg.
int setLabels(EGS_Input *input)
Set the labels from an input block.
int ref()
Increase the reference count to this geometry.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
virtual void addBooleanProperty(int bit)
Add a boolean property for the entire geometry by setting the bit'th bit.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
virtual void getLabelRegions(const string &str, vector< int > &regs, bool sanitize=true)
Get the list of all regions labeled with str.
virtual int isWhere(const EGS_Vector &x)=0
In which region is poisition x?
A dynamic geometry.
void setBooleanProperty(EGS_BPType prop)
Sets a boolean property for the dynamic geometry.
int ncpts
Number of control points.
void getLabelRegions(const string &str, vector< int > &regs, bool sanitize=true)
Retrieves regions labeled with a given string.
EGS_BaseGeometry * g
The geometry undergoing dynamic motion.
void getNextGeom(EGS_RandomGenerator *rndm)
Updates the next particle state for geometries. It is tasked with determining the next state of the d...
bool isInside(const EGS_Vector &x)
Checks if a point is inside the dynamic geometry.
void setTransformation(EGS_AffineTransform t)
Sets the current state transform of the geometry. This is called when checking location....
int getMaxStep() const
Returns the maximum step allowed for the dynamic geometry.
void containsDynamic(bool &hasdynamic)
Determines whether the simulation geometry contains a dynamic geometry.
int computeIntersections(int ireg, int n, const EGS_Vector &x, const EGS_Vector &u, EGS_GeometryIntersections *isections)
Computes intersections of a particle with the dynamic geometry.
EGS_Float hownear(int ireg, const EGS_Vector &x)
Computes the distance to the nearest boundary.
EGS_Float howfarToOutside(int ireg, const EGS_Vector &x, const EGS_Vector &u)
Computes the distance to the outside of the dynamic geometry.
string type
The geometry type.
void buildDynamicGeometry(EGS_BaseGeometry *g, EGS_Input *dyninp)
Builds the dynamic geometry using input specifications.
void updatePosition(EGS_Float time)
Updates the position of the dynamic geometry to the specified time.
void setMedia(EGS_Input *inp, int, const int *)
Don't define media in the transformed geometry definition.
EGS_Float getRelativeRho(int ireg) const
Gets the relative density of a region in the dynamic geometry.
vector< EGS_ControlPoint > cpts
Control points for dynamic motion.
int getCoordGeom(EGS_Float rand, EGS_ControlPoint &gipt)
Extract coordinates for the next dynamic geometry position.
bool hasBooleanProperty(int ireg, EGS_BPType prop) const
Checks if the dynamic geometry has a specific boolean property in a region.
EGS_AffineTransform T
Affine transformation representing the current state.
EGS_Float ptime
Time index corresponding to the particle.
const string & getType() const
Returns the type of the dynamic geometry.
void addBooleanProperty(int bit)
Adds a boolean property for the dynamic geometry.
void setBScaling(int start, int end, EGS_Float bf)
Sets the magnetic field scaling factor for a range of regions in the dynamic geometry.
bool isRealRegion(int ireg) const
Checks if a region is real.
int getGlobalRegionOffset(const string geomName)
Pass along getGlobalRegionOffset calls to the original geometry.
int medium(int ireg) const
Returns the medium index of a region.
int isWhere(const EGS_Vector &x)
Checks the location of a point.
void setRelativeRho(int start, int end, EGS_Float rho)
Sets the relative density for a range of regions in the dynamic geometry.
int inside(const EGS_Vector &x)
Alias for isWhere method.
EGS_Float getBScaling(int ireg) const
Gets the magnetic field scaling factor for a region in the dynamic geometry.
int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)
Computes the distance to the nearest boundary.
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
EGS_Input * takeInputItem(const string &key, bool self=true)
Get the property named key.
Definition: egs_input.cpp:229
int getInput(const string &key, vector< string > &values) const
Assign values to an array of strings from an input identified by key.
Definition: egs_input.cpp:341
Base random number generator class. All random number generators should be derived from this class.
Definition: egs_rndm.h:90
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
Definition: egs_rndm.h:126
A class representing 3D vectors.
Definition: egs_vector.h:57
A dynamic geometry: header.
Global egspp functions header file.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Definition: egs_glib.cpp:84
EGS_Input class header file.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
Definition: egs_functions.h:62
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.