47 const string EGS_PLANES_LOCAL xproj_type(
"EGS_Xplanes");
48 const string EGS_PLANES_LOCAL yproj_type(
"EGS_Yplanes");
49 const string EGS_PLANES_LOCAL zproj_type(
"EGS_Zplanes");
50 const string EGS_PLANES_LOCAL proj_type(
"EGS_Planes");
52 string EGS_PlaneCollection::type =
"EGS_PlaneCollection";
54 EGS_PlaneCollection::EGS_PlaneCollection(
int Np,
const EGS_Float *pos,
56 if (Np < 2)
egsFatal(
"EGS_PlaneCollection::EGS_PlaneCollection: "
57 " you nead at least 2 planes\n");
61 for (
int j=0; j<np; j++) {
68 EGS_PlaneCollection::~EGS_PlaneCollection() {
70 for (
int j=0; j<np; j++)
if (!planes[j]->
deref()) {
76 void EGS_PlaneCollection::printInfo()
const {
80 for (j=0; j<np; j++) {
84 for (j=0; j<np; j++) {
88 egsInformation(
"\n=====================================================\n");
95 int err = input->
getInput(
"type",type);
97 egsWarning(
"createGeometry(planes): missing type key\n");
101 vector<EGS_Float> thick;
103 vector<EGS_Float> pos;
104 int err_first = input->
getInput(
"first plane",first);
105 int err_thick = input->
getInput(
"slab thickness",thick);
106 int err_nthick = input->
getInput(
"number of slabs",nthick);
107 if (!err_first && !err_thick && !err_nthick) {
108 if (thick.size() != nthick.size() || !thick.size()) {
109 egsWarning(
"createGeometry(planes): number of 'slab thickness' and"
110 "\n 'number of slabs' inputs must be the same and not zero\n");
111 egsWarning(
" got %d and %d inputs --> input ignored\n",
112 thick.size(),nthick.size());
115 pos.push_back(first);
117 for (
int i=0; i<thick.size(); i++) {
118 for (
int l=0; l<nthick[i]; ++l) {
119 pos.push_back(pos[j++]+thick[i]);
125 err = input->
getInput(
"positions",pos);
127 egsWarning(
"createGeometry(planes): missing/wrong 'positions' "
128 "input and missing/wrong multiple plane input\n");
133 if (type ==
"EGS_Xplanes") g =
new EGS_PlanesX(pos,
"",
135 else if (type ==
"EGS_Yplanes") g =
new EGS_PlanesY(pos,
"",
137 else if (type ==
"EGS_Zplanes") g =
new EGS_PlanesZ(pos,
"",
139 else if (type ==
"EGS_Planes") {
142 if (err || a.size() != 3) {
143 egsWarning(
"createGeometry(planes): missing/wrong normal input\n");
149 else if (type ==
"EGS_PlaneCollection") {
152 if (err || a.size() < 6) {
153 egsWarning(
"createGeometry(planes): missing/wrong normal input\n");
157 if (np != pos.size()) {
158 egsWarning(
"createGeometry(planes): number of plane normals (%d)\n"
159 " is not the same as number of plane positions (%d) for a"
160 " plane collection\n",np,pos.size());
163 EGS_Float *p =
new EGS_Float [np];
165 for (
int j=0; j<np; j++) {
167 normal[j] =
EGS_Vector(a[3*j],a[3*j+1],a[3*j+2]);
172 egsWarning(
"createGeometry(planes): unknown type %s\n",type.c_str());
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
int deref()
Decrease the reference count to this geometry.
void setMedia(EGS_Input *inp)
Set the media in the geometry from the input pointed to by inp.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
int setLabels(EGS_Input *input)
Set the labels from an input block.
virtual void printInfo() const
Print information about this geometry.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
A collection of non-parallel planes.
A set of parallel planes.
A projector into any plane.
A class representing 3D vectors.
A projector into the x-plane.
A projector into the y-plane.
A projector into the z-plane.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Sets of parallel planes and a plane collection.
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.