Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -23,29 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// struct G4GDMLAuxStructType
// History:
// - Created. Witold Pokorski, March 2015
// -------------------------------------------------------------------------
#ifndef _G4GDMLAUXSTRUCTTYPE_INCLUDED_
#define _G4GDMLAUXSTRUCTTYPE_INCLUDED_
// Author: Witold Pokorski, March 2015
// --------------------------------------------------------------------
#ifndef G4GDMLAUXSTRUCTTYPE_HH
#define G4GDMLAUXSTRUCTTYPE_HH 1
#include <vector>
#include "G4String.hh"
struct G4GDMLAuxStructType
{
G4String type;
G4String value;
G4String unit;
std::vector<G4GDMLAuxStructType>* auxList;
G4String type;
G4String value;
G4String unit;
std::vector<G4GDMLAuxStructType>* auxList;
};
typedef std::vector<G4GDMLAuxStructType> G4GDMLAuxListType;
using G4GDMLAuxListType = std::vector<G4GDMLAuxStructType>;
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLEvaluator
// G4GDMLEvaluator
//
// Class description:
//
// GDML class for evaluation of expressions.
// GDML class for evaluation of expressions
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLEVALUATOR_INCLUDED_
#define _G4GDMLEVALUATOR_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLEVALUATOR_HH
#define G4GDMLEVALUATOR_HH 1
#include <vector>
@@ -45,29 +40,28 @@
class G4GDMLEvaluator
{
public:
public:
G4GDMLEvaluator();
G4GDMLEvaluator();
void Clear();
void DefineConstant(const G4String&, G4double);
void DefineVariable(const G4String&, G4double);
void DefineMatrix(const G4String&, G4int, std::vector<G4double>);
void SetVariable(const G4String&, G4double);
G4bool IsVariable(const G4String&) const;
G4String SolveBrackets(const G4String&);
G4double Evaluate(const G4String&);
G4int EvaluateInteger(const G4String&);
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4String ConvertToString(G4int ival);
G4String ConvertToString(G4double dval);
void Clear();
void DefineConstant(const G4String&, G4double);
void DefineVariable(const G4String&, G4double);
void DefineMatrix(const G4String&, G4int, std::vector<G4double>);
void SetVariable(const G4String&, G4double);
G4bool IsVariable(const G4String&) const;
G4String SolveBrackets(const G4String&);
G4double Evaluate(const G4String&);
G4int EvaluateInteger(const G4String&);
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4String ConvertToString(G4int ival);
G4String ConvertToString(G4double dval);
private:
private:
G4Evaluator eval;
std::vector<G4String> variableList;
G4Evaluator eval;
std::vector<G4String> variableList;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLMessenger
// G4GDMLMessenger
//
// Class description:
//
// GDML UI messenger.
// History:
// - Created. Witold Pokorski, October 2010
// -------------------------------------------------------------------------
#ifndef G4GDMLMessenger_h
#define G4GDMLMessenger_h 1
// Author: Witold Pokorski, October 2010
// --------------------------------------------------------------------
#ifndef G4GDMLMessenger_hh
#define G4GDMLMessenger_hh 1
#include "globals.hh"
#include "G4UImessenger.hh"
@@ -52,31 +47,31 @@ class G4UIcmdWithABool;
class G4GDMLMessenger : public G4UImessenger
{
public: // with description
public:
G4GDMLMessenger(G4GDMLParser*);
~G4GDMLMessenger();
~G4GDMLMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
G4GDMLParser* myParser;
G4LogicalVolume* topvol;
G4UIdirectory* persistencyDir;
G4UIdirectory* gdmlDir;
G4UIcmdWithAString* ReaderCmd;
G4UIcmdWithAString* WriterCmd;
G4UIcmdWithAString* TopVolCmd;
G4UIcmdWithoutParameter* ClearCmd;
G4UIcmdWithABool* RegionCmd;
G4UIcmdWithABool* EcutsCmd;
G4UIcmdWithABool* SDCmd;
G4UIcmdWithABool* StripCmd;
G4UIcmdWithABool* AppendCmd;
G4GDMLParser* myParser = nullptr;
G4LogicalVolume* topvol = nullptr;
G4bool pFlag; // Append pointers to names flag
G4UIdirectory* persistencyDir = nullptr;
G4UIdirectory* gdmlDir = nullptr;
G4UIcmdWithAString* ReaderCmd = nullptr;
G4UIcmdWithAString* WriterCmd = nullptr;
G4UIcmdWithAString* TopVolCmd = nullptr;
G4UIcmdWithoutParameter* ClearCmd = nullptr;
G4UIcmdWithABool* RegionCmd = nullptr;
G4UIcmdWithABool* EcutsCmd = nullptr;
G4UIcmdWithABool* SDCmd = nullptr;
G4UIcmdWithABool* StripCmd = nullptr;
G4UIcmdWithABool* AppendCmd = nullptr;
G4bool pFlag = true; // Append pointers to names flag
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLParameterisation
// G4GDMLParameterisation
//
// Class description:
//
// GDML class for interpretation of parameterisations.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLPARAMETERISATION_INCLUDED_
#define _G4GDMLPARAMETERISATION_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLPARAMETERISATION_HH
#define G4GDMLPARAMETERISATION_HH 1
#include "G4VPVParameterisation.hh"
#include "G4VPhysicalVolume.hh"
@@ -64,42 +59,56 @@
class G4GDMLParameterisation : public G4VPVParameterisation
{
public:
public:
struct PARAMETER
{
G4RotationMatrix* pRot;
struct PARAMETER
{
G4RotationMatrix* pRot = nullptr;
G4ThreeVector position;
G4double dimension[16];
PARAMETER() : pRot(0) { memset(dimension,0,sizeof(dimension)); }
};
PARAMETER()
{
memset(dimension, 0, sizeof(dimension));
}
};
G4int GetSize() const;
void AddParameter(const PARAMETER&);
G4int GetSize() const;
void AddParameter(const PARAMETER&);
private:
private:
void ComputeTransformation(const G4int,G4VPhysicalVolume*) const;
void ComputeDimensions(G4Box&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trd&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trap&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Cons&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Sphere&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Orb&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Ellipsoid&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Torus&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Para&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Hype&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Tubs&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const;
void ComputeTransformation(const G4int, G4VPhysicalVolume*) const;
void ComputeDimensions(G4Box&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trd&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trap&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Cons&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Sphere&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Orb&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Ellipsoid&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Torus&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Para&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Hype&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Tubs&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polycone&, const G4int,
const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polyhedra&, const G4int,
const G4VPhysicalVolume*) const;
private:
std::vector<PARAMETER> parameterList;
private:
std::vector<PARAMETER> parameterList;
};
#endif
+93 -95
View File
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLParser
// G4GDMLParser
//
// Class description:
//
// GDML main parser.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLPARSER_INCLUDED_
#define _G4GDMLPARSER_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLPARSER_HH
#define G4GDMLPARSER_HH 1
#include "G4GDMLReadStructure.hh"
#include "G4GDMLWriteStructure.hh"
@@ -49,110 +44,113 @@
#include "G4Navigator.hh"
#include "G4Threading.hh"
#define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
#define G4GDML_DEFAULT_SCHEMALOCATION \
G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/" \
"schema/gdml.xsd")
class G4GDMLParser
{
public: // with description
public:
G4GDMLParser();
G4GDMLParser(G4GDMLReadStructure*);
G4GDMLParser(G4GDMLReadStructure*, G4GDMLWriteStructure*);
~G4GDMLParser();
//
// Parser constructors & destructor
G4GDMLParser();
G4GDMLParser(G4GDMLReadStructure*);
G4GDMLParser(G4GDMLReadStructure*, G4GDMLWriteStructure*);
~G4GDMLParser();
//
// Parser constructors & destructor
inline void Read(const G4String& filename, G4bool Validate=true);
//
// Imports geometry with world-volume, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void Read(const G4String& filename, G4bool Validate = true);
//
// Imports geometry with world-volume, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void ReadModule(const G4String& filename, G4bool Validate=true);
//
// Imports a single GDML module, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void ReadModule(const G4String& filename, G4bool Validate = true);
//
// Imports a single GDML module, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void Write(const G4String& filename,
const G4VPhysicalVolume* pvol = 0,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
// is guaranteed by storing pointer-references by default.
// Alternative path for the schema location can be specified; by default
// the URL to the GDML web site is used.
inline void Write( const G4String& filename,
const G4VPhysicalVolume* pvol = 0,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
// is guaranteed by storing pointer-references by default.
// Alternative path for the schema location can be specified; by default
// the URL to the GDML web site is used.
inline void Write(const G4String& filename,
const G4LogicalVolume* lvol,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
// is guaranteed by storing pointer-references by default.
// Alternative path for the schema location can be specified; by default
// the URL to the GDML web site is used. Same as method above except
// that the logical volume must be provided here.
inline void Write( const G4String& filename, const G4LogicalVolume* lvol,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
// is guaranteed by storing pointer-references by default.
// Alternative path for the schema location can be specified; by default
// the URL to the GDML web site is used. Same as method above except
// that the logical volume must be provided here.
inline G4LogicalVolume* ParseST(const G4String& name,
G4Material* medium,
G4Material* solid);
//
// Imports a tessellated geometry stored as STEP-Tools files
// 'name.geom' and 'name.tree'. It returns a pointer of a generated
// mother volume with 'medium' material associated, including the
// imported tessellated geometry with 'solid' material associated.
inline G4LogicalVolume* ParseST(const G4String& name, G4Material* medium,
G4Material* solid);
//
// Imports a tessellated geometry stored as STEP-Tools files
// 'name.geom' and 'name.tree'. It returns a pointer of a generated
// mother volume with 'medium' material associated, including the
// imported tessellated geometry with 'solid' material associated.
// Methods for Reader
//
inline G4bool IsValid(const G4String& name) const;
inline G4double GetConstant(const G4String& name) const;
inline G4double GetVariable(const G4String& name) const;
inline G4double GetQuantity(const G4String& name) const;
inline G4ThreeVector GetPosition(const G4String& name) const;
inline G4ThreeVector GetRotation(const G4String& name) const;
inline G4ThreeVector GetScale(const G4String& name) const;
inline G4GDMLMatrix GetMatrix(const G4String& name) const;
inline G4LogicalVolume* GetVolume(const G4String& name) const;
inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") const;
inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume* lvol) const;
inline const G4GDMLAuxMapType* GetAuxMap() const;
inline const G4GDMLAuxListType* GetAuxList() const;
inline void AddAuxiliary(G4GDMLAuxStructType myaux);
inline void StripNamePointers() const;
inline void SetStripFlag(G4bool);
inline void SetOverlapCheck(G4bool);
inline void SetRegionExport(G4bool);
inline void SetEnergyCutsExport(G4bool);
inline void SetSDExport(G4bool);
// Methods for Reader
inline G4int GetMaxExportLevel() const; // Manage max number of levels
inline void SetMaxExportLevel(G4int); // to export
inline G4bool IsValid(const G4String& name) const;
inline G4double GetConstant(const G4String& name) const;
inline G4double GetVariable(const G4String& name) const;
inline G4double GetQuantity(const G4String& name) const;
inline G4ThreeVector GetPosition(const G4String& name) const;
inline G4ThreeVector GetRotation(const G4String& name) const;
inline G4ThreeVector GetScale(const G4String& name) const;
inline G4GDMLMatrix GetMatrix(const G4String& name) const;
inline G4LogicalVolume* GetVolume(const G4String& name) const;
inline G4VPhysicalVolume*
GetWorldVolume(const G4String& setupName = "Default") const;
inline G4GDMLAuxListType
GetVolumeAuxiliaryInformation(G4LogicalVolume* lvol) const;
inline const G4GDMLAuxMapType* GetAuxMap() const;
inline const G4GDMLAuxListType* GetAuxList() const;
inline void AddAuxiliary(G4GDMLAuxStructType myaux);
inline void StripNamePointers() const;
inline void SetStripFlag(G4bool);
inline void SetOverlapCheck(G4bool);
inline void SetRegionExport(G4bool);
inline void SetEnergyCutsExport(G4bool);
inline void SetSDExport(G4bool);
inline void Clear(); // Clears the evaluator
inline G4int GetMaxExportLevel() const; // Manage max number of levels
inline void SetMaxExportLevel(G4int); // to export
// Methods for Writer
//
inline void AddModule(const G4VPhysicalVolume* const physvol);
inline void AddModule(const G4int depth);
inline void SetAddPointerToName(G4bool set);
inline void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const lvol);
inline void Clear(); // Clears the evaluator
// Methods for Writer
inline void AddModule(const G4VPhysicalVolume* const physvol);
inline void AddModule(const G4int depth);
inline void SetAddPointerToName(G4bool set);
inline void AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
const G4LogicalVolume* const lvol);
inline void SetOutputFileOverwrite(G4bool flag);
private:
void ImportRegions();
void ExportRegions(G4bool storeReferences = true);
void ImportRegions();
void ExportRegions(G4bool storeReferences = true);
private:
G4GDMLEvaluator eval;
G4GDMLReadStructure* reader;
G4GDMLWriteStructure* writer;
G4GDMLAuxListType *rlist, *ullist;
G4GDMLMessenger* messenger;
G4bool urcode, uwcode, strip, rexp;
G4GDMLEvaluator eval;
G4GDMLReadStructure* reader = nullptr;
G4GDMLWriteStructure* writer = nullptr;
G4GDMLAuxListType *rlist = nullptr, *ullist = nullptr;
G4GDMLMessenger* messenger = nullptr;
G4bool urcode = false, uwcode = false, strip = false, rexp = false;
};
#include "G4GDMLParser.icc"
@@ -23,148 +23,145 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4GDMLParser inline methods
//
//
//
// class G4GDMLParser inline methods
//
// -------------------------------------------------------------------------
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
inline
void G4GDMLParser::Read(const G4String& filename, G4bool validate)
{
if ( G4Threading::IsMasterThread() )
{
reader->Read(filename,validate,false,strip);
ImportRegions();
}
}
inline
void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate)
{
if ( G4Threading::IsMasterThread() )
{
reader->Read(filename,validate,true);
ImportRegions();
}
}
inline
void G4GDMLParser::Write(const G4String& filename,
const G4VPhysicalVolume* pvol,
G4bool refs,
const G4String& schemaLocation)
inline void G4GDMLParser::Read(const G4String& filename, G4bool validate)
{
if ( G4Threading::IsMasterThread() )
if(G4Threading::IsMasterThread())
{
const G4int depth = 0;
G4LogicalVolume* lvol = 0;
reader->Read(filename, validate, false, strip);
ImportRegions();
}
}
if (!pvol)
// --------------------------------------------------------------------
inline void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate)
{
if(G4Threading::IsMasterThread())
{
reader->Read(filename, validate, true);
ImportRegions();
}
}
// --------------------------------------------------------------------
inline void G4GDMLParser::Write(const G4String& filename,
const G4VPhysicalVolume* pvol, G4bool refs,
const G4String& schemaLocation)
{
if(G4Threading::IsMasterThread())
{
const G4int depth = 0;
G4LogicalVolume* lvol = nullptr;
if(pvol == nullptr)
{
lvol = G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
lvol = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking()
->GetWorldVolume()
->GetLogicalVolume();
}
else
{
lvol = pvol->GetLogicalVolume();
}
if (rexp) { ExportRegions(refs); }
writer->Write(filename,lvol,schemaLocation,depth,refs);
if(rexp)
{
ExportRegions(refs);
}
writer->Write(filename, lvol, schemaLocation, depth, refs);
}
}
inline
void G4GDMLParser::Write(const G4String& filename,
const G4LogicalVolume* lvol,
G4bool refs,
const G4String& schemaLocation)
{
if ( G4Threading::IsMasterThread() )
// --------------------------------------------------------------------
inline void G4GDMLParser::Write(const G4String& filename,
const G4LogicalVolume* lvol, G4bool refs,
const G4String& schemaLocation)
{
if(G4Threading::IsMasterThread())
{
const G4int depth = 0;
if (!lvol)
if(lvol == nullptr)
{
lvol = G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
lvol = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking()
->GetWorldVolume()
->GetLogicalVolume();
}
if (rexp) { ExportRegions(refs); }
writer->Write(filename,lvol,schemaLocation,depth,refs);
if(rexp)
{
ExportRegions(refs);
}
writer->Write(filename, lvol, schemaLocation, depth, refs);
}
}
inline
G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename,
G4Material* medium,
G4Material* solid)
{
if ( G4Threading::IsMasterThread() )
// --------------------------------------------------------------------
inline G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename,
G4Material* medium,
G4Material* solid)
{
if(G4Threading::IsMasterThread())
{
G4STRead STreader;
return STreader.Read(filename, medium, solid);
}
else
{
return 0;
return nullptr;
}
}
//
// --------------------------------------------------------------------
// Methods for Reader
//
// --------------------------------------------------------------------
inline G4bool G4GDMLParser::IsValid(const G4String& name) const
{
return reader->IsValidID(name);
}
inline
G4double G4GDMLParser::GetConstant(const G4String& name) const
inline G4double G4GDMLParser::GetConstant(const G4String& name) const
{
return reader->GetConstant(name);
}
inline
G4double G4GDMLParser::GetVariable(const G4String& name) const
inline G4double G4GDMLParser::GetVariable(const G4String& name) const
{
return reader->GetVariable(name);
}
inline
G4double G4GDMLParser::GetQuantity(const G4String& name) const
inline G4double G4GDMLParser::GetQuantity(const G4String& name) const
{
return reader->GetQuantity(name);
}
inline
G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) const
inline G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) const
{
return reader->GetPosition(name);
}
inline
G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) const
inline G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) const
{
return reader->GetRotation(name);
}
inline
G4ThreeVector G4GDMLParser::GetScale(const G4String& name) const
inline G4ThreeVector G4GDMLParser::GetScale(const G4String& name) const
{
return reader->GetScale(name);
}
inline
G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) const
inline G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) const
{
return reader->GetMatrix(name);
}
inline
G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) const
inline G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) const
{
return reader->GetVolume(name);
}
@@ -175,33 +172,28 @@ G4GDMLParser::GetWorldVolume(const G4String& setupName) const
return reader->GetWorldVolume(setupName);
}
inline
G4GDMLAuxListType
inline G4GDMLAuxListType
G4GDMLParser::GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const
{
return reader->GetVolumeAuxiliaryInformation(logvol);
}
inline
const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
inline const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
{
return reader->GetAuxMap();
}
inline
const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const
inline const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const
{
return reader->GetAuxList();
}
inline
void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux)
inline void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux)
{
return writer->AddAuxiliary(myaux);
}
inline
void G4GDMLParser::StripNamePointers() const
inline void G4GDMLParser::StripNamePointers() const
{
reader->StripNames();
}
@@ -246,31 +238,32 @@ inline void G4GDMLParser::Clear()
reader->Clear();
}
//
// --------------------------------------------------------------------
// Methods for Writer
//
// --------------------------------------------------------------------
inline
void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol)
inline void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol)
{
writer->AddModule(physvol);
}
inline
void G4GDMLParser::AddModule(const G4int depth)
inline void G4GDMLParser::AddModule(const G4int depth)
{
writer->AddModule(depth);
}
inline
void G4GDMLParser::SetAddPointerToName(G4bool set)
inline void G4GDMLParser::SetAddPointerToName(G4bool set)
{
writer->SetAddPointerToName(set);
}
inline
void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
const G4LogicalVolume* const lvol)
inline void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
const G4LogicalVolume* const lvol)
{
writer->AddVolumeAuxiliary(myaux, lvol);
}
inline void G4GDMLParser::SetOutputFileOverwrite(G4bool flag)
{
writer->SetOutputFileOverwrite(flag);
}
+84 -83
View File
@@ -23,20 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// class G4GDMLRead
// G4GDMLRead
//
// Class description:
//
// GDML reader.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLBASE_INCLUDED_
#define _G4GDMLBASE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLBASE_HH
#define G4GDMLBASE_HH 1
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
@@ -54,113 +50,118 @@ class G4VPhysicalVolume;
class G4GDMLErrorHandler : public xercesc::ErrorHandler
{
G4bool Suppress;
public:
public:
G4GDMLErrorHandler(const G4bool set) { Suppress = set; }
G4GDMLErrorHandler(const G4bool set) { Suppress = set; }
void warning(const xercesc::SAXParseException& exception)
{
if (Suppress) { return; }
void warning(const xercesc::SAXParseException& exception)
{
if(Suppress)
{
return;
}
char* message = xercesc::XMLString::transcode(exception.getMessage());
G4cout << "G4GDML: VALIDATION WARNING! " << message
<< " at line: " << exception.getLineNumber() << G4endl;
xercesc::XMLString::release(&message);
}
}
void error(const xercesc::SAXParseException& exception)
{
if (Suppress) { return; }
void error(const xercesc::SAXParseException& exception)
{
if(Suppress)
{
return;
}
char* message = xercesc::XMLString::transcode(exception.getMessage());
G4cout << "G4GDML: VALIDATION ERROR! " << message
<< " at line: " << exception.getLineNumber() << G4endl;
xercesc::XMLString::release(&message);
}
}
void fatalError(const xercesc::SAXParseException& exception)
{
void fatalError(const xercesc::SAXParseException& exception)
{
error(exception);
}
void resetErrors() {}
}
void resetErrors() {}
private:
G4bool Suppress = false;
};
class G4GDMLRead
{
public:
public: // with description
virtual void DefineRead(const xercesc::DOMElement* const) = 0;
virtual void MaterialsRead(const xercesc::DOMElement* const) = 0;
virtual void SetupRead(const xercesc::DOMElement* const) = 0;
virtual void SolidsRead(const xercesc::DOMElement* const) = 0;
virtual void Paramvol_contentRead(const xercesc::DOMElement* const) = 0;
virtual void Volume_contentRead(const xercesc::DOMElement* const) = 0;
virtual void StructureRead(const xercesc::DOMElement* const) = 0;
//
// Pure virtual methods implemented in concrete reader plugin's classes
virtual void DefineRead(const xercesc::DOMElement* const)=0;
virtual void MaterialsRead(const xercesc::DOMElement* const)=0;
virtual void SetupRead(const xercesc::DOMElement* const)=0;
virtual void SolidsRead(const xercesc::DOMElement* const)=0;
virtual void Paramvol_contentRead(const xercesc::DOMElement* const)=0;
virtual void Volume_contentRead(const xercesc::DOMElement* const)=0;
virtual void StructureRead(const xercesc::DOMElement* const)=0;
//
// Pure virtual methods implemented in concrete reader plugin's classes
virtual void ExtensionRead(const xercesc::DOMElement* const);
//
// To be implemented in the client code for handling extensions
// to the GDML schema, identified with the tag "extension".
// The implementation should be placed inside a user-class
// inheriting from G4GDMLReadStructure and being registered
// as argument to G4GDMLParser.
virtual void ExtensionRead(const xercesc::DOMElement* const);
//
// To be implemented in the client code for handling extensions
// to the GDML schema, identified with the tag "extension".
// The implementation should be placed inside a user-class
// inheriting from G4GDMLReadStructure and being registered
// as argument to G4GDMLParser.
virtual void UserinfoRead(const xercesc::DOMElement* const);
//
// Customisable by user to handle "userinfo" extensions to the
// GDML schema, identified by the tag "userinfo".
virtual void UserinfoRead(const xercesc::DOMElement* const);
//
// Customisable by user to handle "userinfo" extensions to the
// GDML schema, identified by the tag "userinfo".
virtual G4LogicalVolume* GetVolume(const G4String&) const = 0;
virtual G4String GetSetup(const G4String&) = 0;
//
// More pure virtual methods implemented in the reader plugin.
virtual G4LogicalVolume* GetVolume(const G4String&) const=0;
virtual G4String GetSetup(const G4String&)=0;
//
// More pure virtual methods implemented in the reader plugin.
void Read(const G4String&, G4bool validation, G4bool isModule,
G4bool strip = true);
//
// Main method for reading GDML files.
void Read(const G4String&, G4bool validation,
G4bool isModule, G4bool strip=true);
//
// Main method for reading GDML files.
void StripNames() const;
void StripName(G4String&) const;
//
// Strip off pointers from entity IDs.
void StripNames() const;
void StripName(G4String&) const;
//
// Strip off pointers from entity IDs.
void OverlapCheck(G4bool);
//
// Activate/de-activate surface check for overlaps (default is off).
void OverlapCheck(G4bool);
//
// Activate/de-activate surface check for overlaps (default is off)
const G4GDMLAuxListType* GetAuxList() const;
const G4GDMLAuxListType* GetAuxList() const;
protected:
protected:
G4GDMLRead();
virtual ~G4GDMLRead();
G4GDMLRead();
virtual ~G4GDMLRead();
G4String Transcode(const XMLCh* const);
G4String GenerateName(const G4String& name, G4bool strip = false);
G4String Strip(const G4String&) const;
void GeneratePhysvolName(const G4String&, G4VPhysicalVolume*);
void LoopRead(const xercesc::DOMElement* const,
void (G4GDMLRead::*)(const xercesc::DOMElement* const));
G4String Transcode(const XMLCh* const);
G4String GenerateName(const G4String& name, G4bool strip=false);
G4String Strip(const G4String&) const;
void GeneratePhysvolName(const G4String&,G4VPhysicalVolume*);
void LoopRead(const xercesc::DOMElement* const,
void(G4GDMLRead::*)(const xercesc::DOMElement* const));
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement* const auxElem);
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement* const auxElem);
protected:
protected:
G4GDMLEvaluator eval;
G4bool validate = true;
G4bool check = false;
G4bool dostrip = true;
G4GDMLEvaluator eval;
G4bool validate;
G4bool check;
G4bool dostrip;
private:
G4int inLoop, loopCount;
G4GDMLAuxListType auxGlobalList;
private:
G4int inLoop = 0, loopCount = 0;
G4GDMLAuxListType auxGlobalList;
};
#endif
@@ -23,19 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// class G4GDMLReadDefine
// G4GDMLReadDefine
//
// Class description:
//
// GDML class for positionings and transformations according to
// specifications in Geant4.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADDEFINE_INCLUDED_
#define _G4GDMLREADDEFINE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLREADDEFINE_HH
#define G4GDMLREADDEFINE_HH 1
#include <map>
@@ -46,67 +44,65 @@
class G4GDMLMatrix
{
public:
public:
G4GDMLMatrix();
G4GDMLMatrix(std::size_t rows0, std::size_t cols0);
G4GDMLMatrix(const G4GDMLMatrix& rhs);
G4GDMLMatrix& operator=(const G4GDMLMatrix& rhs);
~G4GDMLMatrix();
G4GDMLMatrix();
G4GDMLMatrix(size_t rows0,size_t cols0);
G4GDMLMatrix(const G4GDMLMatrix& rhs);
G4GDMLMatrix& operator=(const G4GDMLMatrix& rhs);
~G4GDMLMatrix();
void Set(std::size_t r, std::size_t c, G4double a);
G4double Get(std::size_t r, std::size_t c) const;
std::size_t GetRows() const;
std::size_t GetCols() const;
void Set(size_t r,size_t c,G4double a);
G4double Get(size_t r,size_t c) const;
size_t GetRows() const;
size_t GetCols() const;
private:
private:
G4double *m;
size_t rows,cols;
G4double* m = nullptr;
std::size_t rows = 0, cols = 0;
};
class G4GDMLReadDefine : public G4GDMLRead
{
public:
public:
G4bool IsValidID(const G4String&) const;
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4double GetQuantity(const G4String&);
G4ThreeVector GetPosition(const G4String&);
G4ThreeVector GetRotation(const G4String&);
G4ThreeVector GetScale(const G4String&);
G4GDMLMatrix GetMatrix(const G4String&);
G4bool IsValidID(const G4String&) const;
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4double GetQuantity(const G4String&);
G4ThreeVector GetPosition(const G4String&);
G4ThreeVector GetRotation(const G4String&);
G4ThreeVector GetScale(const G4String&);
G4GDMLMatrix GetMatrix(const G4String&);
virtual void DefineRead(const xercesc::DOMElement* const);
virtual void DefineRead(const xercesc::DOMElement* const);
protected:
protected:
G4GDMLReadDefine();
virtual ~G4GDMLReadDefine();
G4GDMLReadDefine();
virtual ~G4GDMLReadDefine();
G4RotationMatrix GetRotationMatrix(const G4ThreeVector&);
void VectorRead(const xercesc::DOMElement* const, G4ThreeVector&);
G4String RefRead(const xercesc::DOMElement* const);
G4RotationMatrix GetRotationMatrix(const G4ThreeVector&);
void VectorRead(const xercesc::DOMElement* const,G4ThreeVector&);
G4String RefRead(const xercesc::DOMElement* const);
void ConstantRead(const xercesc::DOMElement* const);
void MatrixRead(const xercesc::DOMElement* const);
void PositionRead(const xercesc::DOMElement* const);
void RotationRead(const xercesc::DOMElement* const);
void ScaleRead(const xercesc::DOMElement* const);
void VariableRead(const xercesc::DOMElement* const);
void QuantityRead(const xercesc::DOMElement* const);
void ExpressionRead(const xercesc::DOMElement* const);
void ConstantRead(const xercesc::DOMElement* const);
void MatrixRead(const xercesc::DOMElement* const);
void PositionRead(const xercesc::DOMElement* const);
void RotationRead(const xercesc::DOMElement* const);
void ScaleRead(const xercesc::DOMElement* const);
void VariableRead(const xercesc::DOMElement* const);
void QuantityRead(const xercesc::DOMElement* const);
void ExpressionRead(const xercesc::DOMElement* const);
protected:
protected:
std::map<G4String,G4double> quantityMap;
std::map<G4String,G4ThreeVector> positionMap;
std::map<G4String,G4ThreeVector> rotationMap;
std::map<G4String,G4ThreeVector> scaleMap;
std::map<G4String,G4GDMLMatrix> matrixMap;
std::map<G4String, G4double> quantityMap;
std::map<G4String, G4ThreeVector> positionMap;
std::map<G4String, G4ThreeVector> rotationMap;
std::map<G4String, G4ThreeVector> scaleMap;
std::map<G4String, G4GDMLMatrix> matrixMap;
};
#endif
@@ -23,22 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLReadMaterials
// G4GDMLReadMaterials
//
// Class description:
//
// GDML class for loading isotopes, elements and materials according to
// specifications in Geant4.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADMATERIALS_INCLUDED_
#define _G4GDMLREADMATERIALS_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLREADMATERIALS_HH
#define G4GDMLREADMATERIALS_HH 1
#include "G4Types.hh"
#include "G4GDMLReadDefine.hh"
@@ -47,36 +42,34 @@ class G4Element;
class G4Isotope;
class G4Material;
class G4GDMLReadMaterials : public G4GDMLReadDefine
class G4GDMLReadMaterials : public G4GDMLReadDefine
{
public:
public:
G4Element* GetElement(const G4String&, G4bool verbose = true) const;
G4Isotope* GetIsotope(const G4String&, G4bool verbose = true) const;
G4Material* GetMaterial(const G4String&, G4bool verbose = true) const;
G4Element* GetElement(const G4String&, G4bool verbose=true) const;
G4Isotope* GetIsotope(const G4String&, G4bool verbose=true) const;
G4Material* GetMaterial(const G4String&, G4bool verbose=true) const;
virtual void MaterialsRead(const xercesc::DOMElement* const);
virtual void MaterialsRead(const xercesc::DOMElement* const);
protected:
protected:
G4GDMLReadMaterials();
virtual ~G4GDMLReadMaterials();
G4double AtomRead(const xercesc::DOMElement* const);
G4int CompositeRead(const xercesc::DOMElement* const,G4String&);
G4double DRead(const xercesc::DOMElement* const);
G4double PRead(const xercesc::DOMElement* const);
G4double TRead(const xercesc::DOMElement* const);
G4double MEERead(const xercesc::DOMElement* const);
void ElementRead(const xercesc::DOMElement* const);
G4double FractionRead(const xercesc::DOMElement* const,G4String&);
void IsotopeRead(const xercesc::DOMElement* const);
void MaterialRead(const xercesc::DOMElement* const);
void MixtureRead(const xercesc::DOMElement* const,G4Element*);
void MixtureRead(const xercesc::DOMElement* const,G4Material*);
void PropertyRead(const xercesc::DOMElement* const,G4Material*);
G4GDMLReadMaterials();
virtual ~G4GDMLReadMaterials();
G4double AtomRead(const xercesc::DOMElement* const);
G4int CompositeRead(const xercesc::DOMElement* const, G4String&);
G4double DRead(const xercesc::DOMElement* const);
G4double PRead(const xercesc::DOMElement* const);
G4double TRead(const xercesc::DOMElement* const);
G4double MEERead(const xercesc::DOMElement* const);
void ElementRead(const xercesc::DOMElement* const);
G4double FractionRead(const xercesc::DOMElement* const, G4String&);
void IsotopeRead(const xercesc::DOMElement* const);
void MaterialRead(const xercesc::DOMElement* const);
void MixtureRead(const xercesc::DOMElement* const, G4Element*);
void MixtureRead(const xercesc::DOMElement* const, G4Material*);
void PropertyRead(const xercesc::DOMElement* const, G4Material*);
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLReadParamvol
// G4GDMLReadParamvol
//
// Class description:
//
// GDML class for importing parameterised geometrical entities.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADPARAMVOL_INCLUDED_
#define _G4GDMLREADPARAMVOL_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLREADPARAMVOL_HH
#define G4GDMLREADPARAMVOL_HH 1
#include "G4GDMLReadSetup.hh"
#include "G4GDMLParameterisation.hh"
@@ -46,51 +41,50 @@ class G4LogicalVolume;
class G4GDMLReadParamvol : public G4GDMLReadSetup
{
public:
public:
virtual void ParamvolRead(const xercesc::DOMElement* const,
G4LogicalVolume*);
virtual void Paramvol_contentRead(const xercesc::DOMElement* const);
virtual void ParamvolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
protected:
virtual void Paramvol_contentRead(const xercesc::DOMElement* const);
G4GDMLReadParamvol();
virtual ~G4GDMLReadParamvol();
protected:
void Box_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trd_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trap_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Tube_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Cone_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Sphere_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Orb_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Torus_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Ellipsoid_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Para_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Hype_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Polycone_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Polyhedra_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void ParameterisedRead(const xercesc::DOMElement* const);
G4GDMLReadParamvol();
virtual ~G4GDMLReadParamvol();
void ParametersRead(const xercesc::DOMElement* const);
void Box_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trd_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trap_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Tube_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Cone_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Sphere_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Orb_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Torus_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Ellipsoid_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Para_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Hype_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Polycone_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Polyhedra_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void ParameterisedRead(const xercesc::DOMElement* const);
protected:
void ParametersRead(const xercesc::DOMElement* const);
protected:
G4GDMLParameterisation* parameterisation;
G4GDMLParameterisation* parameterisation = nullptr;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLReadSetup
// G4GDMLReadSetup
//
// Class description:
//
// GDML class for geometry setup of solids.
// History:
// - Created. Zoltan Torzsok, November 2007
// Author: Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADSETUP_INCLUDED_
#define _G4GDMLREADSETUP_INCLUDED_
#ifndef G4GDMLREADSETUP_HH
#define G4GDMLREADSETUP_HH 1
#include <map>
@@ -47,20 +42,20 @@
class G4GDMLReadSetup : public G4GDMLReadSolids
{
public:
public:
G4String GetSetup(const G4String&);
G4String GetSetup(const G4String&);
virtual void SetupRead(const xercesc::DOMElement* const element);
virtual void SetupRead(const xercesc::DOMElement* const element);
protected:
protected:
G4GDMLReadSetup();
virtual ~G4GDMLReadSetup();
G4GDMLReadSetup();
virtual ~G4GDMLReadSetup();
protected:
protected:
std::map<G4String,G4String> setupMap;
std::map<G4String, G4String> setupMap;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLReadSolids
// G4GDMLReadSolids
//
// Class description:
//
// GDML class for loading solids according to specifications in Geant4.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADSOLIDS_INCLUDED_
#define _G4GDMLREADSOLIDS_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLREADSOLIDS_HH
#define G4GDMLREADSOLIDS_HH 1
#include "G4Types.hh"
#include "G4GDMLReadMaterials.hh"
@@ -53,66 +48,82 @@ class G4OpticalSurface;
class G4GDMLReadSolids : public G4GDMLReadMaterials
{
enum BooleanOp {UNION,SUBTRACTION,INTERSECTION};
enum BooleanOp
{
UNION,
SUBTRACTION,
INTERSECTION
};
// typedef struct { G4double rmin,rmax,z; } zplaneType;
typedef struct { G4double r,z; } rzPointType;
public:
typedef struct
{
G4double r, z;
} rzPointType;
G4VSolid* GetSolid(const G4String&) const;
G4SurfaceProperty* GetSurfaceProperty(const G4String&) const;
public:
virtual void SolidsRead(const xercesc::DOMElement* const);
G4VSolid* GetSolid(const G4String&) const;
G4SurfaceProperty* GetSurfaceProperty(const G4String&) const;
protected:
typedef struct { G4double rmin,rmax,z; } zplaneType;
G4GDMLReadSolids();
virtual ~G4GDMLReadSolids();
virtual void SolidsRead(const xercesc::DOMElement* const);
void BooleanRead(const xercesc::DOMElement* const,const BooleanOp);
void BoxRead(const xercesc::DOMElement* const);
void ConeRead(const xercesc::DOMElement* const);
void ElconeRead(const xercesc::DOMElement* const);
void EllipsoidRead(const xercesc::DOMElement* const);
void EltubeRead(const xercesc::DOMElement* const);
void XtruRead(const xercesc::DOMElement* const);
void HypeRead(const xercesc::DOMElement* const);
void MultiUnionNodeRead(const xercesc::DOMElement* const, G4MultiUnion* const);
void MultiUnionRead(const xercesc::DOMElement* const);
void OrbRead(const xercesc::DOMElement* const);
void ParaRead(const xercesc::DOMElement* const);
void ParaboloidRead(const xercesc::DOMElement* const);
void PolyconeRead(const xercesc::DOMElement* const);
void GenericPolyconeRead(const xercesc::DOMElement* const);
void PolyhedraRead(const xercesc::DOMElement* const);
void GenericPolyhedraRead(const xercesc::DOMElement* const);
G4QuadrangularFacet* QuadrangularRead(const xercesc::DOMElement* const);
void ReflectedSolidRead(const xercesc::DOMElement* const);
void ScaledSolidRead(const xercesc::DOMElement* const);
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement* const,G4double);
void SphereRead(const xercesc::DOMElement* const);
void TessellatedRead(const xercesc::DOMElement* const);
void TetRead(const xercesc::DOMElement* const);
void TorusRead(const xercesc::DOMElement* const);
void GenTrapRead(const xercesc::DOMElement* const);
void TrapRead(const xercesc::DOMElement* const);
void TrdRead(const xercesc::DOMElement* const);
void TubeRead(const xercesc::DOMElement* const);
void CutTubeRead(const xercesc::DOMElement* const);
void TwistedboxRead(const xercesc::DOMElement* const);
void TwistedtrapRead(const xercesc::DOMElement* const);
void TwistedtrdRead(const xercesc::DOMElement* const);
void TwistedtubsRead(const xercesc::DOMElement* const);
G4TriangularFacet* TriangularRead(const xercesc::DOMElement* const);
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement* const,G4double);
zplaneType ZplaneRead(const xercesc::DOMElement* const);
rzPointType RZPointRead(const xercesc::DOMElement* const);
void OpticalSurfaceRead(const xercesc::DOMElement* const);
void PropertyRead(const xercesc::DOMElement* const,G4OpticalSurface*);
protected:
private:
std::map<G4String, G4MaterialPropertyVector*> mapOfMatPropVects;
typedef struct
{
G4double rmin, rmax, z;
} zplaneType;
G4GDMLReadSolids();
virtual ~G4GDMLReadSolids();
void BooleanRead(const xercesc::DOMElement* const, const BooleanOp);
void BoxRead(const xercesc::DOMElement* const);
void ConeRead(const xercesc::DOMElement* const);
void ElconeRead(const xercesc::DOMElement* const);
void EllipsoidRead(const xercesc::DOMElement* const);
void EltubeRead(const xercesc::DOMElement* const);
void XtruRead(const xercesc::DOMElement* const);
void HypeRead(const xercesc::DOMElement* const);
void MultiUnionNodeRead(const xercesc::DOMElement* const,
G4MultiUnion* const);
void MultiUnionRead(const xercesc::DOMElement* const);
void OrbRead(const xercesc::DOMElement* const);
void ParaRead(const xercesc::DOMElement* const);
void ParaboloidRead(const xercesc::DOMElement* const);
void PolyconeRead(const xercesc::DOMElement* const);
void GenericPolyconeRead(const xercesc::DOMElement* const);
void PolyhedraRead(const xercesc::DOMElement* const);
void GenericPolyhedraRead(const xercesc::DOMElement* const);
G4QuadrangularFacet* QuadrangularRead(const xercesc::DOMElement* const);
void ReflectedSolidRead(const xercesc::DOMElement* const);
void ScaledSolidRead(const xercesc::DOMElement* const);
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement* const,
G4double);
void SphereRead(const xercesc::DOMElement* const);
void TessellatedRead(const xercesc::DOMElement* const);
void TetRead(const xercesc::DOMElement* const);
void TorusRead(const xercesc::DOMElement* const);
void GenTrapRead(const xercesc::DOMElement* const);
void TrapRead(const xercesc::DOMElement* const);
void TrdRead(const xercesc::DOMElement* const);
void TubeRead(const xercesc::DOMElement* const);
void CutTubeRead(const xercesc::DOMElement* const);
void TwistedboxRead(const xercesc::DOMElement* const);
void TwistedtrapRead(const xercesc::DOMElement* const);
void TwistedtrdRead(const xercesc::DOMElement* const);
void TwistedtubsRead(const xercesc::DOMElement* const);
G4TriangularFacet* TriangularRead(const xercesc::DOMElement* const);
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement* const, G4double);
zplaneType ZplaneRead(const xercesc::DOMElement* const);
rzPointType RZPointRead(const xercesc::DOMElement* const);
void OpticalSurfaceRead(const xercesc::DOMElement* const);
void PropertyRead(const xercesc::DOMElement* const, G4OpticalSurface*);
private:
std::map<G4String, G4MaterialPropertyVector*> mapOfMatPropVects;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLReadStructure
// G4GDMLReadStructure
//
// Class description:
//
// GDML class for import of structures.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADSTRUCTURE_INCLUDED_
#define _G4GDMLREADSTRUCTURE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLREADSTRUCTURE_HH
#define G4GDMLREADSTRUCTURE_HH 1
#include "G4Types.hh"
#include "geomdefs.hh"
@@ -48,51 +43,50 @@ class G4AssemblyVolume;
class G4LogicalVolume;
class G4VPhysicalVolume;
typedef std::map<G4LogicalVolume*,G4GDMLAuxListType> G4GDMLAuxMapType;
typedef std::map<G4String, G4AssemblyVolume*> G4GDMLAssemblyMapType;
using G4GDMLAuxMapType = std::map<G4LogicalVolume*, G4GDMLAuxListType>;
using G4GDMLAssemblyMapType = std::map<G4String, G4AssemblyVolume*>;
class G4GDMLReadStructure : public G4GDMLReadParamvol
{
public:
public:
G4GDMLReadStructure();
virtual ~G4GDMLReadStructure();
G4GDMLReadStructure();
virtual ~G4GDMLReadStructure();
G4VPhysicalVolume* GetPhysvol(const G4String&) const;
G4LogicalVolume* GetVolume(const G4String&) const;
G4AssemblyVolume* GetAssembly(const G4String&) const;
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume*) const;
G4VPhysicalVolume* GetWorldVolume(const G4String&);
const G4GDMLAuxMapType* GetAuxMap() const { return &auxMap; }
void Clear(); // Clears internal map and evaluator
G4VPhysicalVolume* GetPhysvol(const G4String&) const;
G4LogicalVolume* GetVolume(const G4String&) const;
G4AssemblyVolume* GetAssembly(const G4String&) const;
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume*) const;
G4VPhysicalVolume* GetWorldVolume(const G4String&);
const G4GDMLAuxMapType* GetAuxMap() const {return &auxMap;}
void Clear(); // Clears internal map and evaluator
virtual void VolumeRead(const xercesc::DOMElement* const);
virtual void Volume_contentRead(const xercesc::DOMElement* const);
virtual void StructureRead(const xercesc::DOMElement* const);
virtual void VolumeRead(const xercesc::DOMElement* const);
virtual void Volume_contentRead(const xercesc::DOMElement* const);
virtual void StructureRead(const xercesc::DOMElement* const);
protected:
protected:
void AssemblyRead(const xercesc::DOMElement* const);
void DivisionvolRead(const xercesc::DOMElement* const);
G4LogicalVolume* FileRead(const xercesc::DOMElement* const);
void PhysvolRead(const xercesc::DOMElement* const,
G4AssemblyVolume* assembly = 0);
void ReplicavolRead(const xercesc::DOMElement* const, G4int number);
void ReplicaRead(const xercesc::DOMElement* const replicaElement,
G4LogicalVolume* logvol, G4int number);
EAxis AxisRead(const xercesc::DOMElement* const axisElement);
G4double QuantityRead(const xercesc::DOMElement* const readElement);
void BorderSurfaceRead(const xercesc::DOMElement* const);
void SkinSurfaceRead(const xercesc::DOMElement* const);
void AssemblyRead(const xercesc::DOMElement* const);
void DivisionvolRead(const xercesc::DOMElement* const);
G4LogicalVolume* FileRead(const xercesc::DOMElement* const);
void PhysvolRead(const xercesc::DOMElement* const,
G4AssemblyVolume* assembly=0);
void ReplicavolRead(const xercesc::DOMElement* const, G4int number);
void ReplicaRead(const xercesc::DOMElement* const replicaElement,
G4LogicalVolume* logvol,G4int number);
EAxis AxisRead(const xercesc::DOMElement* const axisElement);
G4double QuantityRead(const xercesc::DOMElement* const readElement);
void BorderSurfaceRead(const xercesc::DOMElement* const);
void SkinSurfaceRead(const xercesc::DOMElement* const);
protected:
protected:
G4GDMLAuxMapType auxMap;
G4GDMLAssemblyMapType assemblyMap;
G4LogicalVolume *pMotherLogical;
std::map<std::string, G4VPhysicalVolume*> setuptoPV;
G4bool strip;
G4GDMLAuxMapType auxMap;
G4GDMLAssemblyMapType assemblyMap;
G4LogicalVolume* pMotherLogical = nullptr;
std::map<std::string, G4VPhysicalVolume*> setuptoPV;
G4bool strip = false;
};
#endif
+45 -44
View File
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWrite
// G4GDMLWrite
//
// Class description:
//
// GDML writer.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITE_INCLUDED_
#define _G4GDMLWRITE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITE_HH
#define G4GDMLWRITE_HH 1
#include <map>
@@ -55,56 +50,60 @@ class G4VPhysicalVolume;
class G4GDMLWrite
{
typedef std::map<const G4LogicalVolume*,G4Transform3D> VolumeMapType;
typedef std::map<const G4VPhysicalVolume*,G4String> PhysVolumeMapType;
typedef std::map<G4int,G4int> DepthMapType;
using VolumeMapType = std::map<const G4LogicalVolume*, G4Transform3D>;
using PhysVolumeMapType = std::map<const G4VPhysicalVolume*, G4String>;
using DepthMapType = std::map<G4int, G4int>;
public: // with description
public:
G4Transform3D Write(const G4String& filename,
const G4LogicalVolume* const topLog,
const G4String& schemaPath,
const G4int depth, G4bool storeReferences=true);
//
// Main method for writing GDML files.
const G4String& schemaPath, const G4int depth,
G4bool storeReferences = true);
//
// Main method for writing GDML files.
void AddModule(const G4VPhysicalVolume* const topVol);
void AddModule(const G4int depth);
//
// Split geometry structure in modules, by volume subtree or level
//
// Split geometry structure in modules, by volume subtree or level.
void AddAuxiliary(G4GDMLAuxStructType myaux);
//
// Import auxiliary structure
//
// Import auxiliary structure.
void SetOutputFileOverwrite(G4bool flag);
//
// Set the flag to allow overwriting of the output GDML file
static void SetAddPointerToName(G4bool);
//
// Specify if to add or not memory addresses to IDs.
//
// Specify if to add or not memory addresses to IDs.
virtual void DefineWrite(xercesc::DOMElement*)=0;
virtual void MaterialsWrite(xercesc::DOMElement*)=0;
virtual void SolidsWrite(xercesc::DOMElement*)=0;
virtual void StructureWrite(xercesc::DOMElement*)=0;
virtual void DefineWrite(xercesc::DOMElement*) = 0;
virtual void MaterialsWrite(xercesc::DOMElement*) = 0;
virtual void SolidsWrite(xercesc::DOMElement*) = 0;
virtual void StructureWrite(xercesc::DOMElement*) = 0;
virtual G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const,
const G4int)=0;
virtual void SurfacesWrite()=0;
const G4int) = 0;
virtual void SurfacesWrite() = 0;
virtual void SetupWrite(xercesc::DOMElement*,
const G4LogicalVolume* const)=0;
//
// Pure virtual methods implemented in concrete writer plugin's classes
const G4LogicalVolume* const) = 0;
//
// Pure virtual methods implemented in concrete writer plugin's classes.
virtual void ExtensionWrite(xercesc::DOMElement*);
virtual void UserinfoWrite(xercesc::DOMElement*);
virtual void AddExtension(xercesc::DOMElement*,
const G4LogicalVolume* const);
//
// To be implemented in the client code for handling extensions
// to the GDML schema, identified with the tag "extension".
// The implementation should be placed inside a user-class
// inheriting from G4GDMLWriteStructure and being registered
// as argument to G4GDMLParser.
//
// To be implemented in the client code for handling extensions
// to the GDML schema, identified with the tag "extension".
// The implementation should be placed inside a user-class
// inheriting from G4GDMLWriteStructure and being registered
// as argument to G4GDMLParser.
G4String GenerateName(const G4String&,const void* const);
G4String GenerateName(const G4String&, const void* const);
protected:
@@ -119,7 +118,8 @@ class G4GDMLWrite
G4String Modularize(const G4VPhysicalVolume* const topvol,
const G4int depth);
void AddAuxInfo(G4GDMLAuxListType* auxInfoList, xercesc::DOMElement* element);
void AddAuxInfo(G4GDMLAuxListType* auxInfoList,
xercesc::DOMElement* element);
G4bool FileExists(const G4String&) const;
PhysVolumeMapType& PvolumeMap();
@@ -129,11 +129,12 @@ class G4GDMLWrite
G4String SchemaLocation;
static G4bool addPointerToName;
xercesc::DOMDocument* doc;
xercesc::DOMElement* extElement;
xercesc::DOMElement* userinfoElement;
xercesc::DOMDocument* doc = nullptr;
xercesc::DOMElement* extElement = nullptr;
xercesc::DOMElement* userinfoElement = nullptr;
XMLCh tempStr[10000];
G4GDMLAuxListType auxList;
G4bool overwriteOutputFile = false;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteDefine
// G4GDMLWriteDefine
//
// Class description:
//
// GDML writer class for positionings and transformations.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITEDEFINE_INCLUDED_
#define _G4GDMLWRITEDEFINE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITEDEFINE_HH
#define G4GDMLWRITEDEFINE_HH 1
#include "G4Types.hh"
#include "G4ThreeVector.hh"
@@ -47,27 +42,38 @@
class G4GDMLWriteDefine : public G4GDMLWrite
{
public:
G4ThreeVector GetAngles(const G4RotationMatrix&);
void ScaleWrite(xercesc::DOMElement* element,
const G4String& name, const G4ThreeVector& scl)
{ Scale_vectorWrite(element,"scale",name,scl); }
void RotationWrite(xercesc::DOMElement* element,
const G4String& name, const G4ThreeVector& rot)
{ Rotation_vectorWrite(element,"rotation",name,rot); }
void PositionWrite(xercesc::DOMElement* element,
const G4String& name, const G4ThreeVector& pos)
{ Position_vectorWrite(element,"position",name,pos); }
void FirstrotationWrite(xercesc::DOMElement* element,
const G4String& name, const G4ThreeVector& rot)
{ Rotation_vectorWrite(element,"firstrotation",name,rot); }
void FirstpositionWrite(xercesc::DOMElement* element,
const G4String& name, const G4ThreeVector& pos)
{ Position_vectorWrite(element,"firstposition",name,pos); }
void ScaleWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& scl)
{
Scale_vectorWrite(element, "scale", name, scl);
}
void RotationWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& rot)
{
Rotation_vectorWrite(element, "rotation", name, rot);
}
void PositionWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& pos)
{
Position_vectorWrite(element, "position", name, pos);
}
void FirstrotationWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& rot)
{
Rotation_vectorWrite(element, "firstrotation", name, rot);
}
void FirstpositionWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& pos)
{
Position_vectorWrite(element, "firstposition", name, pos);
}
void AddPosition(const G4String& name, const G4ThreeVector& pos)
{ Position_vectorWrite(defineElement,"position",name,pos); }
{
Position_vectorWrite(defineElement, "position", name, pos);
}
virtual void DefineWrite(xercesc::DOMElement*);
@@ -77,7 +83,7 @@ class G4GDMLWriteDefine : public G4GDMLWrite
virtual ~G4GDMLWriteDefine();
void Scale_vectorWrite(xercesc::DOMElement*, const G4String&,
const G4String&, const G4ThreeVector&);
const G4String&, const G4ThreeVector&);
void Rotation_vectorWrite(xercesc::DOMElement*, const G4String&,
const G4String&, const G4ThreeVector&);
void Position_vectorWrite(xercesc::DOMElement*, const G4String&,
@@ -88,9 +94,8 @@ class G4GDMLWriteDefine : public G4GDMLWrite
static const G4double kRelativePrecision;
static const G4double kAngularPrecision;
static const G4double kLinearPrecision;
xercesc::DOMElement* defineElement;
xercesc::DOMElement* defineElement = nullptr;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteMaterials
// G4GDMLWriteMaterials
//
// Class description:
//
// GDML class for writing materials definitions.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITEMATERIALS_INCLUDED_
#define _G4GDMLWRITEMATERIALS_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITEMATERIALS_HH
#define G4GDMLWRITEMATERIALS_HH 1
#include "G4Types.hh"
#include <vector>
@@ -52,40 +47,40 @@ class G4MaterialPropertiesTable;
class G4GDMLWriteMaterials : public G4GDMLWriteDefine
{
public:
public:
void AddIsotope(const G4Isotope* const);
void AddElement(const G4Element* const);
void AddMaterial(const G4Material* const);
void AddIsotope(const G4Isotope* const);
void AddElement(const G4Element* const);
void AddMaterial(const G4Material* const);
virtual void MaterialsWrite(xercesc::DOMElement*);
virtual void MaterialsWrite(xercesc::DOMElement*);
protected:
protected:
G4GDMLWriteMaterials();
virtual ~G4GDMLWriteMaterials();
G4GDMLWriteMaterials();
virtual ~G4GDMLWriteMaterials();
void AtomWrite(xercesc::DOMElement*, const G4double&);
void DWrite(xercesc::DOMElement*, const G4double&);
void PWrite(xercesc::DOMElement*, const G4double&);
void TWrite(xercesc::DOMElement*, const G4double&);
void MEEWrite(xercesc::DOMElement*, const G4double&);
void IsotopeWrite(const G4Isotope* const);
void ElementWrite(const G4Element* const);
void MaterialWrite(const G4Material* const);
void PropertyWrite(xercesc::DOMElement*, const G4Material* const);
void PropertyVectorWrite(const G4String&,
const G4PhysicsOrderedFreeVector* const);
void PropertyConstWrite(const G4String&, const G4double,
const G4MaterialPropertiesTable*);
void AtomWrite(xercesc::DOMElement*,const G4double&);
void DWrite(xercesc::DOMElement*,const G4double&);
void PWrite(xercesc::DOMElement*,const G4double&);
void TWrite(xercesc::DOMElement*,const G4double&);
void MEEWrite(xercesc::DOMElement*,const G4double&);
void IsotopeWrite(const G4Isotope* const);
void ElementWrite(const G4Element* const);
void MaterialWrite(const G4Material* const);
void PropertyWrite(xercesc::DOMElement*, const G4Material* const);
void PropertyVectorWrite(const G4String&,
const G4PhysicsOrderedFreeVector* const);
void PropertyConstWrite(const G4String&,
const G4double, const G4MaterialPropertiesTable*);
protected:
protected:
std::vector<const G4Isotope*> isotopeList;
std::vector<const G4Element*> elementList;
std::vector<const G4Material*> materialList;
std::vector<const G4PhysicsOrderedFreeVector*> propertyList;
xercesc::DOMElement* materialsElement;
std::vector<const G4Isotope*> isotopeList;
std::vector<const G4Element*> elementList;
std::vector<const G4Material*> materialList;
std::vector<const G4PhysicsOrderedFreeVector*> propertyList;
xercesc::DOMElement* materialsElement = nullptr;
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteParamvol
// G4GDMLWriteParamvol
//
// Class description:
//
// GDML class for writing parameterised entities dimensions.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITEPARAMVOL_INCLUDED_
#define _G4GDMLWRITEPARAMVOL_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITEPARAMVOL_HH
#define G4GDMLWRITEPARAMVOL_HH 1
#include "G4GDMLWriteSetup.hh"
@@ -58,35 +53,36 @@ class G4VPhysicalVolume;
class G4GDMLWriteParamvol : public G4GDMLWriteSetup
{
public:
public:
virtual void ParamvolWrite(xercesc::DOMElement*,
const G4VPhysicalVolume* const);
virtual void ParamvolAlgorithmWrite(xercesc::DOMElement* paramvolElement,
const G4VPhysicalVolume* const paramvol);
virtual void ParamvolWrite(xercesc::DOMElement*,
const G4VPhysicalVolume* const);
virtual void ParamvolAlgorithmWrite(xercesc::DOMElement* paramvolElement,
const G4VPhysicalVolume* const paramvol);
protected:
protected:
G4GDMLWriteParamvol();
virtual ~G4GDMLWriteParamvol();
void Box_dimensionsWrite(xercesc::DOMElement*, const G4Box* const);
void Trd_dimensionsWrite(xercesc::DOMElement*, const G4Trd* const);
void Trap_dimensionsWrite(xercesc::DOMElement*, const G4Trap* const);
void Tube_dimensionsWrite(xercesc::DOMElement*, const G4Tubs* const);
void Cone_dimensionsWrite(xercesc::DOMElement*, const G4Cons* const);
void Sphere_dimensionsWrite(xercesc::DOMElement*, const G4Sphere* const);
void Orb_dimensionsWrite(xercesc::DOMElement*, const G4Orb* const);
void Torus_dimensionsWrite(xercesc::DOMElement*, const G4Torus* const);
void Ellipsoid_dimensionsWrite(xercesc::DOMElement*, const G4Ellipsoid* const);
void Para_dimensionsWrite(xercesc::DOMElement*, const G4Para* const);
void Hype_dimensionsWrite(xercesc::DOMElement*, const G4Hype* const);
void Polycone_dimensionsWrite(xercesc::DOMElement*, const G4Polycone* const);
void Polyhedra_dimensionsWrite(xercesc::DOMElement*, const G4Polyhedra* const);
void ParametersWrite(xercesc::DOMElement*,
const G4VPhysicalVolume* const, const G4int&);
G4GDMLWriteParamvol();
virtual ~G4GDMLWriteParamvol();
void Box_dimensionsWrite(xercesc::DOMElement*, const G4Box* const);
void Trd_dimensionsWrite(xercesc::DOMElement*, const G4Trd* const);
void Trap_dimensionsWrite(xercesc::DOMElement*, const G4Trap* const);
void Tube_dimensionsWrite(xercesc::DOMElement*, const G4Tubs* const);
void Cone_dimensionsWrite(xercesc::DOMElement*, const G4Cons* const);
void Sphere_dimensionsWrite(xercesc::DOMElement*, const G4Sphere* const);
void Orb_dimensionsWrite(xercesc::DOMElement*, const G4Orb* const);
void Torus_dimensionsWrite(xercesc::DOMElement*, const G4Torus* const);
void Ellipsoid_dimensionsWrite(xercesc::DOMElement*,
const G4Ellipsoid* const);
void Para_dimensionsWrite(xercesc::DOMElement*, const G4Para* const);
void Hype_dimensionsWrite(xercesc::DOMElement*, const G4Hype* const);
void Polycone_dimensionsWrite(xercesc::DOMElement*,
const G4Polycone* const);
void Polyhedra_dimensionsWrite(xercesc::DOMElement*,
const G4Polyhedra* const);
void ParametersWrite(xercesc::DOMElement*, const G4VPhysicalVolume* const,
const G4int&);
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteSetup
// G4GDMLWriteSetup
//
// Class description:
//
// GDML writer class for geometry setup of volumes.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITESETUP_INCLUDED_
#define _G4GDMLWRITESETUP_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITESETUP_HH
#define G4GDMLWRITESETUP_HH 1
#include "G4GDMLWriteSolids.hh"
@@ -47,11 +42,10 @@ class G4GDMLWriteSetup : public G4GDMLWriteSolids
virtual void SetupWrite(xercesc::DOMElement*, const G4LogicalVolume* const);
protected:
G4GDMLWriteSetup();
virtual ~G4GDMLWriteSetup();
protected:
G4GDMLWriteSetup();
virtual ~G4GDMLWriteSetup();
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteSolids
// G4GDMLWriteSolids
//
// Class description:
//
// GDML class for writing solids.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITESOLIDS_INCLUDED_
#define _G4GDMLWRITESOLIDS_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITESOLIDS_HH
#define G4GDMLWRITESOLIDS_HH 1
#include "G4Types.hh"
@@ -81,75 +76,77 @@ class G4GDMLWriteSolids : public G4GDMLWriteMaterials
{
public:
G4bool operator()(const G4ThreeVector& t1, const G4ThreeVector& t2 ) const
{
if(t1.x() < t2.x())
return true;
G4bool operator()(const G4ThreeVector& t1, const G4ThreeVector& t2) const
{
if(t1.x() < t2.x())
return true;
if(t1.y() < t2.y())
return true;
if(t1.y() < t2.y())
return true;
if(t1.z() < t2.z())
return true;
if(t1.z() < t2.z())
return true;
return false;
}
return false;
}
};
public:
virtual void AddSolid(const G4VSolid* const);
virtual void SolidsWrite(xercesc::DOMElement*);
virtual void AddSolid(const G4VSolid* const);
virtual void SolidsWrite(xercesc::DOMElement*);
protected:
G4GDMLWriteSolids();
virtual ~G4GDMLWriteSolids();
void MultiUnionWrite(xercesc::DOMElement* solElement, const G4MultiUnion* const);
void BooleanWrite(xercesc::DOMElement*, const G4BooleanSolid* const);
void ScaledWrite(xercesc::DOMElement*, const G4ScaledSolid* const);
void BoxWrite(xercesc::DOMElement*, const G4Box* const);
void ConeWrite(xercesc::DOMElement*, const G4Cons* const);
void ElconeWrite(xercesc::DOMElement*, const G4EllipticalCone* const);
void EllipsoidWrite(xercesc::DOMElement*, const G4Ellipsoid* const);
void EltubeWrite(xercesc::DOMElement*, const G4EllipticalTube* const);
void XtruWrite(xercesc::DOMElement*, const G4ExtrudedSolid* const);
void HypeWrite(xercesc::DOMElement*, const G4Hype* const);
void OrbWrite(xercesc::DOMElement*, const G4Orb* const);
void ParaWrite(xercesc::DOMElement*, const G4Para* const);
void ParaboloidWrite(xercesc::DOMElement*, const G4Paraboloid* const);
void PolyconeWrite(xercesc::DOMElement*, const G4Polycone* const);
void GenericPolyconeWrite(xercesc::DOMElement*, const G4GenericPolycone* const);
void PolyhedraWrite(xercesc::DOMElement*, const G4Polyhedra* const);
void SphereWrite(xercesc::DOMElement*, const G4Sphere* const);
void TessellatedWrite(xercesc::DOMElement*, const G4TessellatedSolid* const);
void TetWrite(xercesc::DOMElement*, const G4Tet* const);
void TorusWrite(xercesc::DOMElement*, const G4Torus* const);
void GenTrapWrite(xercesc::DOMElement*, const G4GenericTrap* const);
void TrapWrite(xercesc::DOMElement*, const G4Trap* const);
void TrdWrite(xercesc::DOMElement*, const G4Trd* const);
void TubeWrite(xercesc::DOMElement*, const G4Tubs* const);
void CutTubeWrite(xercesc::DOMElement*, const G4CutTubs* const);
void TwistedboxWrite(xercesc::DOMElement*, const G4TwistedBox* const);
void TwistedtrapWrite(xercesc::DOMElement*, const G4TwistedTrap* const);
void TwistedtrdWrite(xercesc::DOMElement*, const G4TwistedTrd* const);
void TwistedtubsWrite(xercesc::DOMElement*, const G4TwistedTubs* const);
void ZplaneWrite(xercesc::DOMElement*, const G4double&,
const G4double&, const G4double&);
void RZPointWrite(xercesc::DOMElement*, const G4double&,const G4double&);
void OpticalSurfaceWrite(xercesc::DOMElement*,
const G4OpticalSurface* const);
void PropertyWrite(xercesc::DOMElement*, const G4OpticalSurface* const);
G4GDMLWriteSolids();
virtual ~G4GDMLWriteSolids();
void MultiUnionWrite(xercesc::DOMElement* solElement,
const G4MultiUnion* const);
void BooleanWrite(xercesc::DOMElement*, const G4BooleanSolid* const);
void ScaledWrite(xercesc::DOMElement*, const G4ScaledSolid* const);
void BoxWrite(xercesc::DOMElement*, const G4Box* const);
void ConeWrite(xercesc::DOMElement*, const G4Cons* const);
void ElconeWrite(xercesc::DOMElement*, const G4EllipticalCone* const);
void EllipsoidWrite(xercesc::DOMElement*, const G4Ellipsoid* const);
void EltubeWrite(xercesc::DOMElement*, const G4EllipticalTube* const);
void XtruWrite(xercesc::DOMElement*, const G4ExtrudedSolid* const);
void HypeWrite(xercesc::DOMElement*, const G4Hype* const);
void OrbWrite(xercesc::DOMElement*, const G4Orb* const);
void ParaWrite(xercesc::DOMElement*, const G4Para* const);
void ParaboloidWrite(xercesc::DOMElement*, const G4Paraboloid* const);
void PolyconeWrite(xercesc::DOMElement*, const G4Polycone* const);
void GenericPolyconeWrite(xercesc::DOMElement*,
const G4GenericPolycone* const);
void PolyhedraWrite(xercesc::DOMElement*, const G4Polyhedra* const);
void SphereWrite(xercesc::DOMElement*, const G4Sphere* const);
void TessellatedWrite(xercesc::DOMElement*,
const G4TessellatedSolid* const);
void TetWrite(xercesc::DOMElement*, const G4Tet* const);
void TorusWrite(xercesc::DOMElement*, const G4Torus* const);
void GenTrapWrite(xercesc::DOMElement*, const G4GenericTrap* const);
void TrapWrite(xercesc::DOMElement*, const G4Trap* const);
void TrdWrite(xercesc::DOMElement*, const G4Trd* const);
void TubeWrite(xercesc::DOMElement*, const G4Tubs* const);
void CutTubeWrite(xercesc::DOMElement*, const G4CutTubs* const);
void TwistedboxWrite(xercesc::DOMElement*, const G4TwistedBox* const);
void TwistedtrapWrite(xercesc::DOMElement*, const G4TwistedTrap* const);
void TwistedtrdWrite(xercesc::DOMElement*, const G4TwistedTrd* const);
void TwistedtubsWrite(xercesc::DOMElement*, const G4TwistedTubs* const);
void ZplaneWrite(xercesc::DOMElement*, const G4double&, const G4double&,
const G4double&);
void RZPointWrite(xercesc::DOMElement*, const G4double&, const G4double&);
void OpticalSurfaceWrite(xercesc::DOMElement*,
const G4OpticalSurface* const);
void PropertyWrite(xercesc::DOMElement*, const G4OpticalSurface* const);
protected:
std::vector<const G4VSolid*> solidList;
xercesc::DOMElement* solidsElement;
static const G4int maxTransforms = 8; // Constant for limiting the number
// of displacements/reflections
// applied to a single solid
std::vector<const G4VSolid*> solidList;
xercesc::DOMElement* solidsElement = nullptr;
static const G4int maxTransforms = 8; // Constant for limiting the number
// of displacements/reflections
// applied to a single solid
};
#endif
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4GDMLWriteStructure
// G4GDMLWriteStructure
//
// Class description:
//
// GDML class for export of structures.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITESTRUCTURE_INCLUDED_
#define _G4GDMLWRITESTRUCTURE_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4GDMLWRITESTRUCTURE_HH
#define G4GDMLWRITESTRUCTURE_HH 1
#include "G4Types.hh"
#include "G4Transform3D.hh"
@@ -55,58 +50,70 @@ class G4AssemblyTriplet;
class G4GDMLWriteStructure : public G4GDMLWriteParamvol
{
public:
public:
G4GDMLWriteStructure();
virtual ~G4GDMLWriteStructure();
G4GDMLWriteStructure();
virtual ~G4GDMLWriteStructure();
virtual void StructureWrite(xercesc::DOMElement*);
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
const G4LogicalVolume* const);
virtual void StructureWrite(xercesc::DOMElement*);
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const);
void SetEnergyCutsExport(G4bool);
void SetSDExport(G4bool);
void SetEnergyCutsExport(G4bool);
void SetSDExport(G4bool);
G4int GetMaxExportLevel() const;
void SetMaxExportLevel(G4int);
G4int GetMaxExportLevel() const;
void SetMaxExportLevel(G4int);
protected:
protected:
void DivisionvolWrite(xercesc::DOMElement*, const G4PVDivision* const);
void PhysvolWrite(xercesc::DOMElement*,
const G4VPhysicalVolume* const topVol,
const G4Transform3D& transform,
const G4String& moduleName);
void ReplicavolWrite(xercesc::DOMElement*, const G4VPhysicalVolume* const);
void AssemblyWrite(xercesc::DOMElement*, const int assemblyID);
G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const topVol,
const G4int depth);
void SurfacesWrite();
void BorderSurfaceCache(const G4LogicalBorderSurface* const);
void SkinSurfaceCache(const G4LogicalSkinSurface* const);
const G4LogicalBorderSurface* GetBorderSurface(
const G4VPhysicalVolume* const);
const G4LogicalSkinSurface* GetSkinSurface(const G4LogicalVolume* const);
G4bool FindOpticalSurface(const G4SurfaceProperty*);
void ExportEnergyCuts(const G4LogicalVolume* const);
void ExportSD(const G4LogicalVolume* const);
void DivisionvolWrite(xercesc::DOMElement*, const G4PVDivision* const);
void PhysvolWrite(xercesc::DOMElement*,const G4VPhysicalVolume* const topVol,
const G4Transform3D& transform, const G4String& moduleName);
void ReplicavolWrite(xercesc::DOMElement*, const G4VPhysicalVolume* const);
void AssemblyWrite(xercesc::DOMElement*, const int assemblyID);
G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const topVol,
const G4int depth);
void SurfacesWrite();
void BorderSurfaceCache(const G4LogicalBorderSurface* const);
void SkinSurfaceCache(const G4LogicalSkinSurface* const);
const G4LogicalBorderSurface* GetBorderSurface(const G4VPhysicalVolume* const);
const G4LogicalSkinSurface* GetSkinSurface(const G4LogicalVolume* const);
G4bool FindOpticalSurface(const G4SurfaceProperty*);
void ExportEnergyCuts(const G4LogicalVolume* const);
void ExportSD(const G4LogicalVolume* const);
protected:
protected:
xercesc::DOMElement* structureElement = nullptr;
std::vector<xercesc::DOMElement*> borderElementVec;
std::vector<xercesc::DOMElement*> skinElementVec;
std::map<const G4LogicalVolume*, G4GDMLAuxListType> auxmap;
xercesc::DOMElement* structureElement;
std::vector<xercesc::DOMElement*> borderElementVec;
std::vector<xercesc::DOMElement*> skinElementVec;
std::map<const G4LogicalVolume*, G4GDMLAuxListType> auxmap;
private: // cache for optical surfaces...
private: // cache for optical surfaces...
std::vector<const G4OpticalSurface*> opt_vec;
std::vector<const G4OpticalSurface*> opt_vec;
G4ReflectionFactory* reflFactory;
G4bool cexport; // Flag for optional export of energy cuts per volume
G4bool sdexport; // Flag for optional export of SD per volume
G4int maxLevel; // Maximum number of levels to export
static G4int levelNo; // Counter for level being exported
std::map<const G4VPhysicalVolume*, G4int> assemblyVolMap; // Map of phys volumes to assembly IDs
std::map<const G4VPhysicalVolume*, G4int> imprintsMap; // Map of phys volumes to imprints IDs
std::vector<int> addedAssemblies; // vector of assemblies IDs already added to the structure
G4ReflectionFactory* reflFactory = nullptr;
G4bool cexport = false;
// Flag for optional export of energy cuts per volume
G4bool sdexport= false;
// Flag for optional export of SD per volume
G4int maxLevel = 0;
// Maximum number of levels to export
static G4int levelNo;
// Counter for level being exported
std::map<const G4VPhysicalVolume*, G4int> assemblyVolMap;
// Map of phys volumes to assembly IDs
std::map<const G4VPhysicalVolume*, G4int> imprintsMap;
// Map of phys volumes to imprints IDs
std::vector<G4int> addedAssemblies;
// Vector of assemblies IDs already added to the structure
};
#endif
+13 -16
View File
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4STRead
// G4STRead
//
// Class description:
//
@@ -34,12 +31,10 @@
// (.geom and .tree structures) generated out of STEP files from
// CAD systems (STWriter STEP Tool and similar...).
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4STREAD_INCLUDED_
#define _G4STREAD_INCLUDED_
// Author: Zoltan Torzsok, November 2007
// --------------------------------------------------------------------
#ifndef G4STREAD_HH
#define G4STREAD_HH 1
#include <vector>
#include <map>
@@ -53,10 +48,11 @@ class G4LogicalVolume;
class G4STRead
{
public: // with description
public:
G4LogicalVolume* Read(const G4String&, G4Material* mediumMaterial,
G4Material* solidMaterial);
G4Material* solidMaterial);
private:
void TessellatedRead(const std::string&);
@@ -67,12 +63,13 @@ class G4STRead
private:
G4Box* world_box;
G4Box* world_box = nullptr;
G4ThreeVector world_extent;
G4Material* solid_material;
G4LogicalVolume* world_volume;
G4Material* solid_material = nullptr;
G4LogicalVolume* world_volume = nullptr;
std::vector<G4TessellatedSolid*> tessellatedList;
std::map<G4TessellatedSolid*,G4LogicalVolume*> volumeMap;
std::map<G4TessellatedSolid*, G4LogicalVolume*> volumeMap;
};
#endif