Geant4-11
Public Member Functions | Protected Attributes | Private Attributes | Friends
G4tgrVolumeDivision Class Reference

#include <G4tgrVolumeDivision.hh>

Inheritance diagram for G4tgrVolumeDivision:
G4tgrVolume

Public Member Functions

void AddCheckOverlaps (const std::vector< G4String > &wl)
 
virtual G4tgrPlaceAddPlace (const std::vector< G4String > &wl)
 
G4tgrPlaceParameterisationAddPlaceParam (const std::vector< G4String > &wl)
 
G4tgrPlaceDivRepAddPlaceReplica (const std::vector< G4String > &wl)
 
void AddRGBColour (const std::vector< G4String > &wl)
 
void AddVisibility (const std::vector< G4String > &wl)
 
 G4tgrVolumeDivision (const std::vector< G4String > &wl)
 
G4bool GetCheckOverlaps () const
 
G4doubleGetColour () const
 
const G4StringGetMaterialName () const
 
const G4StringGetName () const
 
G4tgrPlaceDivRepGetPlaceDivision ()
 
const std::vector< G4tgrPlace * > GetPlacements () const
 
G4doubleGetRGBColour () const
 
G4tgrSolidGetSolid () const
 
const G4StringGetType () const
 
G4bool GetVisibility () const
 
virtual G4tgrVolumeGetVolume (G4int ii) const
 
void SetName (const G4String &name)
 
 ~G4tgrVolumeDivision ()
 

Protected Attributes

G4bool theCheckOverlaps = false
 
G4String theMaterialName = ""
 
G4String theName = ""
 
std::vector< G4tgrPlace * > thePlacements
 
G4doubletheRGBColour = nullptr
 
G4tgrSolidtheSolid = nullptr
 
G4String theType = ""
 
G4bool theVisibility = false
 

Private Attributes

G4tgrPlaceDivRepthePlaceDiv = nullptr
 

Friends

std::ostream & operator<< (std::ostream &os, const G4tgrVolumeDivision &obj)
 

Detailed Description

Definition at line 51 of file G4tgrVolumeDivision.hh.

Constructor & Destructor Documentation

◆ G4tgrVolumeDivision()

G4tgrVolumeDivision::G4tgrVolumeDivision ( const std::vector< G4String > &  wl)

Definition at line 47 of file G4tgrVolumeDivision.cc.

48{
49 // wl: NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
50
52 "G4tgrVolumeDivision::G4tgrVolumeDivision");
54 "G4tgrVolumeDivision::G4tgrVolumeDivision");
55
56 theType = "VOLDivision";
57
58 // :DIV NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
59
60 //---------- set name
62
63 //---------- set the pointer to the parent DU
64 G4String parentName = G4tgrUtils::GetString(wl[2]);
65 G4tgrVolumeMgr::GetInstance()->FindVolume(parentName, 1); // check existance
66
67 //---------- initialize G4tgrPlace
69 thePlaceDiv->SetParentName(parentName);
70 thePlaceDiv->SetType("PlaceDivision");
72
73 //---------- set material name
75
76 //----- set axis of replica
78
79 //------ register parent - child
81#ifdef G4VERBOSE
83 {
84 G4cout << " G4tgrVolumeDivision::G4tgrVolumeDivision() -"
85 << " Replica register parent - child " << G4endl;
86 }
87#endif
88
89 //---------- set if division is given by number of divisions of by width
90 G4String wl0 = wl[0];
91 for(std::size_t ii = 0; ii < wl0.length(); ++ii)
92 {
93 wl0[ii] = toupper(wl0[ii]);
94 }
95
96 if(wl0 == ":DIV_NDIV")
97 {
100 if(wl.size() == 7)
101 {
103 }
104 }
105 else if(wl0 == ":DIV_WIDTH")
106 {
109 if(wl.size() == 7)
110 {
112 }
113 }
114 else if(wl0 == ":DIV_NDIV_WIDTH")
115 {
119 if(wl.size() == 8)
120 {
122 }
123 }
124 else
125 {
126 G4String ErrMessage = "Division type not supported, sorry... " + wl[0];
127 G4Exception("G4tgrVolumeDivision::G4tgrVolumeDivision()", "NotImplemented",
128 FatalException, ErrMessage);
129 }
130
131 theVisibility = 1;
132 theRGBColour = new G4double[3];
133 for(std::size_t ii = 0; ii < 3; ++ii)
134 {
135 theRGBColour[ii] = -1.;
136 }
137
138#ifdef G4VERBOSE
140 {
141 G4cout << " Created " << *this << G4endl;
142 }
143#endif
144
145 theSolid = nullptr;
146}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double mm
Definition: G4SIunits.hh:95
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
@ DivByNdiv
@ DivByWidth
@ DivByNdivAndWidth
@ WLSIZE_GE
Definition: G4tgrUtils.hh:51
@ WLSIZE_LE
Definition: G4tgrUtils.hh:49
static G4int GetVerboseLevel()
void SetDivType(G4DivType typ)
void SetParentName(const G4String &parentName)
void SetAxis(EAxis axis)
void SetNDiv(G4int ndiv)
void SetWidth(G4double width)
void SetOffset(G4double offset)
EAxis BuildAxis(const G4String &axisName)
void SetType(const G4String &typ)
Definition: G4tgrPlace.hh:57
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:56
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:173
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:490
static G4int GetInt(const G4String &str)
Definition: G4tgrUtils.cc:447
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:198
G4tgrPlaceDivRep * thePlaceDiv
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
static G4tgrVolumeMgr * GetInstance()
G4String theMaterialName
Definition: G4tgrVolume.hh:106
G4String theType
Definition: G4tgrVolume.hh:104
G4String theName
Definition: G4tgrVolume.hh:102
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:108
G4bool theVisibility
Definition: G4tgrVolume.hh:113
G4double * theRGBColour
Definition: G4tgrVolume.hh:114

