50 egsWarning(
"EGS_EnvelopeGeometry::setMedia: don't use this method. Use the\n"
51 " setMedia() methods of the geometry objects that make up this geometry\n");
54 void EGS_EnvelopeGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
58 void EGS_EnvelopeGeometry::setRelativeRho(
EGS_Input *) {
59 egsWarning(
"EGS_EnvelopeGeometry::setRelativeRho(): don't use this method."
60 " Use the\n setRelativeRho methods of the geometry objects that make up"
64 void EGS_EnvelopeGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
68 void EGS_EnvelopeGeometry::setBScaling(
EGS_Input *) {
69 egsWarning(
"EGS_EnvelopeGeometry::setBScaling(): don't use this method."
70 " Use the\n setBScaling methods of the geometry objects that make up"
75 egsWarning(
"EGS_FastEnvelope::setMedia: don't use this method. Use the\n"
76 " setMedia() methods of the geometry objects that make up this geometry\n");
79 void EGS_FastEnvelope::setRelativeRho(
int start,
int end, EGS_Float rho) {
83 void EGS_FastEnvelope::setRelativeRho(
EGS_Input *) {
84 egsWarning(
"EGS_FastEnvelope::setRelativeRho(): don't use this method."
85 " Use the\n setRelativeRho methods of the geometry objects that make up"
89 void EGS_FastEnvelope::setBScaling(
int start,
int end, EGS_Float bf) {
93 void EGS_FastEnvelope::setBScaling(
EGS_Input *) {
94 egsWarning(
"EGS_FastEnvelope::setBScaling(): don't use this method."
95 " Use the\n setBScaling methods of the geometry objects that make up"
112 const vector<EGS_BaseGeometry *> &geoms,
const string &Name,
116 egsFatal(
"EGS_EnvelopeGeometry: base geometry must not be null\n");
120 new_indexing =
false;
124 int nreg_inscribed = 0;
127 for (
int j=0; j<n_in; j++) {
128 geometries[j] = geoms[j];
129 geometries[j]->
ref();
130 int nj = geometries[j]->regions();
134 nreg_inscribed += nj;
137 nreg = nbase + n_in*nmax;
141 if (!has_rho_scaling) {
142 for (
int j=0; j<n_in; j++) {
143 if (geometries[j]->hasRhoScaling()) {
144 has_rho_scaling =
true;
150 if (!has_B_scaling) {
151 for (
int j=0; j<n_in; j++) {
152 if (geometries[j]->hasBScaling()) {
153 has_B_scaling =
true;
164 local_start =
new int [n_in];
165 reg_to_inscr =
new int [nreg_inscribed];
167 for (
int j=0; j<n_in; j++) {
168 int n = geometries[j]->regions();
169 local_start[j] = nbase + ir;
170 for (
int i=0; i<n; i++) {
171 reg_to_inscr[ir++] = j;
179 const vector<EnvelopeAux *> &fgeoms,
const string &Name,
183 egsFatal(
"EGS_FastEnvelope: base geometry must not be null\n");
187 n_in = fgeoms.size();
189 new_indexing =
false;
191 egsFatal(
"EGS_FastEnvelope: no inscribed geometries!\n");
195 int *iaux =
new int [nbase];
197 for (j=0; j<nbase; j++) {
201 int nreg_inscribed = 0;
202 for (j=0; j<fgeoms.size(); j++) {
203 geometries[j] = fgeoms[j]->g;
204 geometries[j]->ref();
205 int nj = geometries[j]->regions();
206 nreg_inscribed += nj;
210 for (
int i=0; i<fgeoms[j]->nreg; i++) {
211 int k = fgeoms[j]->regs[i];
212 if (k >= 0 && k < nbase) {
218 n_start =
new int [nbase+1];
219 glist =
new int [nlist];
221 for (j=0; j<nbase; j++) {
224 for (
int l=0; l<fgeoms.size(); l++) {
225 for (
int i=0; i<fgeoms[l]->nreg; i++) {
226 int k = fgeoms[l]->regs[i];
234 n_start[nbase] = ilist;
235 nreg = nbase + n_in*nmax;
238 if (!has_rho_scaling) {
239 for (
int j=0; j<n_in; j++) {
240 if (geometries[j]->hasRhoScaling()) {
241 has_rho_scaling =
true;
248 if (!has_B_scaling) {
249 for (
int j=0; j<n_in; j++) {
250 if (geometries[j]->hasBScaling()) {
251 has_B_scaling =
true;
260 local_start =
new int [n_in];
261 reg_to_inscr =
new int [nreg_inscribed];
263 for (
int j=0; j<n_in; j++) {
264 int n = geometries[j]->regions();
265 local_start[j] = nbase + ir;
266 for (
int i=0; i<n; i++) {
267 reg_to_inscr[ir++] = j;
274 EGS_EnvelopeGeometry::~EGS_EnvelopeGeometry() {
278 for (
int j=0; j<
n_in; j++) {
294 EGS_FastEnvelope::~EGS_FastEnvelope() {
298 for (
int j=0; j<
n_in; j++) {
316 void EGS_EnvelopeGeometry::printInfo()
const {
324 "=======================================================\n");
327 void EGS_FastEnvelope::printInfo()
const {
335 "=======================================================\n");
339 static char EGS_ENVELOPEG_LOCAL eeg_message1[] =
340 "createGeometry(envelope geometry): %s\n";
341 static char EGS_ENVELOPEG_LOCAL eeg_message2[] =
343 static char EGS_ENVELOPEG_LOCAL eeg_message3[] =
344 "no 'base geometry' input?";
345 static char EGS_ENVELOPEG_LOCAL eeg_message4[] =
346 "incorrect base geometry definition";
347 static char EGS_ENVELOPEG_LOCAL eeg_message5[] =
348 "missing/incorrect 'base geometry' input";
349 static char EGS_ENVELOPEG_LOCAL eeg_message6[] =
350 "createGeometry(envelope geometry): no geometry with name %s defined\n";
351 static char EGS_ENVELOPEG_LOCAL eeg_message7[] =
352 "no inscirebed geometries defined?. I hope you know what you are doing";
353 static char EGS_ENVELOPEG_LOCAL eeg_message8[] =
354 "an error occured while constructing inscibed geometries";
356 static char EGS_ENVELOPEG_LOCAL eeg_keyword1[] =
"base geometry";
357 static char EGS_ENVELOPEG_LOCAL eeg_keyword2[] =
"geometry";
358 static char EGS_ENVELOPEG_LOCAL eeg_keyword3[] =
"inscribed geometries";
371 input->
getInput(
"new indexing style",indexing);
393 int err = i->
getInput(eeg_keyword1,bgname);
405 vector<EnvelopeAux *> fgeoms;
407 while ((ix = input->
takeInputItem(
"inscribe in regions")) != 0) {
408 vector<string> values;
409 ix->
getInput(
"inscribe in regions",values);
410 if (values.size() < 2)
egsWarning(
"createGeometry(envelope geometry):"
411 " %d inputs for 'inscribe in regions'? 2 or more are needed\n",values.size());
420 aux->nreg = values.size()-1;
421 aux->regs =
new int [aux->nreg];
422 for (
int j=0; j<aux->nreg; j++) {
423 aux->regs[j] = atoi(values[j+1].c_str());
425 fgeoms.push_back(aux);
430 if (fgeoms.size() > 0) {
434 for (
int j=0; j<fgeoms.size(); j++) {
444 vector<EGS_BaseGeometry *> geoms;
465 vector<string> igeoms;
466 int err = i->
getInput(eeg_keyword3,igeoms);
467 if (err || !igeoms.size()) {
471 for (
unsigned int j=0; j<igeoms.size(); j++) {
498 void EGS_EnvelopeGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
506 for (
int i=0; i<
n_in; i++) {
519 shift = nbase+i*
nmax;
521 for (
int j=0; j<gregs.size(); j++) {
526 regs.insert(regs.end(), gregs.begin(), gregs.end());
535 void EGS_FastEnvelope::getLabelRegions(
const string &str, vector<int> ®s) {
543 for (
int i=0; i<
n_in; i++) {
558 for (
int j=0; j<gregs.size(); j++) {
563 regs.insert(regs.end(), gregs.begin(), gregs.end());
EGS_BaseGeometry * g
The envelope geometry.
virtual const string & getType() const =0
Get the geometry type.
EGS_BaseGeometry ** geometries
The inscribed geometries.
int * local_start
First region for each inscribed geometry.
void setMedia(EGS_Input *, int, const int *)
Don't set media for an envelope geometry.
int regions() const
Returns the number of local regions in this geometry.
int deref()
Decrease the reference count to this geometry.
virtual void printInfo() const
Print information about this geometry.
An envelope geometry class.
static string type
Geometry type.
int setLabels(EGS_Input *input)
Set the labels from an input block.
bool hasRhoScaling() const
Does this geometry object have a mass density scaling feature?
Global egspp functions header file.
EGS_BaseGeometry * g
The envelope geometry.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
int n_in
Number of inscribed geometries.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
void setMedia(EGS_Input *, int, const int *)
Don't set media for an envelope geometry.
bool isConvex() const
Is the geometry convex?
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
virtual void getLabelRegions(const string &str, vector< int > ®s)
Get the list of all regions labeled with str.
int * reg_to_inscr
Region to inscribed geometry conversion.
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
bool new_indexing
If true, use new indexing style.
An envelope geometry: header.
bool hasBScaling() const
Does this geometry object have a B field scaling feature?
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
int ref()
Increase the reference count to this geometry.
static EGS_BaseGeometry * createSingleGeometry(EGS_Input *inp)
Create a single geometry from the input inp.
const string & getName() const
Get the name of this geometry.
An envelope geometry class.
bool new_indexing
If true, use new indexing style.
int n_in
Number of inscribed geometries.
int * local_start
First region for each inscribed geometry.
int * reg_to_inscr
Region to inscribed geometry conversion.
EGS_BaseGeometry ** geometries
The inscribed geometries.
static string type
Geometry type.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.