48 egsWarning(
"EGS_UnionGeometry::setMedia: don't use this method. Use the\n"
49 " setMedia() methods of the geometry objects that make up this geometry\n");
52 void EGS_UnionGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
56 void EGS_UnionGeometry::setRelativeRho(
EGS_Input *) {
57 egsWarning(
"EGS_UnionGeometry::setRelativeRho(): don't use this method. "
58 "Use the\n setRelativeRho() methods of the geometry objects that make "
59 "up this geometry\n");
62 void EGS_UnionGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
66 void EGS_UnionGeometry::setBScaling(
EGS_Input *) {
67 egsWarning(
"EGS_UnionGeometry::setBScaling(): don't use this method. "
68 "Use the\n setBScaling() methods of the geometry objects that make "
69 "up this geometry\n");
73 const int *priorities,
const string &Name) :
76 if (
ng <= 0)
egsFatal(
"EGS_UnionGeometry::EGS_UnionGeometry: attempt "
77 " to construct a union geometry from zero geometries\n");
79 if (
ng == 1)
egsWarning(
"EGS_UnionGeometry::EGS_UnionGeometry: why "
80 "do you want to make a union out of a single geometry?\n");
84 int *order =
new int [
ng];
88 bool *is_used =
new bool [
ng];
89 for (j=0; j<
ng; j++) {
92 for (j=0; j<
ng; j++) {
94 for (imax=0; imax<ng-1; imax++)
if (!is_used[imax]) {
97 int pmax = priorities[imax];
98 for (
int i=0; i<
ng; i++) {
99 if (!is_used[i] && priorities[i] > pmax) {
101 pmax = priorities[i];
105 is_used[imax] =
true;
111 for (j=0; j<
ng; j++) {
118 for (j=0; j<
ng; j++) {
133 for (j=0; j<
ng; j++) {
146 if (!
nmax)
egsFatal(
"EGS_UnionGeometry::EGS_UnionGeometry: all geometries"
147 " have zero regions?\n");
151 EGS_UnionGeometry::~EGS_UnionGeometry() {
152 for (
int j=0; j<
ng; j++) {
160 void EGS_UnionGeometry::printInfo()
const {
164 g[j]->
getName().c_str(),
g[j]->getType().c_str());
166 "=======================================================\n");
173 egsWarning(
"createGeometry(union): null input?\n");
176 vector<EGS_BaseGeometry *> geoms;
177 vector<string> gnames;
178 int err = input->
getInput(
"geometries",gnames);
179 if (err || gnames.size() < 1) {
180 egsWarning(
"createGeometry(union): missing/wrong 'geometries' input\n");
183 for (
unsigned int j=0; j<gnames.size(); j++) {
185 if (!gj)
egsWarning(
"createGeometry(union): no geometry named %s "
186 "defined\n",gnames[j].c_str());
191 if (geoms.size() < 1) {
192 egsWarning(
"createGeometry(union): must have at least one geometry\n");
196 err = input->
getInput(
"priorities",pri);
199 if (pri.size() == geoms.size()) {
200 p =
new int [pri.size()];
201 for (
int i=0; i<pri.size(); i++) {
205 else egsWarning(
"createGeometry(union): the number of priorities (%d)"
206 " is not the same as the number of geometries (%d) => ignoring\n",
207 pri.size(),geoms.size());
219 void EGS_UnionGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
223 for (
int i=0; i<
ng; i++) {
232 for (
int j=0; j<gregs.size(); j++) {
237 regs.insert(regs.end(), gregs.begin(), gregs.end());
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.
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?
EGS_BaseGeometry ** g
the geometries that form the union.
Global egspp functions header file.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
EGS_UnionGeometry(const vector< EGS_BaseGeometry * > &geoms, const int *priorities=0, const string &Name="")
Construct a geometry union from the vector of geometries geom.
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.
A geometry constructed as the union of other geometries.
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
static string type
the geometry type
bool is_convex
Is this geometry convex?
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.
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.
bool has_rho_scaling
Does this geometry have relative mass density scvaling?
int ref()
Increase the reference count to this geometry.
const string & getName() const
Get the name of this geometry.
int nreg
Number of local regions in this geometry.
int ng
number of geometries.
bool has_B_scaling
Does this geometry has B field scaling factor?
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.