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

An dynamic shape. More...

#include <egs_dynamic_shape.h>

Inheritance diagram for EGS_DynamicShape:
EGS_BaseShape EGS_Object

Classes

struct  EGS_ControlPoint
 Structure representing a control point for dynamic motion. More...
 

Public Member Functions

 EGS_DynamicShape (EGS_BaseShape *Shape, EGS_Input *dyninp, const string &Name="", EGS_ObjectFactory *f=0)
 Constructor for EGS_DynamicShape. More...
 
 ~EGS_DynamicShape ()
 Destructor for EGS_DynamicShape.
 
EGS_Vector getPoint (EGS_RandomGenerator *rndm)
 Get a random point from the dynamic shape. More...
 
EGS_Vector getRandomPoint (EGS_RandomGenerator *rndm)
 Returns a random 3D vector. More...
 
void getPointSourceDirection (const EGS_Vector &Xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
 Get the direction of the point source for a given position. More...
 
- Public Member Functions inherited from EGS_BaseShape
 EGS_BaseShape (const string &Name="", EGS_ObjectFactory *f=0)
 Construct a shape named Name.
 
virtual ~EGS_BaseShape ()
 Destructor. Deletes T if it is not null.
 
void setTransformation (EGS_Input *inp)
 Set the transformation attached to this shape. More...
 
void setTransformation (EGS_AffineTransform *t)
 Set the transformation attached to this shape. More...
 
const EGS_AffineTransformgetTransform () const
 Get a pointer to the affine transformation attached to this shape.
 
virtual EGS_Float area () const
 
virtual void updatePosition (EGS_Float time)
 Update the position of the shape if it is in motion.
 
- Public Member Functions inherited from EGS_Object
 EGS_Object (const string &Name="", EGS_ObjectFactory *f=0)
 Create an EGS_Object named Name belonging to the object factory f. More...
 
 EGS_Object (EGS_Input *inp, EGS_ObjectFactory *f=0)
 Create an EGS_Object from the information pointed to by inp that belongs to object factory f. More...
 
const string & getObjectName () const
 Get the object name.
 
void setObjectName (const string &Name)
 Set the object name to Name.
 
const string & getObjectType () const
 Get the object type.
 
virtual EGS_ObjectcreateObject (EGS_Input *inp)
 Create an object from the infromation pointed to by inp. More...
 
void setName (EGS_Input *inp)
 Set the name of the object from the information provided by inp. More...
 
int ref ()
 Increase the reference count to this object.
 
int deref ()
 Decrease the reference count to this object.
 
void setFactory (EGS_ObjectFactory *f)
 Set the factory to which the object belongs. More...
 

Protected Member Functions

void getNextShapePosition (EGS_RandomGenerator *rndm)
 Get the next state of the dynamic shape. More...
 
void containsDynamic (bool &hasdynamic)
 Determine whether the simulation geometry contains a dynamic shape. More...
 
bool supportsDirectionMethod () const
 Check if the shape supports the direction method. More...
 
int getCoord (EGS_Float rand, EGS_ControlPoint &gipt)
 Extract coordinates for the next dynamic shape position. More...
 
void buildDynamicShape (EGS_Input *dyninp)
 Build the dynamic shape using input specifications. More...
 

Protected Attributes

EGS_BaseShapeshape
 Base shape made dynamic.
 
vector< EGS_ControlPointcpts
 Control points.
 
int ncpts
 Number of control points.
 
EGS_Float ptime
 Time index corresponding to particle.
 
- Protected Attributes inherited from EGS_BaseShape
EGS_AffineTransformT
 The affine transformation attached to the shape.
 
- Protected Attributes inherited from EGS_Object
string name
 The object name.
 
string otype
 The object type.
 
int nref
 Number of references to the object.
 
EGS_ObjectFactoryfactory
 The factory this object belongs to.
 

Additional Inherited Members

- Static Public Member Functions inherited from EGS_BaseShape
static EGS_BaseShapecreateShape (EGS_Input *inp)
 Create a shape from the information pointed to by inp. More...
 
static EGS_BaseShapegetShape (const string &Name)
 Get a pointer to the shape named Name. More...
 
- Static Public Member Functions inherited from EGS_Object
static string getUniqueName (const EGS_Object *o=0)
 Create and return a unique object name. More...
 
static void deleteObject (EGS_Object *o)
 Delete an object. More...
 

Detailed Description

An dynamic shape.

A dynamic shape provides the functionality to model motion of shapes during the simulation. This is automatically synchronized with the motion of sources and geometries. To do this, the dynamic shape applies transformations to any other egs++ shape. By sampling a time index, continuous motion is modelled by interpolating between user-defined control points.

A dynamic shape is defined using

:start shape:
    library = egs_dynamic_shape
    :start shape:
        definition of the shape to be 'dynamic'
    :stop shape:
    :start motion: # units of cm and degrees
        control point = timeIndex(1) xtrans(1) ytrans(1) ztrans(1) xrot(1) yrot(1) zrot(1)
        control point = timeIndex(2) xtrans(2) ytrans(2) ztrans(2) xrot(2) yrot(2) zrot(2)
        .
        .
        .
        control point = timeIndex(N) xtrans(N) ytrans(N) ztrans(N) xrot(N) yrot(N) zrot(N)
    :stop motion:
:stop shape:

Control points must be defined such that timeIndex(i+1)>=timeIndex(i), where timeIndex(i) is the value of time index for control point i. The timeIndex(i) are automatically normalized by timeIndex(N), where N is the number of control points.

A translation from the starting position of the shape is applied according to xtrans, ytrans and ztrans. A rotation follows the same rotation technique as in EGS_AffineTransform, using the rotation input parameter for 2 or 3 values. Angles are in degrees and translations in cm.

Continuous, dynamic motion between control points is simulated by choosing a random number, R, on (0,1] and, for timeIndex(i)<R<=timeIndex(i+1), setting the translation or rotation parameter P by interpolation: P=P(i)+[P(i+1)-P(i)]/[timeIndex(i+1)-timeIndex(i)]*[R-timeIndex(i)]

It is generally expected that the user provide timeIndex(1)=0.0. However, the geometry can function with timeIndex(1)>0.0, in the case where a user desires to eliminate particles associated with a range of timeIndex values, but there will be a lot of warning messages.

Definition at line 106 of file egs_dynamic_shape.h.

Constructor & Destructor Documentation

◆ EGS_DynamicShape()

EGS_DynamicShape::EGS_DynamicShape ( EGS_BaseShape Shape,
EGS_Input dyninp,
const string &  Name = "",
EGS_ObjectFactory f = 0 
)

Constructor for EGS_DynamicShape.

Parameters
ShapeBase shape to be made dynamic
dyninpInput containing dynamic shape specifications
NameName of the dynamic shape
fEGS_ObjectFactory pointer

Definition at line 117 of file egs_dynamic_shape.h.

References egsWarning, epsilon, and EGS_Object::ref().

Member Function Documentation

◆ getPoint()

EGS_Vector EGS_DynamicShape::getPoint ( EGS_RandomGenerator rndm)
virtual

Get a random point from the dynamic shape.

Parameters
rndmRandom number generator
Returns
Random point as an EGS_Vector

Reimplemented from EGS_BaseShape.

Definition at line 167 of file egs_dynamic_shape.h.

◆ getRandomPoint()

EGS_Vector EGS_DynamicShape::getRandomPoint ( EGS_RandomGenerator rndm)
virtual

Returns a random 3D vector.

Uses the function getPoint() to pick a random position and then applies the affine transformation attached to the shape before returning it.

Reimplemented from EGS_BaseShape.

Definition at line 178 of file egs_dynamic_shape.h.

◆ getPointSourceDirection()

void EGS_DynamicShape::getPointSourceDirection ( const EGS_Vector Xo,
EGS_RandomGenerator rndm,
EGS_Vector u,
EGS_Float &  wt 
)
virtual

Get the direction of the point source for a given position.

Parameters
XoPosition vector
rndmRandom number generator
uDirection vector
wtWeight

Reimplemented from EGS_BaseShape.

Definition at line 199 of file egs_dynamic_shape.h.

◆ getNextShapePosition()

void EGS_DynamicShape::getNextShapePosition ( EGS_RandomGenerator rndm)
protectedvirtual

◆ containsDynamic()

void EGS_DynamicShape::containsDynamic ( bool &  hasdynamic)
protected

Determine whether the simulation geometry contains a dynamic shape.

Parameters
hasdynamicBoolean indicating if the simulation geometry contains a dynamic shape

Definition at line 227 of file egs_dynamic_shape.h.

◆ supportsDirectionMethod()

bool EGS_DynamicShape::supportsDirectionMethod ( ) const
protectedvirtual

Check if the shape supports the direction method.

Returns
Boolean indicating if the shape supports the direction method

Reimplemented from EGS_BaseShape.

Definition at line 235 of file egs_dynamic_shape.h.

References EGS_BaseShape::supportsDirectionMethod().

◆ getCoord()

int EGS_DynamicShape::getCoord ( EGS_Float  rand,
EGS_ControlPoint gipt 
)
protected

Extract coordinates for the next dynamic shape position.

Parameters
randRandom number for time sampling
giptEGS_ControlPoint structure to store the coordinates
Returns
0 if successful, otherwise 1

Definition at line 211 of file egs_dynamic_shape.cpp.

References cpts, egsWarning, epsilon, ncpts, and EGS_DynamicShape::EGS_ControlPoint::trnsl.

Referenced by getNextShapePosition().

◆ buildDynamicShape()

void EGS_DynamicShape::buildDynamicShape ( EGS_Input dyninp)
protected

Build the dynamic shape using input specifications.

Parameters
dyninpInput containing dynamic shape specifications

Definition at line 86 of file egs_dynamic_shape.cpp.

References cpts, egsFatal, egsWarning, EGS_Input::getInput(), ncpts, EGS_DynamicShape::EGS_ControlPoint::rot, EGS_Input::takeInputItem(), EGS_DynamicShape::EGS_ControlPoint::time, EGS_DynamicShape::EGS_ControlPoint::trnsl, and EGS_BaseShape::updatePosition().


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