50 static bool EGS_LATTICE_LOCAL inputSet =
false;
52 void EGS_Lattice::setMedia(
EGS_Input *,
int,
const int *) {
53 egsWarning(
"EGS_Lattice::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_Lattice::setRelativeRho(
int start,
int end, EGS_Float rho) {
61 void EGS_Lattice::setRelativeRho(
EGS_Input *) {
62 egsWarning(
"EGS_Lattice::setRelativeRho(): don't use this method."
63 " Use the\n setRelativeRho methods of the geometry objects that make up"
67 void EGS_Lattice::setBScaling(
int start,
int end, EGS_Float bf) {
71 void EGS_Lattice::setBScaling(
EGS_Input *) {
72 egsWarning(
"EGS_Lattice::setBScaling(): don't use this method. "
73 "Use the\n setBScaling() methods of the geometry objects that make "
74 "up this geometry\n");
78 EGS_Float y, EGS_Float z,
const string &Name)
81 ind(i), a(x), b(y), c(z) {
83 type +=
" with a lattice of ";
84 type += sub->getType();
85 nreg = base->regions() + sub->regions();
86 has_rho_scaling = base->hasRhoScaling();
87 maxStep = base->regions()+1000000*sub->regions();
90 EGS_Lattice::~EGS_Lattice() {
99 void EGS_Lattice::printInfo()
const {
104 sub->getType().c_str());
105 egsInformation(
" lattice region %d with an (x,y,z) spacing of (%d,%d,%d)",
107 egsInformation(
"=======================================================\n");
110 void EGS_Hexagonal_Lattice::setMedia(
EGS_Input *,
int,
const int *) {
111 egsWarning(
"EGS_Hexagonal_Lattice::setMedia: don't use this method. Use the\n"
112 " setMedia() methods of the geometry objects that make up this geometry\n");
115 void EGS_Hexagonal_Lattice::setRelativeRho(
int start,
int end, EGS_Float rho) {
119 void EGS_Hexagonal_Lattice::setRelativeRho(
EGS_Input *) {
120 egsWarning(
"EGS_Hexagonal_Lattice::setRelativeRho(): don't use this method."
121 " Use the\n setRelativeRho methods of the geometry objects that make up"
125 void EGS_Hexagonal_Lattice::setBScaling(
int start,
int end, EGS_Float bf) {
129 void EGS_Hexagonal_Lattice::setBScaling(
EGS_Input *) {
130 egsWarning(
"EGS_Hexagonal_Lattice::setBScaling(): don't use this method. "
131 "Use the\n setBScaling() methods of the geometry objects that make "
132 "up this geometry\n");
139 ind(i), a(x), d(4,0.0) {
141 type +=
" with a hexagonal lattice of ";
142 type += sub->getType();
143 gap = a*sqrt(3.0)/2.0;
144 nreg = base->regions() + sub->regions();
145 has_rho_scaling = base->hasRhoScaling();
146 maxStep = base->regions()+1000000*sub->regions();
149 EGS_Hexagonal_Lattice::~EGS_Hexagonal_Lattice() {
158 void EGS_Hexagonal_Lattice::printInfo()
const {
163 sub->getType().c_str());
165 egsInformation(
"=======================================================\n");
169 static void setInputs() {
172 setBaseGeometryInputs(
false);
174 geomBlockInput->getSingleInput(
"library")->setValues({
"egs_lattice"});
177 geomBlockInput->addSingleInput(
"base geometry",
true,
"The name of a previously defined geometry, into which the lattice will be enveloped.");
178 geomBlockInput->addSingleInput(
"subgeometry",
true,
"The name of a geometry to place at each lattice position.");
179 geomBlockInput->addSingleInput(
"subgeometry index",
true,
"The region or list of regions that contain the lattice.");
180 geomBlockInput->addSingleInput(
"spacing",
true,
"The spacing as defined for Bravais (x, y, z), Cubic (x), or Hexagonal modes (s, close-packed distance). ");
181 geomBlockInput->addSingleInput(
"type",
false,
"The type of lattice. Currently just used for hexagonal lattices.", {
"hexagonal"});
184 EGS_LATTICE_EXPORT
string getExample() {
188 # Example Bravais lattice with spacings 1, 2 and 3
190 library = egs_lattice
191 name = phantom_w_microcavity
192 base geometry = phantom
193 subgeometry = microcavity
194 subgeometry index = 0
201 EGS_LATTICE_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
205 return geomBlockInput;
214 egsWarning(
"createGeometry(lattice): base geometry must be defined\n"
215 " using 'base geometry = some_geom'?\n");
224 egsWarning(
"createGeometry(lattice): incorrect base geometry definition\n");
231 err = i->
getInput(
"base geometry",bgname);
234 egsWarning(
"createGeometry(lattice): missing/incorrect 'base geometry' input\n");
239 egsWarning(
"createGeometry(lattice): no geometry with name %s defined\n",
248 egsWarning(
"createGeometry(lattice): subgeometry must be defined\n"
249 " using 'subgeometry = some_geom'?\n");
258 egsWarning(
"createGeometry(lattice): incorrect subgeometry definition\n");
265 err = i->
getInput(
"subgeometry",bgname);
268 egsWarning(
"createGeometry(lattice): missing/incorrect 'subgeometry' input\n");
273 egsWarning(
"createGeometry(lattice): no geometry with name %s defined\n",
283 egsWarning(
"createGeometry(lattice): subgeometry index must be defined\n"
284 " using 'subgeometry index = some_index'\n");
288 err = i->
getInput(
"subgeometry index",ind);
291 egsWarning(
"createGeometry(lattice): missing/incorrect 'subgeometry index' input\n");
294 else if (ind < 0 || ind >= b->
regions()) {
295 egsWarning(
"createGeometry(lattice): subgeometry index %d"
296 " is not valid, must be a region in base geometry\n",ind);
302 vector<EGS_Float> space;
303 err = input->
getInput(
"spacing",space);
305 for (
int i=0; i < space.size(); i++) {
308 " is not valid, spacings must be greater than zero\n");
312 if (space.size() != 1 && space.size() != 3) {
314 " is not valid, input either one or three"
315 "x, y, and z spacings\n");
326 if (space.size() == 3) {
327 result =
new EGS_Lattice(b, s, ind, space[0], space[1], space[2]);
329 else if (input->
compare(
"hexagonal",type)) {
333 result =
new EGS_Lattice(b, s, ind, space[0], space[0], space[0]);
339 void EGS_Lattice::getLabelRegions(
const string &str, vector<int> ®s,
bool sanitize) {
342 int index = regs.size();
346 for (; index<regs.size(); index++) {
351 void EGS_Hexagonal_Lattice::getLabelRegions(
const string &str, vector<int> ®s,
bool sanitize) {
354 int index = regs.size();
358 for (; index<regs.size(); index++) {
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.
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.
int regions() const
Returns the number of local regions in this geometry.
virtual void printInfo() const
Print information about this geometry.
static EGS_BaseGeometry * getGeometry(const string &Name)
Get a pointer to the geometry named Name.
virtual void getLabelRegions(const string &str, vector< int > ®s, bool sanitize=true)
Get the list of all regions labeled with str.
EGS_Float a
The center-to-center distance to the nearest 12 neighbours.
EGS_BaseGeometry * base
The geometry within which the sub geometry appears.
EGS_TransformedGeometry * sub
The sub geometry that could appear within base.
int ind
The region in base geom where we could encounter sub geom.
A Bravais, cubic, and hexagonal lattice geometry.
EGS_TransformedGeometry * sub
The sub geometry that could appear within base.
EGS_BaseGeometry * base
The geometry within which the sub geometry appears.
EGS_Float c
The center-to-center distance along x, y, and z.
int ind
The region in base geom where we could encounter sub geom.
A class representing 3D vectors.
Global egspp functions header file.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Lattice geometries: header.
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 egsWarning
Always use this function for reporting warnings.