51 egsWarning(
"EGS_EnvelopeGeometry::setMedia: don't use this method. Use the\n"
52 " setMedia() methods of the geometry objects that make up this geometry\n");
55 void EGS_EnvelopeGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
59 void EGS_EnvelopeGeometry::setRelativeRho(
EGS_Input *) {
60 egsWarning(
"EGS_EnvelopeGeometry::setRelativeRho(): don't use this method."
61 " Use the\n setRelativeRho methods of the geometry objects that make up"
65 void EGS_EnvelopeGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
69 void EGS_EnvelopeGeometry::setBScaling(
EGS_Input *) {
70 egsWarning(
"EGS_EnvelopeGeometry::setBScaling(): don't use this method."
71 " Use the\n setBScaling methods of the geometry objects that make up"
76 egsWarning(
"EGS_FastEnvelope::setMedia: don't use this method. Use the\n"
77 " setMedia() methods of the geometry objects that make up this geometry\n");
80 void EGS_FastEnvelope::setRelativeRho(
int start,
int end, EGS_Float rho) {
84 void EGS_FastEnvelope::setRelativeRho(
EGS_Input *) {
85 egsWarning(
"EGS_FastEnvelope::setRelativeRho(): don't use this method."
86 " Use the\n setRelativeRho methods of the geometry objects that make up"
90 void EGS_FastEnvelope::setBScaling(
int start,
int end, EGS_Float bf) {
94 void EGS_FastEnvelope::setBScaling(
EGS_Input *) {
95 egsWarning(
"EGS_FastEnvelope::setBScaling(): don't use this method."
96 " Use the\n setBScaling methods of the geometry objects that make up"
113 const vector<EGS_BaseGeometry *> &geoms,
const string &Name,
117 egsFatal(
"EGS_EnvelopeGeometry: base geometry must not be null\n");
121 new_indexing =
false;
125 int nreg_inscribed = 0;
128 for (
int j=0; j<n_in; j++) {
129 geometries[j] = geoms[j];
130 geometries[j]->
ref();
131 int nj = geometries[j]->regions();
135 nreg_inscribed += nj;
138 nreg = nbase + n_in*nmax;
142 if (!has_rho_scaling) {
143 for (
int j=0; j<n_in; j++) {
144 if (geometries[j]->hasRhoScaling()) {
145 has_rho_scaling =
true;
151 if (!has_B_scaling) {
152 for (
int j=0; j<n_in; j++) {
153 if (geometries[j]->hasBScaling()) {
154 has_B_scaling =
true;
165 local_start =
new int [n_in];
166 reg_to_inscr =
new int [nreg_inscribed];
168 for (
int j=0; j<n_in; j++) {
169 int n = geometries[j]->regions();
170 local_start[j] = nbase + ir;
171 for (
int i=0; i<n; i++) {
172 reg_to_inscr[ir++] = j;
180 const vector<EnvelopeAux *> &fgeoms,
const string &Name,
184 egsFatal(
"EGS_FastEnvelope: base geometry must not be null\n");
188 n_in = fgeoms.size();
190 new_indexing =
false;
192 egsFatal(
"EGS_FastEnvelope: no inscribed geometries!\n");
196 int *iaux =
new int [nbase];
198 for (j=0; j<nbase; j++) {
202 int nreg_inscribed = 0;
203 for (j=0; j<fgeoms.size(); j++) {
204 geometries[j] = fgeoms[j]->g;
205 geometries[j]->ref();
206 int nj = geometries[j]->regions();
207 nreg_inscribed += nj;
211 for (
int i=0; i<fgeoms[j]->nreg; i++) {
212 int k = fgeoms[j]->regs[i];
213 if (k >= 0 && k < nbase) {
219 n_start =
new int [nbase+1];
220 glist =
new int [nlist];
222 for (j=0; j<nbase; j++) {
225 for (
int l=0; l<fgeoms.size(); l++) {
226 for (
int i=0; i<fgeoms[l]->nreg; i++) {
227 int k = fgeoms[l]->regs[i];
235 n_start[nbase] = ilist;
236 nreg = nbase + n_in*nmax;
239 if (!has_rho_scaling) {
240 for (
int j=0; j<n_in; j++) {
241 if (geometries[j]->hasRhoScaling()) {
242 has_rho_scaling =
true;
249 if (!has_B_scaling) {
250 for (
int j=0; j<n_in; j++) {
251 if (geometries[j]->hasBScaling()) {
252 has_B_scaling =
true;
261 local_start =
new int [n_in];
262 reg_to_inscr =
new int [nreg_inscribed];
264 for (
int j=0; j<n_in; j++) {
265 int n = geometries[j]->regions();
266 local_start[j] = nbase + ir;
267 for (
int i=0; i<n; i++) {
268 reg_to_inscr[ir++] = j;
275 EGS_EnvelopeGeometry::~EGS_EnvelopeGeometry() {
279 for (
int j=0; j<
n_in; j++) {
295 EGS_FastEnvelope::~EGS_FastEnvelope() {
299 for (
int j=0; j<
n_in; j++) {
317 void EGS_EnvelopeGeometry::printInfo()
const {
325 "=======================================================\n");
328 void EGS_FastEnvelope::printInfo()
const {
336 "=======================================================\n");
340 static char EGS_ENVELOPEG_LOCAL eeg_message1[] =
341 "createGeometry(envelope geometry): %s\n";
342 static char EGS_ENVELOPEG_LOCAL eeg_message2[] =
344 static char EGS_ENVELOPEG_LOCAL eeg_message3[] =
345 "no 'base geometry' input?";
346 static char EGS_ENVELOPEG_LOCAL eeg_message4[] =
347 "incorrect base geometry definition";
348 static char EGS_ENVELOPEG_LOCAL eeg_message5[] =
349 "missing/incorrect 'base geometry' input";
350 static char EGS_ENVELOPEG_LOCAL eeg_message6[] =
351 "createGeometry(envelope geometry): no geometry with name %s defined\n";
352 static char EGS_ENVELOPEG_LOCAL eeg_message7[] =
353 "no inscirebed geometries defined?. I hope you know what you are doing";
354 static char EGS_ENVELOPEG_LOCAL eeg_message8[] =
355 "an error occured while constructing inscibed geometries";
357 static char EGS_ENVELOPEG_LOCAL eeg_keyword1[] =
"base geometry";
358 static char EGS_ENVELOPEG_LOCAL eeg_keyword2[] =
"geometry";
359 static char EGS_ENVELOPEG_LOCAL eeg_keyword3[] =
"inscribed geometries";
372 input->
getInput(
"new indexing style",indexing);
394 int err = i->
getInput(eeg_keyword1,bgname);
406 vector<EnvelopeAux *> fgeoms;
408 while ((ix = input->
takeInputItem(
"inscribe in regions")) != 0) {
409 vector<string> values;
410 ix->
getInput(
"inscribe in regions",values);
411 if (values.size() < 2)
egsWarning(
"createGeometry(envelope geometry):"
412 " %d inputs for 'inscribe in regions'? 2 or more are needed\n",values.size());
421 aux->nreg = values.size()-1;
422 aux->regs =
new int [aux->nreg];
423 for (
int j=0; j<aux->nreg; j++) {
424 aux->regs[j] = atoi(values[j+1].c_str());
426 fgeoms.push_back(aux);
431 if (fgeoms.size() > 0) {
435 for (
int j=0; j<fgeoms.size(); j++) {
445 vector<EGS_BaseGeometry *> geoms;
466 vector<string> igeoms;
467 int err = i->
getInput(eeg_keyword3,igeoms);
468 if (err || !igeoms.size()) {
472 for (
unsigned int j=0; j<igeoms.size(); j++) {
499 void EGS_EnvelopeGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
507 for (
int i=0; i<
n_in; i++) {
522 for (
int j=0; j<gregs.size(); j++) {
527 regs.insert(regs.end(), gregs.begin(), gregs.end());
536 void EGS_FastEnvelope::getLabelRegions(
const string &str, vector<int> ®s) {
544 for (
int i=0; i<
n_in; i++) {
559 for (
int j=0; j<gregs.size(); j++) {
564 regs.insert(regs.end(), gregs.begin(), gregs.end());
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
int deref()
Decrease the reference count to this geometry.
static EGS_BaseGeometry * createSingleGeometry(EGS_Input *inp)
Create a single geometry from the input inp.
virtual const string & getType() const =0
Get the geometry type.
virtual void getLabelRegions(const string &str, vector< int > ®s)
Get the list of all regions labeled with str.
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.
const string & getName() const
Get the name of this geometry.
bool isConvex() const
Is the geometry convex?
bool hasRhoScaling() const
Does this geometry object have a mass density scaling feature?
int regions() const
Returns the number of local regions in this geometry.
int setLabels(EGS_Input *input)
Set the labels from an input block.
virtual void printInfo() const
Print information about this geometry.
int ref()
Increase the reference count to 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.
An envelope geometry class.
EGS_BaseGeometry * g
The envelope geometry.
int n_in
Number of inscribed geometries.
static string type
Geometry type.
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 nbase
Number of regions in the base geometry.
bool new_indexing
If true, use new indexing style.
EGS_BaseGeometry ** geometries
The inscribed geometries.
int * reg_to_inscr
Region to inscribed geometry conversion.
An envelope geometry class.
EGS_BaseGeometry ** geometries
The inscribed geometries.
int * local_start
First region for each inscribed geometry.
int n_in
Number of inscribed geometries.
int * reg_to_inscr
Region to inscribed geometry conversion.
EGS_BaseGeometry * g
The envelope geometry.
static string type
Geometry type.
void setMedia(EGS_Input *, int, const int *)
Don't set media for an envelope geometry.
bool new_indexing
If true, use new indexing style.
An envelope geometry: header.
Global egspp functions header file.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
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.