72 if (axis==
kXAxis) { axisString =
"kXAxis"; }
73 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
74 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
75 else if (axis==
kRho) { axisString =
"kRho"; }
76 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
84 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
85 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
86 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
87 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
88 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
89 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
90 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
91 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
92 divisionvolElement->appendChild(volumerefElement);
93 volumeElement->appendChild(divisionvolElement);
113 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
114 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
115 volumeElement->appendChild(physvolElement);
121 if (ModuleName.empty())
123 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
124 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
125 physvolElement->appendChild(volumerefElement);
129 xercesc::DOMElement* fileElement =
NewElement(
"file");
130 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
131 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
132 physvolElement->appendChild(fileElement);
171 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
172 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
173 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
174 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
175 replicavolElement->appendChild(volumerefElement);
176 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
177 replicavolElement->appendChild(replicateElement);
179 xercesc::DOMElement* dirElement =
NewElement(
"direction");
181 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
183 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
185 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
187 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
189 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
191 replicateElement->appendChild(dirElement);
193 xercesc::DOMElement* widthElement =
NewElement(
"width");
194 widthElement->setAttributeNode(
NewAttribute(
"value",width));
195 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
196 replicateElement->appendChild(widthElement);
198 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
199 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
200 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
201 replicateElement->appendChild(offsetElement);
203 volumeElement->appendChild(replicavolElement);
209 if (!bsurf) {
return; }
215 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
217 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
224 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
225 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
226 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
227 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
228 borderElement->appendChild(volumerefElement1);
229 borderElement->appendChild(volumerefElement2);
237 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
250 if (!ssurf) {
return; }
256 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
258 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
263 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
264 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
265 skinElement->appendChild(volumerefElement);
273 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
286 std::vector<const G4OpticalSurface*>::const_iterator pos;
287 pos = std::find(opt_vec.begin(), opt_vec.end(), osurf);
288 if (pos != opt_vec.end()) {
return false; }
290 opt_vec.push_back(osurf);
303 std::vector<G4LogicalSkinSurface*>::const_iterator pos;
304 for (pos = stable->begin(); pos != stable->end(); pos++)
306 if (lvol == (*pos)->GetLogicalVolume())
324 std::vector<G4LogicalBorderSurface*>::const_iterator pos;
325 for (pos = btable->begin(); pos != btable->end(); pos++)
327 if (pvol == (*pos)->GetVolume1())
340 std::vector<xercesc::DOMElement*>::const_iterator pos;
375 G4String ErrorMessage =
"Referenced solid in volume '"
377 +
"' was displaced/reflected too many times!";
378 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
384 R = R*refl->GetTransform3D();
385 solidPtr = refl->GetConstituentMovedSolid();
393 disp->GetObjectTranslation());
394 solidPtr = disp->GetConstituentMovedSolid();
404 if (trans>0) { invR = R.
inverse(); }
414 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
415 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
416 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
417 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
418 volumeElement->appendChild(materialrefElement);
419 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
420 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
421 volumeElement->appendChild(solidrefElement);
425 for (
G4int i=0;i<daughterCount;i++)
432 if (ModuleName.empty())
448 G4String ErrorMessage =
"Division volume in '"
450 +
"' can not be related to reflected solid!";
451 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
460 G4String ErrorMessage =
"Parameterised volume in '"
462 +
"' can not be related to reflected solid!";
463 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
472 G4String ErrorMessage =
"Replica volume in '"
474 +
"' can not be related to reflected solid!";
475 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
489 PhysvolWrite(volumeElement,physvol,invR*P*daughterR,ModuleName);
std::vector< G4LogicalBorderSurface * > G4LogicalBorderSurfaceTable
std::vector< G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
G4DLLIMPORT std::ostream G4cout
static const G4double kLinearPrecision
void RotationWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &rot)
static const G4double kAngularPrecision
void PositionWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &pos)
G4ThreeVector GetAngles(const G4RotationMatrix &)
void ScaleWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &scl)
static const G4double kRelativePrecision
void AddMaterial(const G4Material *const)
virtual void ParamvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
virtual void AddSolid(const G4VSolid *const)
xercesc::DOMElement * solidsElement
static const G4int maxTransforms
void OpticalSurfaceWrite(xercesc::DOMElement *, const G4OpticalSurface *const)
virtual ~G4GDMLWriteStructure()
const G4LogicalBorderSurface * GetBorderSurface(const G4VPhysicalVolume *const)
void BorderSurfaceCache(const G4LogicalBorderSurface *const)
std::vector< xercesc::DOMElement * > borderElementVec
std::vector< xercesc::DOMElement * > skinElementVec
void SkinSurfaceCache(const G4LogicalSkinSurface *const)
const G4LogicalSkinSurface * GetSkinSurface(const G4LogicalVolume *const)
void PhysvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const topVol, const G4Transform3D &transform, const G4String &moduleName)
virtual void StructureWrite(xercesc::DOMElement *)
G4Transform3D TraverseVolumeTree(const G4LogicalVolume *const topVol, const G4int depth)
xercesc::DOMElement * structureElement
void DivisionvolWrite(xercesc::DOMElement *, const G4PVDivision *const)
G4bool FindOpticalSurface(const G4SurfaceProperty *)
void ReplicavolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
xercesc::DOMElement * NewElement(const G4String &)
G4String GenerateName(const G4String &, const void *const)
G4String Modularize(const G4VPhysicalVolume *const topvol, const G4int depth)
virtual void AddExtension(xercesc::DOMElement *, const G4LogicalVolume *const)
G4Transform3D Write(const G4String &filename, const G4LogicalVolume *const topLog, const G4String &schemaPath, const G4int depth, G4bool storeReferences=true)
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)
VolumeMapType & VolumeMap()
static const G4LogicalBorderSurfaceTable * GetSurfaceTable()
const G4VPhysicalVolume * GetVolume2() const
const G4VPhysicalVolume * GetVolume1() const
static size_t GetNumberOfBorderSurfaces()
const G4LogicalVolume * GetLogicalVolume() const
static const G4LogicalSkinSurfaceTable * GetSurfaceTable()
static size_t GetNumberOfSkinSurfaces()
const G4String & GetName() const
G4SurfaceProperty * GetSurfaceProperty() const
G4VSolid * GetSolid() const
G4int GetNoDaughters() const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
const G4String & GetName() const
EAxis GetDivisionAxis() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
const G4String & GetName() const
virtual G4bool IsReplicated() const =0
G4LogicalVolume * GetLogicalVolume() const
const G4RotationMatrix * GetFrameRotation() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
const G4String & GetName() const
G4ThreeVector GetObjectTranslation() const
virtual G4bool IsParameterised() const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)