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

Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape. More...

#include <egs_shapes.h>

Inheritance diagram for EGS_BaseShape:
EGS_Object EGS_BoxShape EGS_ConicalShellStackShape EGS_CylinderShape EGS_ExtendedShape EGS_GaussianShape EGS_LineShape EGS_PointShape EGS_ShapeCollection EGS_SphereShape EGS_SphericalShellShape EGS_SurfaceShape EGS_VoxelizedShape

Public Member Functions

 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.
 
virtual EGS_Vector getRandomPoint (EGS_RandomGenerator *rndm)
 Returns a random 3D vector. More...
 
virtual EGS_Vector getPoint (EGS_RandomGenerator *rndm)
 Sample and return a random 3D vector. More...
 
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 bool supportsDirectionMethod () const
 
virtual void getPointSourceDirection (const EGS_Vector &xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
 
virtual EGS_Float area () const
 
- 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...
 

Static Public Member Functions

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...
 

Protected Attributes

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.
 

Detailed Description

Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.

This class specifies the interface to shape objects. For more details on shapes, see the Shapes module documentation

Definition at line 112 of file egs_shapes.h.

Member Function Documentation

virtual EGS_Vector EGS_BaseShape::getRandomPoint ( EGS_RandomGenerator rndm)
virtual

Returns a random 3D vector.

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

Definition at line 134 of file egs_shapes.h.

Referenced by volcor::VCOptions::getRandomPoint().

virtual EGS_Vector EGS_BaseShape::getPoint ( EGS_RandomGenerator rndm)
virtual

Sample and return a random 3D vector.

This virtual function must be reimplemented by derived classes to sample and return random positions from a certain probability distribution using the random number generator rndm.

Reimplemented in EGS_CylinderShape, EGS_SphereShape, EGS_BoxShape, EGS_PointShape, EGS_ConicalShellStackShape, and EGS_SphericalShellShape.

Definition at line 149 of file egs_shapes.h.

References egsFatal.

Referenced by EGS_SurfaceShape::getPointSourceDirection().

void EGS_BaseShape::setTransformation ( EGS_Input inp)

Set the transformation attached to this shape.

If the input pointed to by inp contains a valid transformation definition, this function sets the affine transformation attached to the shape according to this definition.

See Also
EGS_AffineTransform

Definition at line 68 of file egs_shapes.cpp.

References EGS_AffineTransform::getTransformation().

void EGS_BaseShape::setTransformation ( EGS_AffineTransform t)

Set the transformation attached to this shape.

The shape makes a copy of the transformation pointed to by t.

Definition at line 169 of file egs_shapes.h.

EGS_BaseShape * EGS_BaseShape::createShape ( EGS_Input inp)
static

Create a shape from the information pointed to by inp.

This static function creates a single shape from the input pointed to by inp. It returns a pointer to the newly created shape or null, if the information pointed to by inp was not sufficient to create a shape.

Definition at line 51 of file egs_shapes.cpp.

Referenced by EGS_CollimatedSource::EGS_CollimatedSource(), EGS_FanoSource::EGS_FanoSource(), EGS_IsotropicSource::EGS_IsotropicSource(), EGS_ParallelBeam::EGS_ParallelBeam(), EGS_GeometryTester::getGeometryTester(), and volcor::VCOptions::setBoundsShape().

EGS_BaseShape * EGS_BaseShape::getShape ( const string &  Name)
static

Get a pointer to the shape named Name.

A static list of shapes created so far is maintained internally. If a shape with name Name exists in this list, a pointer to this shape is returned. Otherwise the return value is null.

Definition at line 63 of file egs_shapes.cpp.

Referenced by EGS_CollimatedSource::EGS_CollimatedSource(), EGS_FanoSource::EGS_FanoSource(), EGS_IsotropicSource::EGS_IsotropicSource(), and EGS_ParallelBeam::EGS_ParallelBeam().

virtual bool EGS_BaseShape::supportsDirectionMethod ( ) const
virtual

Does this shape implement the getPointSourceDirection() method?

This virtual function should be re-implemented in derived classes if the shape supports the getPointSourceDirection() method.

Reimplemented in EGS_CylinderShape, EGS_SphereShape, EGS_BoxShape, EGS_SurfaceShape, and EGS_SphericalShellShape.

Definition at line 204 of file egs_shapes.h.

Referenced by EGS_CollimatedSource::EGS_CollimatedSource().

virtual void EGS_BaseShape::getPointSourceDirection ( const EGS_Vector xo,
EGS_RandomGenerator rndm,
EGS_Vector u,
EGS_Float &  wt 
)
virtual

Get a random direction given a source position xo.

This method is used to sample random directions by picking a point $\vec{x}$ randomly on a certain surface and then setting the direction to $(\vec{x}-\vec{x}_0)/|\vec{x}-\vec{x}_0|$. This is useful for simulating a point source collimated to a certain solid angle as defined by the surface from which the points $\vec{x}$ are picked. The method should be re-implemented by shapes being able to pick surface points and to properly set the statistical weight wt so that a proper collimated point source probability distribution results.

Reimplemented in EGS_CylinderShape, EGS_SphereShape, EGS_BoxShape, EGS_SurfaceShape, and EGS_SphericalShellShape.

Definition at line 220 of file egs_shapes.h.

References egsFatal.

virtual EGS_Float EGS_BaseShape::area ( ) const
virtual

Get the area of this shape.

This method should be re-implemented by surface shapes to return their area. It is used by some of the particle sources to define fluence as the number of particles per unit area.

Reimplemented in EGS_CylinderShape, EGS_SphereShape, EGS_BoxShape, EGS_SurfaceShape, and EGS_SphericalShellShape.

Definition at line 232 of file egs_shapes.h.

Referenced by EGS_BoxShape::getPointSourceDirection(), and EGS_CylinderShape::getPointSourceDirection().


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