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 | Protected Attributes | List of all members
EGS_TransformedGeometry Class Reference

A transformed geometry. More...

#include <egs_gtransformed.h>

Inheritance diagram for EGS_TransformedGeometry:
EGS_BaseGeometry

Public Member Functions

 EGS_TransformedGeometry (EGS_BaseGeometry *G, const EGS_AffineTransform &t, const string &Name="")
 Construct a geometry that is a copy of the geometry G transformed by t.
 
void setTransformation (const EGS_AffineTransform &t)
 
int computeIntersections (int ireg, int n, const EGS_Vector &x, const EGS_Vector &u, EGS_GeometryIntersections *isections)
 
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
 
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)
 
int getMaxStep () const
 
bool hasBooleanProperty (int ireg, EGS_BPType prop) const
 
void setBooleanProperty (EGS_BPType prop)
 
void addBooleanProperty (int bit)
 
void setBooleanProperty (EGS_BPType prop, int start, int end, int step=1)
 
void addBooleanProperty (int bit, int start, int end, int step=1)
 
const string & getType () const
 
EGS_Float getRelativeRho (int ireg) const
 
void setRelativeRho (int start, int end, EGS_Float rho)
 
void setRelativeRho (EGS_Input *)
 
EGS_Float getBScaling (int ireg) const
 
void setBScaling (int start, int end, EGS_Float bf)
 
void setBScaling (EGS_Input *)
 
virtual void getLabelRegions (const string &str, vector< int > &regs)
 
- 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 getVolume (int ireg)
 Calculates the volume of region ireg. 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?
 
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.
 
virtual void printInfo () const
 Print information about this geometry. More...
 
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 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

void setMedia (EGS_Input *inp, int, const int *)
 Don't define media in the transformed geometry definition. More...
 

Protected Attributes

EGS_BaseGeometryg
 The geometry being transformed.
 
EGS_AffineTransform T
 The affine transformation.
 
string type
 The geometry type.
 
- 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.
 

Additional Inherited Members

- 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 ()
 
- Static Protected Attributes inherited from EGS_BaseGeometry
static int error_flag = 0
 Set to non-zero status if a geometry problem is encountered.
 

Detailed Description

A transformed geometry.

A transformed geometry is a geometry that has been transformed to a different location and/or orientation by the application of an affine transformation $T(R,\vec{t})$, where $R$ is a rotation matrix (a 3x3 matrix with a determinant of unity) and $\vec{t}$ is a translation vector (so that $\vec{x}' = R \vec{x} + \vec{t}$). A transformed geometry is useful for the following two broad classes of situations:

The implementation of the geometry methods for this geometry is very simple: one applies the inverse affine transformation to the particle position and the inverse rotation to the particle direction (if needed) and then uses the corresponding method of the geometry being transformed. A transformed geometry is defined using the following keys:

library = egs_gtransformed
my geometry = name of a previously defined geometry
input defining the transformation

The input defining the affine transformation is described in EGS_AffineTransform::getTransformation().

Transformed geometries are used in the car.geom, chambers_in_box.geom, seeds_in_xyz.geom and seeds_in_xyz1.geom example geometry files.

A simple example:

:start geometry definition:
    :start geometry:
        name        = my_box
        library     = egs_box
        box size    = 1 2 3
        :start media input:
            media = water
        :stop media input:
    :stop geometry:

    :start geometry:
        name        = my_transform
        library     = egs_gtransformed
        my geometry = my_box
        :start transformation:
            translation = 0 0.5 0
            rotation    = 0.5 0 -1
            ## rotation is first!
        :stop transformation:
    :stop geometry:

    simulation geometry = my_transform

:stop geometry definition:
egs_gtransformed.png
A simple example

Definition at line 131 of file egs_gtransformed.h.

Member Function Documentation

void EGS_TransformedGeometry::setMedia ( EGS_Input inp,
int  ,
const int *   
)
protectedvirtual

Don't define media in the transformed geometry definition.

This function is re-implemented to warn the user to not define media in the definition of a transformed geometry. Instead, media should be defined when specifying the geometry to be transformed.

Reimplemented from EGS_BaseGeometry.

Definition at line 44 of file egs_gtransformed.cpp.

References egsWarning.


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