References G4tgrPlaceDivRep::BuildAxis(), G4tgrUtils::CheckWLsize(), DivByNdiv, DivByNdivAndWidth, DivByWidth, FatalException, G4tgrVolumeMgr::FindVolume(), G4cout, G4endl, G4Exception(), G4tgrUtils::GetDouble(), G4tgrVolumeMgr::GetInstance(), G4tgrUtils::GetInt(), G4tgrUtils::GetString(), G4tgrMessenger::GetVerboseLevel(), mm, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlaceDivRep::SetAxis(), G4tgrPlaceDivRep::SetDivType(), G4tgrPlaceDivRep::SetNDiv(), G4tgrPlaceDivRep::SetOffset(), G4tgrPlaceDivRep::SetParentName(), G4tgrPlace::SetType(), G4tgrPlace::SetVolume(), G4tgrPlaceDivRep::SetWidth(), G4tgrVolume::theMaterialName, G4tgrVolume::theName, thePlaceDiv, G4tgrVolume::theRGBColour, G4tgrVolume::theSolid, G4tgrVolume::theType, G4tgrVolume::theVisibility, WLSIZE_GE, and WLSIZE_LE.

◆ ~G4tgrVolumeDivision()

G4tgrVolumeDivision::~G4tgrVolumeDivision ( )

Definition at line 42 of file G4tgrVolumeDivision.cc.

43{
44}

Member Function Documentation

◆ AddCheckOverlaps()

void G4tgrVolume::AddCheckOverlaps ( const std::vector< G4String > &  wl)
inherited

------— Set check overlaps

Definition at line 251 of file G4tgrVolume.cc.

252{
253 //---------- Check for exact number of words read
254 G4tgrUtils::CheckWLsize(wl, 3, WLSIZE_GE, " G4tgrVolume::AddCheckOverlaps");
255
258}
static G4bool GetBool(const G4String &str)
Definition: G4tgrUtils.cc:464
G4bool theCheckOverlaps
Definition: G4tgrVolume.hh:115

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), G4tgrVolume::theCheckOverlaps, and WLSIZE_GE.

◆ AddPlace()

G4tgrPlace * G4tgrVolume::AddPlace ( const std::vector< G4String > &  wl)
virtualinherited

Reimplemented in G4tgrVolumeAssembly.

Definition at line 126 of file G4tgrVolume.cc.

127{
128 //---------- Check for exact number of words read
129 G4tgrUtils::CheckWLsize(wl, 8, WLSIZE_EQ, " G4tgrVolume::AddPlace");
130 //---------- set G4tgrPlace
132 //---------- check that there is no previous placement in
133 // the same parent with the same copyNo
134 for(auto ite = thePlacements.cbegin(); ite != thePlacements.cend(); ++ite)
135 {
136 if(((*ite)->GetCopyNo() == pl->GetCopyNo()) &&
137 ((*ite)->GetParentName() == pl->GetParentName()))
138 {
139 G4String ErrMessage =
140 "Repeated placement. Volume " + theName + " in " + pl->GetParentName();
141 G4Exception("G4tgrVolume::AddPlace()", "InvalidArgument",
142 FatalErrorInArgument, ErrMessage);
143 }
144 }
145
146 pl->SetVolume(this);
147 thePlacements.push_back(pl);
148
149#ifdef G4VERBOSE
151 {
152 G4cout << " G4tgrVolume: New placement: " << thePlacements.size()
153 << " added for Volume " << theName << " inside "
154 << pl->GetParentName() << " type " << pl->GetType() << G4endl;
155 }
156#endif
157 //---------- register parent - child
159
160 return pl;
161}
@ FatalErrorInArgument
@ WLSIZE_EQ
Definition: G4tgrUtils.hh:47
const G4String & GetParentName() const
Definition: G4tgrPlace.hh:52
const G4String & GetType() const
Definition: G4tgrPlace.hh:55
unsigned int GetCopyNo() const
Definition: G4tgrPlace.hh:54
std::vector< G4tgrPlace * > thePlacements
Definition: G4tgrVolume.hh:110

