45 const string EGS_PLANES_LOCAL xproj_type(
"EGS_Xplanes");
46 const string EGS_PLANES_LOCAL yproj_type(
"EGS_Yplanes");
47 const string EGS_PLANES_LOCAL zproj_type(
"EGS_Zplanes");
48 const string EGS_PLANES_LOCAL proj_type(
"EGS_Planes");
50 string EGS_PlaneCollection::type =
"EGS_PlaneCollection";
52 EGS_PlaneCollection::EGS_PlaneCollection(
int Np,
const EGS_Float *pos,
54 if (Np < 2)
egsFatal(
"EGS_PlaneCollection::EGS_PlaneCollection: "
55 " you nead at least 2 planes\n");
59 for (
int j=0; j<np; j++) {
66 EGS_PlaneCollection::~EGS_PlaneCollection() {
68 for (
int j=0; j<np; j++)
if (!planes[j]->
deref()) {
74 void EGS_PlaneCollection::printInfo()
const {
78 for (j=0; j<np; j++) {
82 for (j=0; j<np; j++) {
86 egsInformation(
"\n=====================================================\n");
93 int err = input->
getInput(
"type",type);
95 egsWarning(
"createGeometry(planes): missing type key\n");
99 vector<EGS_Float> thick;
101 vector<EGS_Float> pos;
102 int err_first = input->
getInput(
"first plane",first);
103 int err_thick = input->
getInput(
"slab thickness",thick);
104 int err_nthick = input->
getInput(
"number of slabs",nthick);
105 if (!err_first && !err_thick && !err_nthick) {
106 if (thick.size() != nthick.size() || !thick.size()) {
107 egsWarning(
"createGeometry(planes): number of 'slab thickness' and"
108 "\n 'number of slabs' inputs must be the same and not zero\n");
109 egsWarning(
" got %d and %d inputs --> input ignored\n",
110 thick.size(),nthick.size());
113 pos.push_back(first);
115 for (
int i=0; i<thick.size(); i++) {
116 for (
int l=0; l<nthick[i]; ++l) {
117 pos.push_back(pos[j++]+thick[i]);
123 err = input->
getInput(
"positions",pos);
125 egsWarning(
"createGeometry(planes): missing/wrong 'positions' "
126 "input and missing/wrong multiple plane input\n");
131 if (type ==
"EGS_Xplanes") g =
new EGS_PlanesX(pos,
"",
133 else if (type ==
"EGS_Yplanes") g =
new EGS_PlanesY(pos,
"",
135 else if (type ==
"EGS_Zplanes") g =
new EGS_PlanesZ(pos,
"",
137 else if (type ==
"EGS_Planes") {
140 if (err || a.size() != 3) {
141 egsWarning(
"createGeometry(planes): missing/wrong normal input\n");
147 else if (type ==
"EGS_PlaneCollection") {
150 if (err || a.size() < 6) {
151 egsWarning(
"createGeometry(planes): missing/wrong normal input\n");
155 if (np != pos.size()) {
156 egsWarning(
"createGeometry(planes): number of plane normals (%d)\n"
157 " is not the same as number of plane positions (%d) for a"
158 " plane collection\n",np,pos.size());
161 EGS_Float *p =
new EGS_Float [np];
163 for (
int j=0; j<np; j++) {
165 normal[j] =
EGS_Vector(a[3*j],a[3*j+1],a[3*j+2]);
170 egsWarning(
"createGeometry(planes): unknown type %s\n",type.c_str());
int deref()
Decrease the reference count to this geometry.
virtual void printInfo() const
Print information about this geometry.
Sets of parallel planes and a plane collection.
A class representing 3D vectors.
int setLabels(EGS_Input *input)
Set the labels from an input block.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
void setMedia(EGS_Input *inp)
Set the media in the geometry from the input pointed to by inp.
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
A set of parallel planes.
A projector into any plane.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
A collection of non-parallel planes.
A projector into the z-plane.
A projector into the y-plane.
A projector into the x-plane.
int nreg
Number of local regions in this geometry.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.