EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
EGS_ASwitchedEnvelope Class Reference

This geometry type allows you to activate and deactivate inscribed geometries in custom egspp user codes. More...

#include <egs_autoenvelope.h>

Inheritance diagram for EGS_ASwitchedEnvelope:
EGS_AEnvelope EGS_BaseGeometry

Public Member Functions

 EGS_ASwitchedEnvelope (EGS_BaseGeometry *base_geom, const vector< AEnvelopeAux > inscribed, const string &Name="", bool debug=false, string output_vc_file="no")
 
const string & getType () const
 
void setActiveGeometries (vector< EGS_BaseGeometry * > geoms)
 
void setActiveGeometries (vector< int > geom_indexes)
 
bool hasActiveGeom (int ireg)
 
bool hasInactiveGeom (int ireg)
 
void setActiveByIndex (int inscribed_index)
 
void activateByIndex (int inscribed_index)
 
void deactivateByIndex (int inscribed_index)
 
void cycleActive ()
 
- Public Member Functions inherited from EGS_AEnvelope
 EGS_AEnvelope (EGS_BaseGeometry *base_geom, const vector< AEnvelopeAux > inscribed, const string &Name="", bool debug=false, string output_vc_file="no")
 
int getGlobalRegFromLocalReg (EGS_BaseGeometry *g, int local_reg)
 
int getGlobalRegFromLocal (const volcor::GeomRegPairT local) const
 
volcor::GeomRegPairT getLocalFromGlobalReg (int ireg) const
 
int getNRegWithInscribed () const
 
bool isRealRegion (int ireg) const
 
bool isInside (const EGS_Vector &x)
 
int isWhere (const EGS_Vector &x)
 
int inside (const EGS_Vector &x)
 
int medium (int ireg) const
 
int computeIntersections (int ireg, int n, const EGS_Vector &X, const EGS_Vector &u, EGS_GeometryIntersections *isections)
 
EGS_Float howfarToOutside (int ireg, const EGS_Vector &x, const EGS_Vector &u)
 
int howfar (int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)
 
EGS_Float hownear (int ireg, const EGS_Vector &x)
 
bool hasBooleanProperty (int ireg, EGS_BPType prop) const
 
void setBooleanProperty (EGS_BPType)
 
void addBooleanProperty (int)
 
void setBooleanProperty (EGS_BPType, int, int, int step=1)
 
void addBooleanProperty (int, int, int, int step=1)
 
int getMaxStep () const
 
virtual EGS_Float getVolume (int ireg)
 
virtual EGS_Float getCorrectionRatio (int ireg)
 
void printInfo () const
 
void setRelativeRho (int start, int end, EGS_Float rho)
 
void setRelativeRho (EGS_Input *)
 
EGS_Float getRelativeRho (int ireg) const
 
- Public Member Functions inherited from EGS_BaseGeometry
 EGS_BaseGeometry (const string &Name)
 Construct a geometry named Name. More...
 
virtual ~EGS_BaseGeometry ()
 Destructor. More...
 
bool isConvex () const
 Is the geometry convex? More...
 
virtual EGS_Float getBound (int idir, int ind)
 Returns region boundaries in direction determined by idir. More...
 
virtual int getNRegDir (int idir)
 
int regions () const
 Returns the number of local regions in this geometry. More...
 
void setMedium (const string &Name)
 Set all regions to a medium with name Name. More...
 
void setMedium (int start, int end, const string &Name, int delta=1)
 Set every delta'th region between start and end to the medium named Name. More...
 
void setMedium (int imed)
 Set all regions to a medium with index imed. More...
 
void setMedium (int istart, int iend, int imed, int delta=1)
 Set every delta'th region between start and end (inclusive) to imed. More...
 
void setMedia (EGS_Input *inp)
 Set the media in the geometry from the input pointed to by inp. More...
 
bool hasRhoScaling () const
 Does this geometry object have a mass density scaling feature? More...
 
EGS_Float getMediumRho (int ind) const
 
virtual void setApplication (EGS_Application *app)
 
bool hasBScaling () const
 Does this geometry object have a B field scaling feature?
 
virtual EGS_Float getBScaling (int ireg) const
 Get the B field scaling factor in region ireg.
 
virtual void setBScaling (int start, int end, EGS_Float bf)
 Set the B field scaling factor in regions. More...
 
virtual void setBScaling (EGS_Input *)
 Set the B field scaling factor from an user input. More...
 
const string & getName () const
 Get the name of this geometry. More...
 
void setDebug (bool deb)
 Turn debugging on. More...
 
void setName (EGS_Input *inp)
 Set the name of the geometry from the input inp. More...
 
void setBoundaryTolerance (EGS_Input *inp)
 Set the value of the boundary tolerance from the input inp. More...
 
void setBoundaryTolerance (EGS_Float tol)
 Set the value of the boundary tolerance from argument.
 