References G4tgrUtils::CheckWLsize(), FatalErrorInArgument, G4cout, G4endl, G4Exception(), G4tgrPlace::GetCopyNo(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrPlace::GetType(), G4tgrMessenger::GetVerboseLevel(), G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), G4tgrVolume::theName, G4tgrVolume::thePlacements, and WLSIZE_EQ.

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddPlaceParam()

G4tgrPlaceParameterisation * G4tgrVolume::AddPlaceParam ( const std::vector< G4String > &  wl)
inherited

Definition at line 201 of file G4tgrVolume.cc.

202{
203 //---------- set G4tgrPlaceParameterisation
205
206 pl->SetVolume(this);
207 thePlacements.push_back(pl);
208
209#ifdef G4VERBOSE
211 {
212 G4cout << " G4tgrVolume: New placement Param: " << thePlacements.size()
213 << " added for Volume " << theName << " inside "
214 << pl->GetParentName() << G4endl;
215 }
216#endif
217 //---------- register parent - child
219
220 return pl;
221}

References G4cout, G4endl, G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetVolume(), G4tgrVolume::theName, and G4tgrVolume::thePlacements.

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddPlaceReplica()

G4tgrPlaceDivRep * G4tgrVolume::AddPlaceReplica ( const std::vector< G4String > &  wl)
inherited

Definition at line 164 of file G4tgrVolume.cc.

165{
166 //---------- Check for exact number of words read
167 G4tgrUtils::CheckWLsize(wl, 6, WLSIZE_GE, " G4tgrVolume::AddPlaceReplica");
168 G4tgrUtils::CheckWLsize(wl, 7, WLSIZE_LE, " G4tgrVolume::AddPlaceReplica");
169
170 if((wl.size() == 7) && (G4tgrUtils::GetDouble(wl[6]) != 0.) &&
171 (wl[3] != "PHI"))
172 {
173 G4Exception("G4tgrVolume::AddPlaceReplica",
174 "Offset set for replica not along PHI, it will not be used",
176 G4String("Volume " + wl[1] + " in volume " + wl[2]).c_str());
177 }
178
179 //---------- set G4tgrPlace
181 pl->SetType("PlaceReplica");
182 pl->SetVolume(this);
183 thePlacements.push_back(pl);
184
185#ifdef G4VERBOSE
187 {
188 G4cout << " G4tgrVolume: New placement replica: " << thePlacements.size()
189 << " added for Volume " << theName << " inside "
190 << pl->GetParentName() << G4endl;
191 }
192#endif
193 //---------- register parent - child
195
196 return pl;
197}
@ JustWarning

References G4tgrUtils::CheckWLsize(), G4cout, G4endl, G4Exception(), G4tgrUtils::GetDouble(), G4tgrVolumeMgr::GetInstance(), G4tgrPlace::GetParentName(), G4tgrMessenger::GetVerboseLevel(), JustWarning, G4tgrVolumeMgr::RegisterParentChild(), G4tgrPlace::SetType(), G4tgrPlace::SetVolume(), G4tgrVolume::theName, G4tgrVolume::thePlacements, WLSIZE_GE, and WLSIZE_LE.

Referenced by G4tgrLineProcessor::ProcessLine().

◆ AddRGBColour()

void G4tgrVolume::AddRGBColour ( const std::vector< G4String > &  wl)
inherited

------— Set transparency

Definition at line 234 of file G4tgrVolume.cc.

235{
236 //---------- Check for exact number of words read
237 G4tgrUtils::CheckWLsize(wl, 5, WLSIZE_GE, " G4tgrVolume::AddRGBColour");
238
239 //---------- Set RGB colour
244 if(wl.size() == 6)
245 {
247 }
248}

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetDouble(), G4tgrVolume::theRGBColour, and WLSIZE_GE.

◆ AddVisibility()

void G4tgrVolume::AddVisibility ( const std::vector< G4String > &  wl)
inherited

Definition at line 224 of file G4tgrVolume.cc.

225{
226 //---------- Check for exact number of words read
227 G4tgrUtils::CheckWLsize(wl, 3, WLSIZE_EQ, " G4tgrVolume::AddVisibility");
228
229 //---------- Set visibility
231}

