44 #define S_STREAM std::istrstream
47 #define S_STREAM std::istringstream
50 string EGS_CDGeometry::type =
"EGS_CDGeometry";
52 void EGS_CDGeometry::setMedia(
EGS_Input *,
int,
const int *) {
53 egsWarning(
"EGS_CDGeometry::setMedia: don't use this method. Use the\n"
54 " setMedia() methods of the geometry objects that make up this geometry\n");
57 void EGS_CDGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
58 egsWarning(
"EGS_CDGeometry::setRelativeRho(): don't use this method\n"
59 " Use the setRelativeRho() methods of the geometry objects that make"
60 " up this geometry\n");
63 void EGS_CDGeometry::setRelativeRho(
EGS_Input *) {
64 egsWarning(
"EGS_CDGeometry::setRelativeRho(): don't use this method\n"
65 " Use the setRelativeRho() methods of the geometry objects that make"
66 " up this geometry\n");
69 void EGS_CDGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
70 egsWarning(
"EGS_CDGeometry::setBScaling(): don't use this method\n"
71 " Use the setBScaling() methods of the geometry objects that make"
72 " up this geometry\n");
75 void EGS_CDGeometry::setBScaling(
EGS_Input *) {
76 egsWarning(
"EGS_CDGeometry::setBScaling(): don't use this method\n"
77 " Use the setBScaling() methods of the geometry objects that make"
78 " up this geometry\n");
81 void EGS_CDGeometry::setUpIndexing() {
84 for (j=0; j<nbase; j++) {
95 for (j=0; j<nbase; j++) {
99 for (
int i=0; i<n; i++) {
116 egsWarning(
"createGeometry(CD_Geometry): null input?\n");
125 int err = input->
getInput(
"base geometry",bg_name);
127 egsWarning(
"createGeometry(CD_Geometry): no 'base geometry' input\n");
132 egsWarning(
"createGeometry(CD_Geometry): no geometry named %s is"
133 " defined\n",bg_name.c_str());
138 egsWarning(
"createGeometry(CD_Geometry): the base geometry has %d"
144 for (j=0; j<nreg; j++) {
156 if (aux.size() == 2) {
157 string auxx = aux[0];
161 S_STREAM in(auxx.c_str());
162 in >> istart >> name;
163 if (in.fail() || !in.good()) {
164 egsWarning(
"createGeometry(CD_Geometry): parse error in\n"
165 " set geometry = %s\n",auxx.c_str());
170 if (istart < 0 || istart > nreg-1) {
179 else if (aux.size() == 3) {
180 string auxx = aux[0];
186 S_STREAM in(auxx.c_str());
187 in >> istart >> iend >> name;
188 if (in.fail() || !in.good()) {
189 egsWarning(
"createGeometry(CD_Geometry): parse error in\n"
190 " set geometry = %s\n",auxx.c_str());
210 egsWarning(
"createGeometry(CD_Geometry): no geometry named %s"
211 " is defined\n",name.c_str());
215 for (
int j=istart; j<iend; j++) {
216 if (G[j] && G[j] != gj) {
234 egsWarning(
"createGeometry(CD_Geometry): %d errors\n",err);
235 for (j=0; j<nreg; j++) {
237 if (!G[j]->deref()) {
246 egsWarning(
"createGeometry(CD_Geometry): no geometries in addition to"
247 " the base geometry defined?\n"
248 " Hope you know what you are doing\n");
251 input->
getInput(
"new indexing style",indexing);
262 void EGS_CDGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
271 for (
int i=0; i<bgregs.size(); i++) {
274 if (bgregs[i] < nbase-1) {
282 rstart = bgregs[i]*nmax;
283 rend = (bgregs[i]+1)*nmax;
285 for (
int j=rstart; j<rend; j++) {
293 for (
int i=0; i<nbase; i++) {
308 for (
int j=0; j<gregs.size(); j++) {
313 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 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.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
int regions() const
Returns the number of local regions in this geometry.
int setLabels(EGS_Input *input)
Set the labels from an input block.
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 "combinatorial dimension" geometry.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.