43 static bool EGS_CYLINDERS_LOCAL inputSet =
false;
47 static void setInputs() {
50 setBaseGeometryInputs();
52 geomBlockInput->getSingleInput(
"library")->setValues({
"egs_cylinders"});
55 auto typePtr = geomBlockInput->addSingleInput(
"type",
true,
"The type of cylinder.", {
"EGS_XCylinders",
"EGS_YCylinders",
"EGS_ZCylinders",
"EGS_Cylinders"});
57 geomBlockInput->addSingleInput(
"radii",
true,
"A list of cylinder radii, must be in increasing order");
58 geomBlockInput->addSingleInput(
"midpoint",
false,
"The position of the midpoint of the cylinder (x, y, z)");
61 auto inpPtr = geomBlockInput->addSingleInput(
"axis",
true,
"The unit vector defining the axis along the length of the cylinder.");
62 inpPtr->addDependency(typePtr,
"EGS_Cylinders");
65 EGS_CYLINDERS_EXPORT
string getExample() {
69 # Examples of the egs_cylinders to follow
71 # EGS_XCylinder example
73 library = egs_cylinders
79 media = water air water
85 # EGS_Cylinder example
87 library = egs_cylinders
101 EGS_CYLINDERS_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
105 return geomBlockInput;
111 egsWarning(
"createGeometry(cylinders): null input?\n");
115 int err = input->
getInput(
"type",type);
117 egsWarning(
"createGeometry(cylinders): missing type key\n");
123 vector<EGS_Float> Xo;
124 err = input->
getInput(
"midpoint",Xo);
125 if (!err && Xo.size() == 3) {
130 vector<EGS_Float> radii;
131 err = input->
getInput(
"radii",radii);
133 egsWarning(
"createGeometry(cylinders): wrong/missing 'radii' input\n");
136 EGS_Float *r=
new EGS_Float [radii.size()];
137 for (
int i=0; i<radii.size(); i++) {
143 if (type ==
"EGS_XCylinders") {
146 else if (type ==
"EGS_YCylinders") {
149 else if (type ==
"EGS_ZCylinders") {
155 if (err || a.size() != 3) {
156 egsWarning(
"createGeometry(cylinders): missing/wrong axis input\n");
159 egsWarning(
"got axis (%g,%g,%g)\n",a[0],a[1],a[2]);
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void setMedia(EGS_Input *inp)
Set the media in the geometry from the input pointed to by inp.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
int setLabels(EGS_Input *input)
Set the labels from an input block.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
A set of concentric cylinders.
A projector into any plane.
A class representing 3D vectors.
A projector into the x-plane.
A projector into the y-plane.
A projector into the z-plane.
A set of concentric cylinders: header.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.