49 egsWarning(
"EGS_UnionGeometry::setMedia: don't use this method. Use the\n"
50 " setMedia() methods of the geometry objects that make up this geometry\n");
53 void EGS_UnionGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
57 void EGS_UnionGeometry::setRelativeRho(
EGS_Input *) {
58 egsWarning(
"EGS_UnionGeometry::setRelativeRho(): don't use this method. "
59 "Use the\n setRelativeRho() methods of the geometry objects that make "
60 "up this geometry\n");
63 void EGS_UnionGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
67 void EGS_UnionGeometry::setBScaling(
EGS_Input *) {
68 egsWarning(
"EGS_UnionGeometry::setBScaling(): don't use this method. "
69 "Use the\n setBScaling() methods of the geometry objects that make "
70 "up this geometry\n");
74 const int *priorities,
const string &Name) :
77 if (
ng <= 0)
egsFatal(
"EGS_UnionGeometry::EGS_UnionGeometry: attempt "
78 " to construct a union geometry from zero geometries\n");
80 if (
ng == 1)
egsWarning(
"EGS_UnionGeometry::EGS_UnionGeometry: why "
81 "do you want to make a union out of a single geometry?\n");
85 int *order =
new int [
ng];
89 bool *is_used =
new bool [
ng];
90 for (j=0; j<
ng; j++) {
93 for (j=0; j<
ng; j++) {
95 for (imax=0; imax<
ng-1; imax++)
if (!is_used[imax]) {
98 int pmax = priorities[imax];
99 for (
int i=0; i<
ng; i++) {
100 if (!is_used[i] && priorities[i] > pmax) {
102 pmax = priorities[i];
106 is_used[imax] =
true;
112 for (j=0; j<
ng; j++) {
119 for (j=0; j<
ng; j++) {
134 for (j=0; j<
ng; j++) {
147 if (!
nmax)
egsFatal(
"EGS_UnionGeometry::EGS_UnionGeometry: all geometries"
148 " have zero regions?\n");
152 EGS_UnionGeometry::~EGS_UnionGeometry() {
153 for (
int j=0; j<
ng; j++) {
161 void EGS_UnionGeometry::printInfo()
const {
165 g[j]->
getName().c_str(),
g[j]->getType().c_str());
167 "=======================================================\n");
174 egsWarning(
"createGeometry(union): null input?\n");
177 vector<EGS_BaseGeometry *> geoms;
178 vector<string> gnames;
179 int err = input->
getInput(
"geometries",gnames);
180 if (err || gnames.size() < 1) {
181 egsWarning(
"createGeometry(union): missing/wrong 'geometries' input\n");
184 for (
unsigned int j=0; j<gnames.size(); j++) {
186 if (!gj)
egsWarning(
"createGeometry(union): no geometry named %s "
187 "defined\n",gnames[j].c_str());
192 if (geoms.size() < 1) {
193 egsWarning(
"createGeometry(union): must have at least one geometry\n");
197 err = input->
getInput(
"priorities",pri);
200 if (pri.size() == geoms.size()) {
201 p =
new int [pri.size()];
202 for (
int i=0; i<pri.size(); i++) {
206 else egsWarning(
"createGeometry(union): the number of priorities (%d)"
207 " is not the same as the number of geometries (%d) => ignoring\n",
208 pri.size(),geoms.size());
220 void EGS_UnionGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
224 for (
int i=0; i<
ng; i++) {
233 for (
int j=0; j<gregs.size(); j++) {
238 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.
virtual void getLabelRegions(const string &str, vector< int > ®s)
Get the list of all regions labeled with str.
int nreg
Number of local regions in this geometry.
bool has_B_scaling
Does this geometry has B field scaling factor?
bool is_convex
Is this geometry convex?
bool has_rho_scaling
Does this geometry have relative mass density scvaling?
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 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.
A geometry constructed as the union of other geometries.
void setMedia(EGS_Input *, int, const int *)
Don't set media when defining the union.
int nmax
max. number of regions in all of the geoms.
int ng
number of geometries.
static string type
the geometry type
EGS_BaseGeometry ** g
the geometries that form the union.
EGS_UnionGeometry(const vector< EGS_BaseGeometry * > &geoms, const int *priorities=0, const string &Name="")
Construct a geometry union from the vector of geometries geom.
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.