43 #define S_STREAM std::istrstream
46 #define S_STREAM std::istringstream
49 string EGS_CDGeometry::type =
"EGS_CDGeometry";
51 void EGS_CDGeometry::setMedia(
EGS_Input *,
int,
const int *) {
52 egsWarning(
"EGS_CDGeometry::setMedia: don't use this method. Use the\n"
53 " setMedia() methods of the geometry objects that make up this geometry\n");
56 void EGS_CDGeometry::setRelativeRho(
int start,
int end, EGS_Float rho) {
57 egsWarning(
"EGS_CDGeometry::setRelativeRho(): don't use this method\n"
58 " Use the setRelativeRho() methods of the geometry objects that make"
59 " up this geometry\n");
62 void EGS_CDGeometry::setRelativeRho(
EGS_Input *) {
63 egsWarning(
"EGS_CDGeometry::setRelativeRho(): don't use this method\n"
64 " Use the setRelativeRho() methods of the geometry objects that make"
65 " up this geometry\n");
68 void EGS_CDGeometry::setBScaling(
int start,
int end, EGS_Float bf) {
69 egsWarning(
"EGS_CDGeometry::setBScaling(): don't use this method\n"
70 " Use the setBScaling() methods of the geometry objects that make"
71 " up this geometry\n");
74 void EGS_CDGeometry::setBScaling(
EGS_Input *) {
75 egsWarning(
"EGS_CDGeometry::setBScaling(): don't use this method\n"
76 " Use the setBScaling() methods of the geometry objects that make"
77 " up this geometry\n");
80 void EGS_CDGeometry::setUpIndexing() {
83 for (j=0; j<nbase; j++) {
94 for (j=0; j<nbase; j++) {
98 for (
int i=0; i<n; i++) {
115 egsWarning(
"createGeometry(CD_Geometry): null input?\n");
124 int err = input->
getInput(
"base geometry",bg_name);
126 egsWarning(
"createGeometry(CD_Geometry): no 'base geometry' input\n");
131 egsWarning(
"createGeometry(CD_Geometry): no geometry named %s is"
132 " defined\n",bg_name.c_str());
137 egsWarning(
"createGeometry(CD_Geometry): the base geometry has %d"
143 for (j=0; j<nreg; j++) {
155 if (aux.size() == 2) {
156 string auxx = aux[0];
160 S_STREAM in(auxx.c_str());
161 in >> istart >> name;
162 if (in.fail() || !in.good()) {
163 egsWarning(
"createGeometry(CD_Geometry): parse error in\n"
164 " set geometry = %s\n",auxx.c_str());
169 if (istart < 0 || istart > nreg-1) {
178 else if (aux.size() == 3) {
179 string auxx = aux[0];
185 S_STREAM in(auxx.c_str());
186 in >> istart >> iend >> name;
187 if (in.fail() || !in.good()) {
188 egsWarning(
"createGeometry(CD_Geometry): parse error in\n"
189 " set geometry = %s\n",auxx.c_str());
209 egsWarning(
"createGeometry(CD_Geometry): no geometry named %s"
210 " is defined\n",name.c_str());
214 for (
int j=istart; j<iend; j++) {
215 if (G[j] && G[j] != gj) {
233 egsWarning(
"createGeometry(CD_Geometry): %d errors\n",err);
234 for (j=0; j<nreg; j++) {
236 if (!G[j]->deref()) {
245 egsWarning(
"createGeometry(CD_Geometry): no geometries in addition to"
246 " the base geometry defined?\n"
247 " Hope you know what you are doing\n");
250 input->
getInput(
"new indexing style",indexing);
261 void EGS_CDGeometry::getLabelRegions(
const string &str, vector<int> ®s) {
270 for (
int i=0; i<bgregs.size(); i++) {
273 if (bgregs[i] < nbase-1) {
281 rstart = bgregs[i]*nmax;
282 rend = (bgregs[i]+1)*nmax;
284 for (
int j=rstart; j<rend; j++) {
292 for (
int i=0; i<nbase; i++) {
307 for (
int j=0; j<gregs.size(); j++) {
312 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.
int setLabels(EGS_Input *input)
Set the labels from an input block.
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.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
A "combinatorial dimension" geometry.
virtual void getLabelRegions(const string &str, vector< int > ®s)
Get the list of all regions labeled with str.
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.
int nreg
Number of local regions in this geometry.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.