176 void EGS_Octree::printInfo()
const {
178 egsInformation(
" bounding box minimum = %g %g %g\n", bbxmin, bbymin, bbzmin);
179 egsInformation(
" bounding box maximum = %g %g %g\n", bbxmax, bbymax, bbzmax);
180 egsInformation(
" bounding box resolution = %d %d %d\n", nx, ny, nz);
184 egsInformation(
" octree average cell size = %.2f\n", nLeafMax/(
float)nLeaf);
186 egsInformation(
" octree cell savings = %.1f%c\n", 100*(1-(
float)nLeaf/nLeafMax),percent);
187 egsInformation(
"=======================================================\n");
190 string EGS_Octree::type(
"EGS_Octree");
192 static char EGS_OCTREE_LOCAL eoctree_message1[] =
"createGeometry(octree): %s\n";
193 static char EGS_OCTREE_LOCAL eoctree_message2[] =
"null input?";
196 static char EGS_OCTREE_LOCAL eoctree_message5[] =
"wrong/missing 'min' or input?";
197 static char EGS_OCTREE_LOCAL eoctree_message6[] =
"expecting 3 float inputs for 'box min' input";
198 static char EGS_OCTREE_LOCAL eoctree_message7[] =
"wrong/missing 'max' or input?";
199 static char EGS_OCTREE_LOCAL eoctree_message8[] =
"expecting 3 float inputs for 'box max' input";
200 static char EGS_OCTREE_LOCAL eoctree_message9[] =
"wrong or missing 'resolution' input?";
201 static char EGS_OCTREE_LOCAL eoctree_message10[] =
"expecting 3 integer inputs for 'resolution' input";
202 static char EGS_OCTREE_LOCAL eoctree_message11[] =
"wrong or missing 'discard child' input?";
203 static char EGS_OCTREE_LOCAL eoctree_message12[] =
"expecting 'yes' or 'no' for 'discard child' input";
204 static char EGS_OCTREE_LOCAL eoctree_message13[] =
"missing or wrong 'child geometry' input";
205 static char EGS_OCTREE_LOCAL eoctree_message14[] =
"undefined child geometry";
206 static char EGS_OCTREE_LOCAL eoctree_message15[] =
"you need to define at least one octree box";
207 static char EGS_OCTREE_LOCAL eoctree_message16[] =
"wrong 'prune tree' input?";
208 static char EGS_OCTREE_LOCAL eoctree_message17[] =
"expecting 'yes' or 'no' for 'prune tree' input?";
209 static char EGS_OCTREE_LOCAL eoctree_key0[] =
"octree box";
210 static char EGS_OCTREE_LOCAL eoctree_key1[] =
"box min";
211 static char EGS_OCTREE_LOCAL eoctree_key2[] =
"box max";
212 static char EGS_OCTREE_LOCAL eoctree_key3[] =
"resolution";
213 static char EGS_OCTREE_LOCAL eoctree_key4[] =
"child geometry";
214 static char EGS_OCTREE_LOCAL eoctree_key5[] =
"discard child";
215 static char EGS_OCTREE_LOCAL eoctree_key6[] =
"prune tree";
217 static bool EGS_OCTREE_LOCAL inputSet =
false;
221 static void setInputs() {
224 setBaseGeometryInputs(
false);
226 geomBlockInput->getSingleInput(
"library")->setValues({
"egs_octree"});
229 geomBlockInput->addSingleInput(
"child geometry",
true,
"The name of child geometry");
230 geomBlockInput->addSingleInput(
"discard child",
true,
"yes or no");
231 geomBlockInput->addSingleInput(
"prune tree",
false,
"yes or no");
233 auto blockPtr = geomBlockInput->addBlockInput(
"octree box");
234 blockPtr->addSingleInput(
"box min",
true,
"(x, y, z)");
235 blockPtr->addSingleInput(
"box max",
true,
"(x, y, z)");
236 blockPtr->addSingleInput(
"resolution",
true,
"A specified resolution (x, y, z)");
239 EGS_OCTREE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
243 return geomBlockInput;
252 egsWarning(eoctree_message1,eoctree_message2);
257 vector<EGS_Octree_bbox> vBox;
262 int err = i->
getInput(eoctree_key1, v);
264 egsWarning(eoctree_message1, eoctree_message5);
268 egsWarning(eoctree_message1, eoctree_message6);
276 egsWarning(eoctree_message1, eoctree_message7);
280 egsWarning(eoctree_message1, eoctree_message8);
287 err = i->
getInput(eoctree_key3, bboxRes);
289 egsWarning(eoctree_message1, eoctree_message9);
292 if (bboxRes.size() != 3) {
293 egsWarning(eoctree_message1, eoctree_message10);
300 if (vBox.size() < 1) {
301 egsWarning(eoctree_message1, eoctree_message15);
306 bool discardChild =
true;
309 int err = input->
getInput(eoctree_key5, discard);
311 egsWarning(eoctree_message1, eoctree_message11);
314 if (discard.find(
"yes")==string::npos && discard.find(
"no")==string::npos) {
315 egsWarning(eoctree_message1, eoctree_message12);
318 if (discard.find(
"no")!=string::npos) {
319 discardChild =
false;
324 bool pruneTree =
true;
327 int err = input->
getInput(eoctree_key6, prune);
329 egsWarning(eoctree_message1, eoctree_message16);
332 if (prune.find(
"yes")==string::npos && prune.find(
"no")==string::npos) {
333 egsWarning(eoctree_message1, eoctree_message17);
336 if (prune.find(
"no")!=string::npos) {
344 int err = input->
getInput(eoctree_key4, gname);
346 egsWarning(eoctree_message1, eoctree_message13);
352 egsWarning(eoctree_message1, eoctree_message14);
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
int nreg
Number of local regions in this geometry.
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.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
A class representing 3D vectors.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
An octree geometry: header.
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 egsWarning
Always use this function for reporting warnings.