File indexing completed on 2025-01-18 09:59:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef G4tgrVolumeMgr_hh
0035 #define G4tgrVolumeMgr_hh 1
0036
0037 #include "globals.hh"
0038 #include "G4tgrSolid.hh"
0039 #include "G4tgrVolume.hh"
0040 #include "G4tgrPlace.hh"
0041 #include "G4tgrIsotope.hh"
0042 #include "G4tgrElement.hh"
0043 #include "G4tgrMaterial.hh"
0044 #include "G4tgrRotationMatrix.hh"
0045
0046 #include <map>
0047
0048 using G4mapssol = std::map<G4String, G4tgrSolid*>;
0049 using G4mapsvol = std::map<G4String, G4tgrVolume*>;
0050 using G4mmapspl = std::multimap<G4String, const G4tgrPlace*>;
0051
0052 class G4tgrVolumeMgr
0053 {
0054 public:
0055
0056 static G4tgrVolumeMgr* GetInstance();
0057
0058
0059 G4tgrSolid* CreateSolid(const std::vector<G4String>& wl, G4bool bVOLUtag);
0060
0061 void RegisterParentChild(const G4String& parentName, const G4tgrPlace* pl);
0062
0063
0064 G4tgrSolid* FindSolid(const G4String& name, G4bool exists = false);
0065
0066
0067
0068 G4tgrVolume* FindVolume(const G4String& volname, G4bool exists = false);
0069
0070
0071
0072 std::vector<G4tgrVolume*> FindVolumes(const G4String& volname,
0073 G4bool exists);
0074
0075
0076
0077
0078 const G4tgrVolume* GetTopVolume();
0079
0080
0081 std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
0082 GetChildren(const G4String& name);
0083
0084
0085 void DumpSummary();
0086
0087 void DumpVolumeTree();
0088
0089 void DumpVolumeLeaf(const G4tgrVolume* vol, unsigned int copyNo,
0090 unsigned int leafDepth);
0091
0092
0093
0094 void RegisterMe(G4tgrSolid* vol);
0095 void UnRegisterMe(G4tgrSolid* vol);
0096 void RegisterMe(G4tgrVolume* vol);
0097 void UnRegisterMe(G4tgrVolume* vol);
0098 void RegisterMe(G4tgrPlace* pl) { theG4tgrPlaceList.push_back(pl); }
0099 void RegisterMe(G4tgrIsotope* iso) { theHgIsotList.push_back(iso); }
0100 void RegisterMe(G4tgrElement* ele) { theHgElemList.push_back(ele); }
0101 void RegisterMe(G4tgrMaterial* mat) { theHgMateList.push_back(mat); }
0102 void RegisterMe(G4tgrRotationMatrix* rm) { theHgRotMList.push_back(rm); }
0103
0104
0105
0106 const G4mapssol& GetSolidMap() { return theG4tgrSolidMap; }
0107 const G4mapsvol& GetVolumeMap() { return theG4tgrVolumeMap; }
0108 const G4mmapspl& GetVolumeTree() { return theG4tgrVolumeTree; }
0109 std::vector<G4tgrVolume*> GetVolumeList() { return theG4tgrVolumeList; }
0110 std::vector<G4tgrPlace*> GetDetPlaceList() { return theG4tgrPlaceList; }
0111 std::vector<G4tgrIsotope*> GetIsotopeList() { return theHgIsotList; }
0112 std::vector<G4tgrElement*> GetElementList() { return theHgElemList; }
0113 std::vector<G4tgrMaterial*> GetMaterialList() { return theHgMateList; }
0114 std::vector<G4tgrRotationMatrix*> GetRotMList() { return theHgRotMList; }
0115
0116 private:
0117
0118 G4tgrVolumeMgr();
0119 ~G4tgrVolumeMgr();
0120
0121 private:
0122
0123 G4mapssol theG4tgrSolidMap;
0124
0125
0126
0127 G4mapsvol theG4tgrVolumeMap;
0128
0129
0130
0131 G4mmapspl theG4tgrVolumeTree;
0132
0133
0134
0135 static G4ThreadLocal G4tgrVolumeMgr* theInstance;
0136
0137 std::vector<G4tgrVolume*> theG4tgrVolumeList;
0138 std::vector<G4tgrPlace*> theG4tgrPlaceList;
0139 std::vector<G4tgrIsotope*> theHgIsotList;
0140 std::vector<G4tgrElement*> theHgElemList;
0141 std::vector<G4tgrMaterial*> theHgMateList;
0142 std::vector<G4tgrRotationMatrix*> theHgRotMList;
0143 };
0144
0145 #endif