References G4tgrUtils::CheckWLsize(), G4tgrUtils::GetBool(), G4tgrVolume::theVisibility, and WLSIZE_EQ.

◆ GetCheckOverlaps()

G4bool G4tgrVolume::GetCheckOverlaps ( ) const
inlineinherited

Definition at line 94 of file G4tgrVolume.hh.

94{ return theCheckOverlaps; }

References G4tgrVolume::theCheckOverlaps.

Referenced by G4tgbVolume::ConstructG4PhysVol(), and G4tgrVolume::G4tgrVolume().

◆ GetColour()

G4double * G4tgrVolume::GetColour ( ) const
inlineinherited

Definition at line 91 of file G4tgrVolume.hh.

91{ return theRGBColour; }

References G4tgrVolume::theRGBColour.

Referenced by G4tgbVolume::GetColour().

◆ GetMaterialName()

const G4String & G4tgrVolume::GetMaterialName ( ) const
inlineinherited

◆ GetName()

const G4String & G4tgrVolume::GetName ( ) const
inlineinherited

◆ GetPlaceDivision()

G4tgrPlaceDivRep * G4tgrVolumeDivision::GetPlaceDivision ( )
inline

Definition at line 58 of file G4tgrVolumeDivision.hh.

58{ return thePlaceDiv; }

References thePlaceDiv.

Referenced by G4tgbVolume::ConstructG4PhysVol().

◆ GetPlacements()

const std::vector< G4tgrPlace * > G4tgrVolume::GetPlacements ( ) const
inlineinherited

Definition at line 89 of file G4tgrVolume.hh.

89{return thePlacements;}

References G4tgrVolume::thePlacements.

Referenced by G4tgrVolume::G4tgrVolume(), and G4tgrVolumeMgr::GetTopVolume().

◆ GetRGBColour()

G4double * G4tgrVolume::GetRGBColour ( ) const
inlineinherited

Definition at line 92 of file G4tgrVolume.hh.

92{ return theRGBColour; }

References G4tgrVolume::theRGBColour.

Referenced by G4tgrVolume::G4tgrVolume().

◆ GetSolid()

G4tgrSolid * G4tgrVolume::GetSolid ( ) const
inlineinherited

◆ GetType()

const G4String & G4tgrVolume::GetType ( ) const
inlineinherited

◆ GetVisibility()

G4bool G4tgrVolume::GetVisibility ( ) const
inlineinherited

Definition at line 90 of file G4tgrVolume.hh.

90{ return theVisibility; }

References G4tgrVolume::theVisibility.

Referenced by G4tgrVolume::G4tgrVolume(), and G4tgbVolume::GetVisibility().

◆ GetVolume()

G4tgrVolume * G4tgrVolume::GetVolume ( G4int  ii) const
virtualinherited

Definition at line 116 of file G4tgrVolume.cc.

117{
118 G4String ErrMessage = "Should only be called for composite solids... " +
120 G4Exception("G4tgrVolume::GetVolume()", "InvalidCall", FatalException,
121 ErrMessage);
122 return nullptr;
123}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), FatalException, and G4Exception().

◆ SetName()

void G4tgrVolume::SetName ( const G4String name)
inlineinherited

Definition at line 84 of file G4tgrVolume.hh.

84{ theName = name; }
const char * name(G4int ptype)

References G4InuclParticleNames::name(), and G4tgrVolume::theName.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const G4tgrVolumeDivision obj 
)
friend

Definition at line 149 of file G4tgrVolumeDivision.cc.

150{
151 os << "G4tgrVolumeDivision= " << obj.theName
152 << " Placement= " << *(obj.thePlaceDiv) << G4endl;
153
154 return os;
155}

Field Documentation

◆ theCheckOverlaps

G4bool G4tgrVolume::theCheckOverlaps = false
protectedinherited

◆ theMaterialName

G4String G4tgrVolume::theMaterialName = ""
protectedinherited

◆ theName

G4String G4tgrVolume::theName = ""
protectedinherited

◆ thePlaceDiv

G4tgrPlaceDivRep* G4tgrVolumeDivision::thePlaceDiv = nullptr
private

Definition at line 65 of file G4tgrVolumeDivision.hh.

Referenced by G4tgrVolumeDivision(), and GetPlaceDivision().

◆ thePlacements

std::vector<G4tgrPlace*> G4tgrVolume::thePlacements
protectedinherited

◆ theRGBColour

G4double* G4tgrVolume::theRGBColour = nullptr
protectedinherited

◆ theSolid

G4tgrSolid* G4tgrVolume::theSolid = nullptr
protectedinherited

◆ theType

G4String G4tgrVolume::theType = ""
protectedinherited

◆ theVisibility

G4bool G4tgrVolume::theVisibility = false
protectedinherited

The documentation for this class was generated from the following files: