Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4tgrVolumeDivision.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4tgrVolumeDivision.cc 68052 2013-03-13 14:38:53Z gcosmo $
28 //
29 //
30 // class G4tgrVolumeDivision
31 
32 // History:
33 // - Created. P.Arce, CIEMAT (November 2007)
34 // -------------------------------------------------------------------------
35 
36 #include "G4tgrVolumeDivision.hh"
37 
38 #include "G4SystemOfUnits.hh"
39 #include "G4tgrUtils.hh"
40 #include "G4tgrVolumeMgr.hh"
41 #include "G4tgrPlace.hh"
42 #include "G4tgrFileReader.hh"
43 #include "G4tgrPlaceDivRep.hh"
44 #include "G4tgrMessenger.hh"
45 
46 
47 //-------------------------------------------------------------
49 {
50 }
51 
52 //-------------------------------------------------------------
53 G4tgrVolumeDivision::G4tgrVolumeDivision( const std::vector<G4String>& wl )
54 {
55  // wl: NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
56 
58  "G4tgrVolumeDivision::G4tgrVolumeDivision" );
60  "G4tgrVolumeDivision::G4tgrVolumeDivision" );
61 
62  theType = "VOLDivision";
63 
64  // :DIV NAME PARENT MATERIAL AXIS STEP/NDIV OFFSET
65 
66  //---------- set name
67  theName = G4tgrUtils::GetString( wl[1] );
68 
69  //---------- set the pointer to the parent DU
70  G4String parentName = G4tgrUtils::GetString(wl[2]);
71  G4tgrVolumeMgr::GetInstance()->FindVolume( parentName, 1); // check existance
72 
73  //---------- initialize G4tgrPlace
75  thePlaceDiv->SetParentName( parentName );
76  thePlaceDiv->SetType("PlaceDivision");
77  thePlaceDiv->SetVolume( this );
78 
79  //---------- set material name
81 
82  //----- set axis of replica
84 
85  //------ register parent - child
87 #ifdef G4VERBOSE
89  {
90  G4cout << " G4tgrVolumeDivision::G4tgrVolumeDivision() -"
91  << " Replica register parent - child " << G4endl;
92  }
93 #endif
94 
95  //---------- set if division is given by number of divisions of by width
96  G4String wl0 = wl[0];
97  for( size_t ii = 0; ii < wl0.length(); ii++ )
98  {
99  wl0[ii] = toupper( wl0[ii] );
100  }
101 
102  if( wl0 == ":DIV_NDIV" )
103  {
106  if( wl.size() == 7 )
107  {
109  }
110  }
111  else if( wl0 == ":DIV_WIDTH" )
112  {
115  if( wl.size() == 7 )
116  {
118  }
119  }
120  else if( wl0 == ":DIV_NDIV_WIDTH" )
121  {
125  if( wl.size() == 8 )
126  {
128  }
129  }
130  else
131  {
132  G4String ErrMessage = "Division type not supported, sorry... " + wl[0];
133  G4Exception("G4tgrVolumeDivision::G4tgrVolumeDivision()",
134  "NotImplemented", FatalException, ErrMessage);
135  }
136 
137  theVisibility = 1;
138  theRGBColour = new G4double[3];
139  for(size_t ii=0; ii<3; ii++) { theRGBColour[ii] = -1.; }
140 
141 #ifdef G4VERBOSE
143  {
144  G4cout << " Created " << *this << G4endl;
145  }
146 #endif
147 
148  theSolid = 0;
149 }
150 
151 
152 // -------------------------------------------------------------------------
153 std::ostream& operator<<(std::ostream& os, const G4tgrVolumeDivision& obj)
154 {
155  os << "G4tgrVolumeDivision= " << obj.theName
156  << " Placement= " << *(obj.thePlaceDiv) << G4endl;
157 
158  return os;
159 }
void SetAxis(EAxis axis)
void SetWidth(G4double width)
static G4int GetVerboseLevel()
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
static G4int GetInt(const G4String &str)
Definition: G4tgrUtils.cc:430
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
G4double * theRGBColour
Definition: G4tgrVolume.hh:120
void SetDivType(G4DivType typ)
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
double G4double
Definition: G4Types.hh:76
void SetOffset(G4double offset)
void SetVolume(G4tgrVolume *vol)
Definition: G4tgrPlace.hh:62
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
G4bool theVisibility
Definition: G4tgrVolume.hh:119
void SetNDiv(G4int ndiv)
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
G4tgrVolumeDivision(const std::vector< G4String > &wl)
G4tgrPlaceDivRep * thePlaceDiv
G4String theType
Definition: G4tgrVolume.hh:110
void SetType(const G4String &typ)
Definition: G4tgrPlace.hh:63
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4tgrSolid * theSolid
Definition: G4tgrVolume.hh:114
G4String theName
Definition: G4tgrVolume.hh:108
G4GLOB_DLL std::ostream G4cout
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
EAxis BuildAxis(const G4String &axisName)
void SetParentName(const G4String &parentName)
static G4tgrVolumeMgr * GetInstance()
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
G4String theMaterialName
Definition: G4tgrVolume.hh:112