42 #ifndef EGS_BASE_GEOMETRY_
43 #define EGS_BASE_GEOMETRY_
59 typedef EGS_I64 EGS_BPType;
60 #elif defined BPROPERTY32
61 typedef unsigned int EGS_BPType;
62 #elif defined BPROPERTY16
63 typedef unsigned short EGS_BPType;
65 typedef unsigned char EGS_BPType;
141 virtual bool isInside(
const EGS_Vector &x) = 0;
160 static int findRegion(EGS_Float xp,
int np,
const EGS_Float *p) {
162 while (mu - ml > 1) {
205 EGS_Float &t,
int *newmed=0,
EGS_Vector *normal=0) = 0;
219 virtual EGS_Float howfarToOutside(
int ireg,
const EGS_Vector &x,
232 virtual EGS_Float hownear(
int ireg,
const EGS_Vector &x) = 0;
279 return (ireg >= 0 && ireg < nreg);
289 return region_media ? region_media[ireg] : med;
313 virtual int computeIntersections(
int ireg,
int n,
const EGS_Vector &x,
325 void setMedium(
const string &Name);
334 void setMedium(
int start,
int end,
const string &Name,
int delta=1);
351 void setMedium(
int istart,
int iend,
int imed,
int delta=1);
379 static const char *getMediumName(
int ind);
389 static int addMedium(
const string &medname);
396 static int getMediumIndex(
const string &medname);
402 return has_rho_scaling;
409 return rhor && ireg >= 0 && ireg < nreg ? rhor[ireg] : 1;
417 virtual void setRelativeRho(
int start,
int end, EGS_Float rho);
428 virtual void setRelativeRho(
EGS_Input *);
430 EGS_Float getMediumRho(
int ind)
const;
437 return (has_B_scaling || has_Ref_rho);
443 if (has_Ref_rho && has_B_scaling) {
444 if (bfactor && ireg >= 0 && ireg < nreg) {
445 return getMediumRho(medium(ireg))/rhoRef*bfactor[ireg];
451 else if (has_Ref_rho && !has_B_scaling) {
452 if (ireg >= 0 && ireg < nreg) {
453 return getMediumRho(medium(ireg))/rhoRef;
459 else if (!has_Ref_rho && has_B_scaling) {
460 if (bfactor && ireg >= 0 && ireg < nreg) {
461 return bfactor[ireg];
478 virtual void setBScaling(
int start,
int end, EGS_Float bf);
506 virtual const string &getType()
const = 0;
553 static void clearGeometries();
574 static int getNGeometries();
582 static string getUniqueName();
602 void setBoundaryTolerance(
EGS_Input *inp);
607 boundaryTolerance = tol;
608 halfBoundaryTolerance = tol/2.;
615 return (prop & bproperty);
617 return ireg >= 0 && ireg < nreg ? prop & bp_array[ireg] :
false;
625 virtual void setBooleanProperty(EGS_BPType prop);
634 virtual void addBooleanProperty(
int bit);
642 virtual void setBooleanProperty(EGS_BPType prop,
int start,
int end,
651 virtual void addBooleanProperty(
int bit,
int start,
int end,
int step=1);
663 virtual void printInfo()
const;
670 static void describeGeometries();
697 static void setActiveGeometryList(
int list);
699 static int getLastError() {
703 static void resetErrorFlag() {
709 return boundaryTolerance;
713 virtual void getNumberRegions(
const string &str, vector<int> ®s);
716 virtual void getLabelRegions(
const string &str, vector<int> ®s);
720 return labels[i].name;
725 return labels.size();
732 int setLabels(
const string &inp);
806 virtual void setMedia(
EGS_Input *inp,
int nmed,
const int *med_ind);
874 static int active_glist;
#define EGS_EXPORT
Export symbols from the egspp library.
virtual bool hasBooleanProperty(int ireg, EGS_BPType prop) const
Is the boolean property prop set for region ireg ?
int regions() const
Returns the number of local regions in this geometry.
int deref()
Decrease the reference count to this geometry.
virtual int getNRegDir(int idir)
virtual int medium(int ireg) const
Returns the medium index in region ireg.
EGS_Float t
distance to next region boundary
void setMedium(int imed)
Set all regions to a medium with index imed.
EGS_Float * bfactor
Array with B field scaling factors.
EGS_Float rhoRef
Reference density for B field scaling.
EGS_Float rhof
relative mass density in that region
EGS_BPType bproperty
A bit mask of boolean properties for the entire geometry.
string name
Name of this geometry.
EGS_BPType * bp_array
An array of boolean properties on a region by region basis.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
virtual int getMaxStep() const
Returns the maximum number of steps through the geometry.
A class representing 3D vectors.
virtual EGS_Float getVolume(int ireg)
Calculates the volume of region ireg.
bool hasRhoScaling() const
Does this geometry object have a mass density scaling feature?
int nref
Number of references to this geometry.
static int findRegion(EGS_Float xp, int np, const EGS_Float *p)
Find the bin to which xp belongs, given np bin edges p.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
vector< label > labels
Labels.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual EGS_Float getBound(int idir, int ind)
Returns region boundaries in direction determined by idir.
EGS_Float getBoundaryTolerance()
Get the value of the boundary tolerance.
bool isConvex() const
Is the geometry convex?
virtual EGS_Float getBScaling(int ireg) const
Get the B field scaling factor in region ireg.
virtual const string & getLabelName(const int i)
Get the name of the i-th explicit label in the geometry.
bool is_convex
Is this geometry convex?
void setBoundaryTolerance(EGS_Float tol)
Set the value of the boundary tolerance from argument.
bool hasBScaling() const
Does this geometry object have a B field scaling feature?
virtual EGS_Float getRelativeRho(int ireg) const
Get the relative mass density in region ireg.
EGS_Float boundaryTolerance
Boundary tolerance for geometries that need it.
virtual int getLabelCount()
Get the number of explicit labels in the geometry.
short * region_media
Array of media indeces.
bool has_rho_scaling
Does this geometry have relative mass density scvaling?
int ref()
Increase the reference count to this geometry.
virtual bool isRealRegion(int ireg) const
Returnes true if ireg is a real region, false otherwise.
static int error_flag
Set to non-zero status if a geometry problem is encountered.
bool debug
Debugging flag.
const string & getName() const
Get the name of this geometry.
EGS_Application * app
The application this object belongs to.
void setDebug(bool deb)
Turn debugging on.
int nreg
Number of local regions in this geometry.
EGS_Float * rhor
Array with relative mass densities.
Base class for advanced EGSnrc C++ applications.
bool has_B_scaling
Does this geometry has B field scaling factor?