Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
//
// struct G4GDMLAuxStructType
// History:
// - Created. Witold Pokorski, March 2015
// -------------------------------------------------------------------------
#ifndef _G4GDMLAUXSTRUCTTYPE_INCLUDED_
#define _G4GDMLAUXSTRUCTTYPE_INCLUDED_
#include <vector>
struct G4GDMLAuxStructType
{
G4String type;
G4String value;
G4String unit;
std::vector<G4GDMLAuxStructType>* auxList;
};
typedef std::vector<G4GDMLAuxStructType> G4GDMLAuxListType;
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLEvaluator.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLEvaluator.hh 89243 2015-03-27 16:24:39Z gcosmo $
//
//
// class G4GDMLEvaluator
@@ -62,6 +62,8 @@ class G4GDMLEvaluator
G4int EvaluateInteger(const G4String&);
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4String ConvertToString(G4int ival);
G4String ConvertToString(G4double dval);
private:
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLMessenger.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLMessenger.hh 89381 2015-04-08 15:32:47Z gcosmo $
//
//
// class G4GDMLMessenger
@@ -49,6 +49,7 @@ class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
class G4UIcmdWithABool;
class G4GDMLMessenger : public G4UImessenger
{
@@ -69,7 +70,9 @@ class G4GDMLMessenger : public G4UImessenger
G4UIcmdWithAString* ReaderCmd;
G4UIcmdWithAString* WriterCmd;
G4UIcmdWithAString* TopVolCmd;
G4UIcmdWithoutParameter* ClearCmd;
G4UIcmdWithoutParameter* ClearCmd;
G4UIcmdWithABool* RegionCmd;
G4UIcmdWithABool* EcutsCmd;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLParser.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLParser.hh 89698 2015-04-27 13:25:23Z gcosmo $
//
//
// class G4GDMLParser
@@ -44,6 +44,7 @@
#include "G4GDMLWriteStructure.hh"
#include "G4STRead.hh"
#include "G4GDMLMessenger.hh"
#include "G4GDMLEvaluator.hh"
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
@@ -116,11 +117,16 @@ class G4GDMLParser
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* logvol) 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 Clear(); // Clears the evaluator
// Methods for Writer
@@ -128,13 +134,21 @@ class G4GDMLParser
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);
private:
void ImportRegions();
void ExportRegions(G4bool storeReferences = true);
private:
G4GDMLEvaluator eval;
G4GDMLReadStructure* reader;
G4GDMLWriteStructure* writer;
G4GDMLAuxListType *rlist, *ullist;
G4GDMLMessenger* messenger;
G4bool urcode, uwcode, strip;
G4bool urcode, uwcode, strip, rexp;
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLParser.icc 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLParser.icc 89698 2015-04-27 13:25:23Z gcosmo $
//
//
// class G4GDMLParser inline methods
@@ -35,12 +35,14 @@ inline
void G4GDMLParser::Read(const G4String& filename, G4bool validate)
{
reader->Read(filename,validate,false,strip);
ImportRegions();
}
inline
void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate)
{
reader->Read(filename,validate,true);
ImportRegions();
}
inline
@@ -62,6 +64,7 @@ void G4GDMLParser::Write(const G4String& filename,
lvol = pvol->GetLogicalVolume();
}
if (rexp) { ExportRegions(refs); }
writer->Write(filename,lvol,schemaLocation,depth,refs);
}
@@ -78,6 +81,7 @@ void G4GDMLParser::Write(const G4String& filename,
lvol = G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
}
if (rexp) { ExportRegions(refs); }
writer->Write(filename,lvol,schemaLocation,depth,refs);
}
@@ -166,6 +170,18 @@ const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
return reader->GetAuxMap();
}
inline
const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const
{
return reader->GetAuxList();
}
inline
void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux)
{
return writer->AddAuxiliary(myaux);
}
inline
void G4GDMLParser::StripNamePointers() const
{
@@ -182,6 +198,16 @@ inline void G4GDMLParser::SetOverlapCheck(G4bool flag)
reader->OverlapCheck(flag);
}
inline void G4GDMLParser::SetRegionExport(G4bool flag)
{
rexp = flag;
}
inline void G4GDMLParser::SetEnergyCutsExport(G4bool flag)
{
writer->SetEnergyCutsExport(flag);
}
inline void G4GDMLParser::Clear()
{
reader->Clear();
@@ -208,3 +234,10 @@ void G4GDMLParser::SetAddPointerToName(G4bool set)
{
writer->SetAddPointerToName(set);
}
inline
void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
const G4LogicalVolume* const lvol)
{
writer->AddVolumeAuxiliary(myaux, lvol);
}
+15 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLRead.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLRead.hh 89493 2015-04-14 09:22:54Z gcosmo $
//
// class G4GDMLRead
//
@@ -48,6 +48,7 @@
#include "G4Types.hh"
#include "G4GDMLEvaluator.hh"
#include "G4GDMLAuxStructType.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -108,6 +109,11 @@ class G4GDMLRead
// 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 G4LogicalVolume* GetVolume(const G4String&) const=0;
virtual G4String GetSetup(const G4String&)=0;
//
@@ -119,6 +125,7 @@ class G4GDMLRead
// Main method for reading GDML files.
void StripNames() const;
void StripName(G4String&) const;
//
// Strip off pointers from entity IDs.
@@ -126,6 +133,9 @@ class G4GDMLRead
//
// Activate/de-activate surface check for overlaps (default is off)
const G4GDMLAuxListType* GetAuxList() const;
protected:
G4GDMLRead();
@@ -134,20 +144,23 @@ class G4GDMLRead
G4String Transcode(const XMLCh* const);
G4String GenerateName(const G4String& name, G4bool strip=false);
G4String Strip(const G4String&) const;
void StripName(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);
protected:
G4GDMLEvaluator eval;
G4bool validate;
G4bool check;
G4bool dostrip;
private:
G4int inLoop, loopCount;
G4GDMLAuxListType auxGlobalList;
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLReadStructure.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLReadStructure.hh 89493 2015-04-14 09:22:54Z gcosmo $
//
//
// class G4GDMLReadStructure
@@ -49,13 +49,6 @@ class G4AssemblyVolume;
class G4LogicalVolume;
class G4VPhysicalVolume;
struct G4GDMLAuxPairType
{
G4String type;
G4String value;
};
typedef std::vector<G4GDMLAuxPairType> G4GDMLAuxListType;
typedef std::map<G4LogicalVolume*,G4GDMLAuxListType> G4GDMLAuxMapType;
typedef std::map<G4String, G4AssemblyVolume*> G4GDMLAssemblyMapType;
@@ -72,7 +65,7 @@ class G4GDMLReadStructure : public G4GDMLReadParamvol
G4AssemblyVolume* GetAssembly(const G4String&) const;
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume*) const;
G4VPhysicalVolume* GetWorldVolume(const G4String&);
const G4GDMLAuxMapType* GetAuxMap() const;
const G4GDMLAuxMapType* GetAuxMap() const {return &auxMap;}
void Clear(); // Clears internal map and evaluator
virtual void VolumeRead(const xercesc::DOMElement* const);
@@ -81,7 +74,6 @@ class G4GDMLReadStructure : public G4GDMLReadParamvol
protected:
G4GDMLAuxPairType AuxiliaryRead(const xercesc::DOMElement* const);
void AssemblyRead(const xercesc::DOMElement* const);
void DivisionvolRead(const xercesc::DOMElement* const);
G4LogicalVolume* FileRead(const xercesc::DOMElement* const);
@@ -101,6 +93,7 @@ class G4GDMLReadStructure : public G4GDMLReadParamvol
G4GDMLAssemblyMapType assemblyMap;
G4LogicalVolume *pMotherLogical;
std::map<std::string, G4VPhysicalVolume*> setuptoPV;
G4bool strip;
};
#endif
+14 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWrite.hh 69013 2013-04-15 09:41:13Z gcosmo $
// $Id: G4GDMLWrite.hh 89243 2015-03-27 16:24:39Z gcosmo $
//
//
// class G4GDMLWrite
@@ -49,6 +49,8 @@
#include "G4Transform3D.hh"
#include "G4GDMLAuxStructType.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -72,6 +74,10 @@ class G4GDMLWrite
//
// Split geometry structure in modules, by volume subtree or level
void AddAuxiliary(G4GDMLAuxStructType myaux);
//
// Import auxiliary structure
static void SetAddPointerToName(G4bool);
//
// Specify if to add or not memory addresses to IDs.
@@ -89,6 +95,7 @@ class G4GDMLWrite
// 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);
//
@@ -98,6 +105,8 @@ class G4GDMLWrite
// inheriting from G4GDMLWriteStructure and being registered
// as argument to G4GDMLParser.
G4String GenerateName(const G4String&,const void* const);
protected:
G4GDMLWrite();
@@ -105,13 +114,14 @@ class G4GDMLWrite
VolumeMapType& VolumeMap();
G4String GenerateName(const G4String&,const void* const);
xercesc::DOMAttr* NewAttribute(const G4String&, const G4String&);
xercesc::DOMAttr* NewAttribute(const G4String&, const G4double&);
xercesc::DOMElement* NewElement(const G4String&);
G4String Modularize(const G4VPhysicalVolume* const topvol,
const G4int depth);
void AddAuxInfo(G4GDMLAuxListType* auxInfoList, xercesc::DOMElement* element);
G4bool FileExists(const G4String&) const;
PhysVolumeMapType& PvolumeMap();
DepthMapType& DepthMap();
@@ -122,8 +132,9 @@ class G4GDMLWrite
static G4bool addPointerToName;
xercesc::DOMDocument* doc;
xercesc::DOMElement* extElement;
xercesc::DOMElement* userinfoElement;
XMLCh tempStr[10000];
G4GDMLAuxListType auxList;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteStructure.hh 68053 2013-03-13 14:39:51Z gcosmo $
// $Id: G4GDMLWriteStructure.hh 89493 2015-04-14 09:22:54Z gcosmo $
//
//
// class G4GDMLWriteStructure
@@ -42,7 +42,6 @@
#include "G4Types.hh"
#include "G4Transform3D.hh"
#include "G4GDMLWriteParamvol.hh"
class G4LogicalVolume;
@@ -52,6 +51,7 @@ class G4LogicalBorderSurface;
class G4LogicalSkinSurface;
class G4OpticalSurface;
class G4SurfaceProperty;
class G4ReflectionFactory;
class G4GDMLWriteStructure : public G4GDMLWriteParamvol
{
@@ -62,6 +62,9 @@ class G4GDMLWriteStructure : public G4GDMLWriteParamvol
virtual ~G4GDMLWriteStructure();
virtual void StructureWrite(xercesc::DOMElement*);
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const);
void SetEnergyCutsExport(G4bool);
protected:
@@ -77,16 +80,20 @@ class G4GDMLWriteStructure : public G4GDMLWriteParamvol
const G4LogicalBorderSurface* GetBorderSurface(const G4VPhysicalVolume* const);
const G4LogicalSkinSurface* GetSkinSurface(const G4LogicalVolume* const);
G4bool FindOpticalSurface(const G4SurfaceProperty*);
void ExportEnergyCuts(const G4LogicalVolume* const);
protected:
xercesc::DOMElement* structureElement;
std::vector<xercesc::DOMElement*> borderElementVec;
std::vector<xercesc::DOMElement*> skinElementVec;
std::map<const G4LogicalVolume*, G4GDMLAuxListType> auxmap;
private: // cache for optical surfaces...
std::vector<const G4OpticalSurface*> opt_vec;
G4ReflectionFactory* reflFactory;
G4bool cexport; // Flag for optional export of energy cuts per volume
};
#endif