int ref ()
 Increase the reference count to this geometry. More...
 
int deref ()
 Decrease the reference count to this geometry. More...
 
EGS_Float getBoundaryTolerance ()
 Get the value of the boundary tolerance.
 
virtual void getNumberRegions (const string &str, vector< int > &regs)
 Get a list of all the regions labeled with a number.
 
virtual void getLabelRegions (const string &str, vector< int > &regs)
 Get the list of all regions labeled with str.
 
virtual const string & getLabelName (const int i)
 Get the name of the i-th explicit label in the geometry.
 
virtual int getLabelCount ()
 Get the number of explicit labels in the geometry.
 
int setLabels (EGS_Input *input)
 Set the labels from an input block.
 
int setLabels (const string &inp)
 Set the labels from an input string.
 

Protected Member Functions

vector< EGS_BaseGeometry * > getGeomsInRegion (int ireg)
 
- Protected Member Functions inherited from EGS_AEnvelope
void setMedia (EGS_Input *, int, const int *)
 Don't set media for an envelope geometry. More...
 
double findRegionsInscribedIn (vector< EGS_BaseGeometry * >, vector< EGS_AffineTransform * >, volcor::VCOptions *)
 
double loadFileVolumeCorrections (vector< EGS_BaseGeometry * >, vector< EGS_AffineTransform * >, volcor::VCOptions *)
 
void applyVolumeCorrections (volcor::VCOptions *opts, volcor::HitCounterT hit_counter)
 
void writeVCToFile (ostream &)
 
void writeVolumeCorrection ()
 

Static Protected Attributes

static string type = "EGS_ASwitchedEnvelope"
 Geometry type.
 
- Static Protected Attributes inherited from EGS_AEnvelope
static string type = "EGS_AEnvelope"
 Geometry type.
 
static const string allowed_base_geom_types [] = {"EGS_cSpheres", "EGS_cSphericalShell", "EGS_XYZGeometry", "EGS_RZ"}
 
- Static Protected Attributes inherited from EGS_BaseGeometry
static int error_flag = 0
 Set to non-zero status if a geometry problem is encountered.
 

Additional Inherited Members

- Static Public Member Functions inherited from EGS_AEnvelope
static vector
< EGS_AffineTransform * > 
createTransforms (EGS_Input *inpt)
 Take a block of transformations and return vector of EGS_AffineTransforms. More...
 
static bool allowedBaseGeomType (const string &geom_type)
 function for checking whether a given geometry type is allowed to be used as a base geometry
 
- Static Public Member Functions inherited from EGS_BaseGeometry
static int findRegion (EGS_Float xp, int np, const EGS_Float *p)
 Find the bin to which xp belongs, given np bin edges p. More...
 
static int nMedia ()
 Get the number of media registered so far by all geometries. More...
 
static const char * getMediumName (int ind)
 Get the name of medium with index ind. More...
 
static int addMedium (const string &medname)
 Add a medium or get the index of an existing medium. More...
 
static int getMediumIndex (const string &medname)
 Get the index of a medium named medname. More...
 
static EGS_BaseGeometrycreateGeometry (EGS_Input *)
 Create a geometry (or geometries) from a given input. More...
 
static EGS_BaseGeometrycreateSingleGeometry (EGS_Input *inp)
 Create a single geometry from the input inp. More...
 
static void clearGeometries ()
 Clears (deletes) all geometries in the currently active geometry list. More...
 
static EGS_BaseGeometrygetGeometry (const string &Name)
 Get a pointer to the geometry named Name. More...
 
static EGS_BaseGeometry ** getGeometries ()
 
static int getNGeometries ()
 
static string getUniqueName ()
 Get a unique geometry name. More...
 
static void describeGeometries ()
 Describes all existing geometries. More...
 
static void setActiveGeometryList (int list)
 Set the currently active geometry list. More...
 
static int getLastError ()
 
static void resetErrorFlag ()
 
- Protected Attributes inherited from EGS_AEnvelope
EGS_BaseGeometrybase_geom
 The envelope geometry.
 
vector< EGS_BaseGeometry * > inscribed_geoms
 The inscribed geometries.
 
vector< EGS_AffineTransform * > transforms
 The inscribed geometries.
 
vector< volcor::VCOptions * > opts
 The inscribed geometries.
 
int nregbase
 Number of regions in the base geometry.
 
int ninscribed
 Number of regions in the base geometry.
 
int nreg_with_inscribed
 
bool debug_info
 
string output_vc
 
volcor::VCResults vc_results
 
map< volcor::GeomRegPairT, int > local_to_global_reg
 
map< int, volcor::GeomRegPairTglobal_reg_to_local
 
vector< EGS_BaseGeometry * > * geoms_in_region
 
- Protected Attributes inherited from EGS_BaseGeometry
int nreg
 Number of local regions in this geometry. More...
 
string name
 Name of this geometry. More...
 
short * region_media
 Array of media indeces. More...
 
