#ifndef AGDDPOSXYZHH #define AGDDPOSXYZHH #include "agddPos.hh" #include "agddVolume.hh" #include "agddSolid.hh" #include "agddAttribute.hh" #include "DWUnits.hh" #include "agddPosContainer.hh" #include "agddSolidPosContainer.hh" namespace agdd { class PosXYZ : public Pos { private: Volume * _volume; Solid * _solid; Attribute _xYZ; Attribute _rot; public: PosXYZ() : Pos("posXYZ"), _volume(0), _solid(0), _xYZ("X_Y_Z", "0 0 0"), _rot("rot" , "0 0 0") { }; void putMeInThisPosContainer(PosContainer * container) { assert(container); makeTheElement(); container->posElementsGoHere()->addChild(theElement()); _xYZ.addAttributeTo(theElement()); _rot.addAttributeTo(theElement()); if (!_volume) { cerr << "ERROR: You have not " << "set the volume associated with a posXYZ." << endl; }; assert(_volume); theElement()->addAttribute("volume", _volume->getName()); _volume->putMyselfIn(container->defaultSection()); }; void putMeInThisSolidPosContainer(SolidPosContainer * container) { assert(container); if (!_solid) { cerr << "ERROR: You are either trying to use posXYZ to place a " << "non-solid (a composition, for example) within " << "a solid object (such as a union), or you have not " << "set the volume associated with the position." << endl; }; assert(_solid); cout << "Making materials uniform ... " << flush; _solid->setMaterial(container->getSolidPosContainerMaterialName()); cout << "done." << endl; putMeInThisPosContainer(container); }; void setVolume(Volume * volume) { assert(volume); _volume = volume; _solid = 0; }; void setVolume(Solid * solid) { assert(solid); _solid = solid; _volume = solid; }; void setXYZ(double x, // These arguments should be in double y, // the program's internal units. double z) { _xYZ.setValue(makeNumberString(x/DWmm, y/DWmm, z/DWmm)); }; void setRot(double x, // These angles should be in the double y, // program's internal units. double z) { _rot.setValue(makeNumberString(x/DWdegree, y/DWdegree, z/DWdegree)); }; }; } #endif