47 egsWarning(
"EGS_DynamicGeometry::setMedia: don't use this method. Use the\n"
48 " setMedia() methods of the geometry objects that make up this geometry\n");
56 egsWarning(
"EGS_DynamicGeometry::setRelativeRho(): don't use this "
57 "method. Use the \n setRelativeRho() methods of the underlying "
66 egsWarning(
"EGS_DynamicGeometry::setBScaling(): don't use this "
67 "method. Use the \n setBScaling() methods of the underlying "
82 egsWarning(
"createGeometry(EGS_DynamicGeometry): got a null pointer as a geometry?\n");
88 int err = input->
getInput(
"my geometry", gname);
90 egsWarning(
"createGeometry(EGS_DynamicGeometry): my geometry must be defined\n either inline or using 'my geometry = some_name'\n");
95 egsWarning(
"createGeometry(EGS_DynamicGeometry): no geometry named %s is defined\n", gname.c_str());
112 egsWarning(
"EGS_DynamicGeometry: no control points input.\n");
128 vector<EGS_Float> point;
133 string inputTag =
"control point";
134 string inputTag_backCompat =
"control point " + itos.str();
142 if (!currentInput || currentInput->
getInput(inputTag, point)) {
144 if (!currentInput || currentInput->
getInput(inputTag_backCompat, point)) {
152 if (point.size() != 6 && point.size() != 7) {
153 egsWarning(
"EGS_DynamicGeometry: Control point %i must specify either 6 or 7 values.\n", icpts);
158 rotsize = point.size();
163 egsWarning(
"EGS_DynamicGeometry: Time index of control point %i < time index of control point %i\n", icpts,
ncpts);
167 else if (point[0] < 0.0) {
168 egsWarning(
"EGS_DynamicGeometry: Time index of control point %i < 0.0\n", icpts);
172 else if (
ncpts > 0 && point.size() != rotsize) {
173 egsWarning(
"EGS_DynamicGeometry: Rotation definition inconsistent \n");
177 if (
ncpts == 1 && point[0] > 0.0) {
178 egsWarning(
"EGS_DynamicGeometry: Time index of control point 1 > 0.0. This will generate many warning messages.\n");
180 vector<EGS_Float> T_vect;
181 vector<EGS_Float> R_vect;
184 T_vect.push_back(point[1]);
185 T_vect.push_back(point[2]);
186 T_vect.push_back(point[3]);
192 if (point.size() == 6) {
193 R_vect.push_back(point[6]);
194 R_vect.push_back(point[4]);
196 if (point.size() == 7) {
197 R_vect.push_back(point[4]);
198 R_vect.push_back(point[5]);
199 R_vect.push_back(point[6]);
212 inputTag_backCompat =
"control point " + itos.str();
217 egsFatal(
"EGS_DynamicGeometry: Not enough or missing control points.\n");
220 egsFatal(
"EGS_DynamicGeometry: Time index of last control point = 0. Something's wrong.\n");
225 for (
int i = 0; i <=
ncpts - 1; i++) {
240 for (i = 0; i <
ncpts; i++) {
248 egsWarning(
"EGS_DynamicGeometry: could not locate control point.\n");
256 vector<EGS_Float> translation_LB =
cpts[iindex - 1].trnsl;
257 vector<EGS_Float> translation_UB =
cpts[iindex].trnsl;
258 vector<EGS_Float> translation_samp;
263 EGS_Float factor = (rand -
cpts[iindex - 1].time) / (
cpts[iindex].time -
cpts[iindex - 1].time);
268 translation_samp.push_back(translation_LB[0] + (translation_UB[0] - translation_LB[0]) * factor);
269 translation_samp.push_back(translation_LB[1] + (translation_UB[1] - translation_LB[1]) * factor);
270 translation_samp.push_back(translation_LB[2] + (translation_UB[2] - translation_LB[2]) * factor);
273 gipt.
trnsl = translation_samp;
277 vector<EGS_Float> rotation_LB =
cpts[iindex - 1].rot;
278 vector<EGS_Float> rotation_UB =
cpts[iindex].rot;
279 vector<EGS_Float> rotation_samp;
285 if (
cpts[iindex].rot.size() == 2) {
286 rotation_samp.push_back((rotation_LB[0] + (rotation_UB[0] - rotation_LB[0]) * factor) * (M_PI / 180));
287 rotation_samp.push_back((rotation_LB[1] + (rotation_UB[1] - rotation_LB[1]) * factor) * (M_PI / 180));
289 else if (
cpts[iindex].rot.size() == 3) {
290 rotation_samp.push_back((rotation_LB[0] + (rotation_UB[0] - rotation_LB[0]) * factor) * (M_PI / 180));
291 rotation_samp.push_back((rotation_LB[1] + (rotation_UB[1] - rotation_LB[1]) * factor) * (M_PI / 180));
292 rotation_samp.push_back((rotation_LB[2] + (rotation_UB[2] - rotation_LB[2]) * factor) * (M_PI / 180));
295 egsWarning(
"EGS_DynamicGeometry: Invalid number of rotation parameters\n");
299 gipt.
rot = rotation_samp;
342 EGS_Float &t,
int *newmed,
EGS_Vector *normal) {
346 int inew =
g->
howfar(ireg, xt, ut, t, newmed, normal);
347 if (inew != ireg && normal) {
425 g->getNextGeom(rndm);
443 g->updatePosition(time);
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 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 void getLabelRegions(const string &str, vector< int > ®s)
Get the list of all regions labeled with str.
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.
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 int isWhere(const EGS_Vector &x)=0
In which region is poisition x?
void setBooleanProperty(EGS_BPType prop)
Sets a boolean property for the dynamic geometry.
int ncpts
Number of control points.
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.
void getLabelRegions(const string &str, vector< int > ®s)
Retrieves regions labeled with a given string.
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 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.
Base random number generator class. All random number generators should be derived from this class.
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
A class representing 3D vectors.
A dynamic geometry: header.
Global egspp functions header file.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.
Structure to store control point information for dynamic geometry.
vector< EGS_Float > rot
Vector specifying rotation.
EGS_Float time
Time index for control point.
vector< EGS_Float > trnsl
Vector specifying x, y, z translation.