int med
 Medium index. More...
 
bool has_rho_scaling
 Does this geometry have relative mass density scvaling? More...
 
EGS_Float * rhor
 Array with relative mass densities. More...
 
bool has_B_scaling
 Does this geometry has B field scaling factor? More...
 
bool has_Ref_rho
 
EGS_Float * bfactor
 Array with B field scaling factors. More...
 
EGS_Float rhoRef
 Reference density for B field scaling. More...
 
int nref
 Number of references to this geometry. More...
 
bool debug
 Debugging flag. More...
 
bool is_convex
 Is this geometry convex? More...
 
EGS_BPType bproperty
 A bit mask of boolean properties for the entire geometry. More...
 
EGS_BPType * bp_array
 An array of boolean properties on a region by region basis. More...
 
EGS_Float boundaryTolerance
 Boundary tolerance for geometries that need it.
 
EGS_Float halfBoundaryTolerance
 
vector< labellabels
 Labels. More...
 
EGS_Applicationapp
 The application this object belongs to.
 

Detailed Description

This geometry type allows you to activate and deactivate inscribed geometries in custom egspp user codes.

EGS_ASwitchedEnvelope

This geometry type allows you to activate and deactivate inscribed geometries in custom egspp user codes. As an example, this geometry was developed to allow for investigating how interseed attenuation affects dose distributions in brachytherapy implants. By only having one seed active at a time, you can simulate a superposition (TG43 style) type calculation.

The inputs are all exactly the same as the EGS_AEnvelope and only the first inscribed geometry is activated upon initialization.

   EGS_BaseGeometry *tmp_switch = EGS_BaseGeometry::getGeometry(your_geom_name);
   EGS_ASwitchedEnvelope *switched_geom = static_cast<EGS_ASwitchedEnvelope*>(tmp_switch);

   // activate only the ith geometry (deactivate the rest)
   switched_geom->setActiveByIndex(i);

   // add ith geometry to currently active list
   switched_geom->activateByIndex(i);

   // remove ith geometry from currently active list
   switched_geom->deactivateByIndex(i);

   // activate multipe geoms by index
   vector<int> to_activate;
   to_activate.push_back(i);
   to_activate.push_back(j);
   switched_geom->setActiveGeometries(to_activate);

   // activate multipe geoms by pointer
   vector<EGS_BaseGeometry* > to_activate;
   to_activate.push_back(pointer_to_inscribed_i);
   to_activate.push_back(pointer_to_inscribed_j);
   switched_geom->setActiveGeometries(to_activate);


   // cycle through activating one geometry at a time
   // and deactivating the rest
   switched_geom->cycleActive();
   switched_geom->cycleActive();
   switched_geom->cycleActive();

Definition at line 549 of file egs_autoenvelope.h.

Member Function Documentation

void EGS_ASwitchedEnvelope::setActiveGeometries ( vector< EGS_BaseGeometry * >  geoms)

activate multiple geometries by passing pointers and set the current pointer to the first geometryin the input vector

Definition at line 825 of file egs_autoenvelope.cpp.

References EGS_AEnvelope::inscribed_geoms.

Referenced by cycleActive(), and setActiveByIndex().

void EGS_ASwitchedEnvelope::setActiveGeometries ( vector< int >  geom_indexes)

activate multiple geometries at input indexes and set the current pointer to the first index in the input vector

Definition at line 842 of file egs_autoenvelope.cpp.

References egsFatal, and EGS_AEnvelope::inscribed_geoms.

bool EGS_ASwitchedEnvelope::hasActiveGeom ( int  ireg)

check if a given region in the base geometry has an active geometry in it

Definition at line 859 of file egs_autoenvelope.cpp.

bool EGS_ASwitchedEnvelope::hasInactiveGeom ( int  ireg)

check if a given region in the base geometry has an inactive geometry in it

Definition at line 870 of file egs_autoenvelope.cpp.

void EGS_ASwitchedEnvelope::setActiveByIndex ( int  inscribed_index)

activate a single geometry and deactivate all the rest

Definition at line 882 of file egs_autoenvelope.cpp.

References EGS_AEnvelope::inscribed_geoms, and setActiveGeometries().

void EGS_ASwitchedEnvelope::activateByIndex ( int  inscribed_index)

activate an inscribed geometry

Definition at line 889 of file egs_autoenvelope.cpp.

References EGS_AEnvelope::inscribed_geoms.

void EGS_ASwitchedEnvelope::deactivateByIndex ( int  inscribed_index)

deactivate an inscribed geometry

Definition at line 893 of file egs_autoenvelope.cpp.

References EGS_AEnvelope::inscribed_geoms.

void EGS_ASwitchedEnvelope::cycleActive ( )

increment current pointer and activate the next geometry

Definition at line 903 of file egs_autoenvelope.cpp.

References EGS_AEnvelope::inscribed_geoms, and setActiveGeometries().


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