40 #ifndef EGS_STACK_GEOMETRY_
41 #define EGS_STACK_GEOMETRY_
45 #ifdef BUILD_STACKG_DLL
46 #define EGS_STACKG_EXPORT __declspec(dllexport)
48 #define EGS_STACKG_EXPORT __declspec(dllimport)
50 #define EGS_STACKG_LOCAL
54 #ifdef HAVE_VISIBILITY
55 #define EGS_STACKG_EXPORT __attribute__ ((visibility ("default")))
56 #define EGS_STACKG_LOCAL __attribute__ ((visibility ("hidden")))
58 #define EGS_STACKG_EXPORT
59 #define EGS_STACKG_LOCAL
180 EGS_StackGeometry(
const vector<EGS_BaseGeometry *> &geoms,
const string &Name =
"");
184 bool isRealRegion(
int ireg)
const {
185 if (ireg < 0 || ireg >=
nreg) {
189 int jl = ireg - jg*nmax;
194 for (
int j=0; j<ng; j++)
if (g[j]->isInside(x)) {
201 for (
int j=0; j<ng; j++) {
214 int medium(
int ireg)
const {
216 return g[j]->
medium(ireg-j*nmax);
220 EGS_Float &t,
int *newmed=0,
EGS_Vector *normal=0) {
224 int jl = ireg - jg*nmax;
227 int inew = g[jg]->
howfar(jl,x,u,t,newmed,normal);
232 return jg*nmax + inew;
240 inew = g[jg-1]->
howfar(-1,x,u,t,newmed,normal);
242 return (jg-1)*nmax + inew;
247 inew = g[jg+1]->
howfar(-1,x,u,t,newmed,normal);
249 return (jg+1)*nmax + inew;
257 int i1 = g[0]->
howfar(-1,x,u,t,newmed,normal);
258 int i2 = g[ng-1]->
howfar(-1,x,u,t,newmed,normal);
260 return (ng-1)*nmax + i2;
268 EGS_Float hownear(
int ireg,
const EGS_Vector &x) {
271 return g[jg]->
hownear(ireg-jg*nmax,x);
273 EGS_Float t1 = g[0]->
hownear(-1,x);
274 EGS_Float t2 = g[ng-1]->
hownear(-1,x);
281 bool hasBooleanProperty(
int ireg, EGS_BPType prop)
const {
282 if (ireg >= 0 && ireg <
nreg) {
288 void setBooleanProperty(EGS_BPType) {
289 setPropertError(
"setBooleanProperty()");
291 void addBooleanProperty(
int) {
292 setPropertError(
"addBooleanProperty()");
294 void setBooleanProperty(EGS_BPType,
int,
int,
int step=1) {
295 setPropertError(
"setBooleanProperty()");
297 void addBooleanProperty(
int,
int,
int,
int step=1) {
298 setPropertError(
"addBooleanProperty()");
301 const string &getType()
const {
305 void printInfo()
const;
307 EGS_Float getRelativeRho(
int ireg)
const {
308 if (ireg < 0 || ireg >=
nreg) {
314 void setRelativeRho(
int start,
int end, EGS_Float rho);
317 EGS_Float getBScaling(
int ireg)
const {
318 if (ireg < 0 || ireg >=
nreg) {
324 void setBScaling(
int start,
int end, EGS_Float bf);
327 virtual void getLabelRegions(
const string &str, vector<int> ®s);
336 void setMedia(
EGS_Input *,
int,
const int *);
338 vector<label> stack_labels;
342 void setPropertError(
const char *funcname) {
343 egsFatal(
"EGS_StackGeometry::%s: don't use this method\n Define "
344 "properties in the constituent geometries instead\n");
virtual bool hasBooleanProperty(int ireg, EGS_BPType prop) const
Is the boolean property prop set for region ireg ?
virtual int medium(int ireg) const
Returns the medium index in region ireg.
A class representing 3D vectors.
Global egspp functions header file.
virtual int isWhere(const EGS_Vector &x)=0
In which region is poisition x?
virtual int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)=0
Calculate the distance to a boundary from x along the direction u.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual EGS_Float getBScaling(int ireg) const
Get the B field scaling factor in region ireg.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
virtual EGS_Float hownear(int ireg, const EGS_Vector &x)=0
Calculate the distance to a boundary for position x in any direction.
EGS_StackGeometry(const vector< EGS_BaseGeometry * > &geoms, const string &Name="")
Construct a geometry stack from the vector of geometries geom.
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 bool isRealRegion(int ireg) const
Returnes true if ireg is a real region, false otherwise.
EGS_BaseGeometry class header file.
int nreg
Number of local regions in this geometry.