Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4VPhysicalVolume.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: G4VPhysicalVolume.cc 103096 2017-03-15 15:21:33Z gcosmo $
28 //
29 //
30 // class G4VPhysicalVolume Implementation
31 //
32 // --------------------------------------------------------------------
33 
34 #include "G4VPhysicalVolume.hh"
35 
36 #include "G4PhysicalVolumeStore.hh"
37 #include "G4LogicalVolume.hh"
38 
39 // This new field helps to use the class G4PVManager
40 //
42 
43 // These macros change the references to fields that are now encapsulated
44 // in the class G4PVData.
45 //
46 #define G4MT_rot ((subInstanceManager.offset[instanceID]).frot)
47 #define G4MT_trans ((subInstanceManager.offset[instanceID]).ftrans)
48 #define G4MT_pvdata (subInstanceManager.offset[instanceID])
49 
50 // Constructor: init parameters and register in Store
51 //
53  const G4ThreeVector &tlate,
54  const G4String& pName,
55  G4LogicalVolume* pLogical,
57  : flogical(pLogical),
58  fname(pName), flmother(0)
59 {
61 
62  this->SetRotation( pRot ); // G4MT_rot = pRot;
63  this->SetTranslation( tlate ); // G4MT_trans = tlate;
64 
65  // Initialize 'Shadow' data structure - for use by object persistency
66  pvdata = new G4PVData();
67  pvdata->frot = pRot;
68  pvdata->ftrans = G4ThreeVector(tlate);
69 
71 }
72 
73 // Fake default constructor - sets only member data and allocates memory
74 // for usage restricted to object persistency.
75 //
77  : flogical(0), fname(""), flmother(0), pvdata(0)
78 {
79  // Register to store
80  //
82 
84 }
85 
86 // Destructor - remove from Store
87 //
89 {
90  delete pvdata;
92 }
93 
94 // This method is similar to the constructor. It is used by each worker
95 // thread to achieve the same effect as that of the master thread exept
96 // to register the new created instance. This method is invoked explicitly.
97 // It does not create a new G4VPhysicalVolume instance.
98 // It only assign the value for the fields encapsulated by the class G4PVData.
99 //
102  G4RotationMatrix *pRot,
103  const G4ThreeVector &tlate)
104 {
106 
107  this->SetRotation( pRot ); // G4MT_rot = pRot;
108  this->SetTranslation( tlate ); // G4MT_trans = tlate;
109  // G4PhysicalVolumeStore::Register(this);
110 }
111 
112 // Release memory allocated for offset
113 //
115 {
117 }
118 
119 // This method is similar to the destructor. It is used by each worker
120 // thread to achieve the partial effect as that of the master thread.
121 // For G4VPhysicalVolume instances, nothing more to do here.
122 //
124 {
125 }
126 
127 // Returns the private data instance manager.
128 //
130 {
131  return subInstanceManager;
132 }
133 
135 {
136  return 1;
137 }
138 
140 {
141  return G4MT_trans;
142 }
143 
145 {
146  G4MT_trans=vec;
147 }
148 
150 {
151  return G4MT_rot;
152 }
153 
155 {
156  return G4MT_rot;
157 }
158 
160 {
161  G4MT_rot=pRot;
162 }
163 
165 {
166  static G4RotationMatrix aRotM;
167  static G4RotationMatrix IdentityRM;
168 
169  G4RotationMatrix* retval = &IdentityRM;
170 
171  // Insure against frot being a null pointer
172  if(this->GetRotation())
173  {
174  aRotM = GetRotation()->inverse();
175  retval= &aRotM;
176  }
177  return retval;
178 }
179 
181 {
182  G4RotationMatrix aRotM; // Initialised to identity
183 
184  // Insure against G4MT_rot being a null pointer
185  if(G4MT_rot)
186  {
187  aRotM= G4MT_rot->inverse();
188  }
189  return aRotM;
190 }
191 
193 {
194  return G4MT_trans;
195 }
196 
198 {
199  return G4MT_rot;
200 }
201 
203 {
204  return -G4MT_trans;
205 }
206 
207 // Only implemented for placed and parameterised volumes.
208 // Not required for replicas.
209 //
211 {
212  return false;
213 }
const G4RotationMatrix * GetFrameRotation() const
CLHEP::Hep3Vector G4ThreeVector
G4RotationMatrix * frot
static void Register(G4VPhysicalVolume *pSolid)
void TerminateWorker(G4VPhysicalVolume *pMasterObject)
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
G4int CreateSubInstance()
void SetTranslation(const G4ThreeVector &v)
const G4ThreeVector & GetTranslation() const
static void DeRegister(G4VPhysicalVolume *pSolid)
virtual G4int GetMultiplicity() const
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
static const G4PVManager & GetSubInstanceManager()
G4ThreeVector GetFrameTranslation() const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4RotationMatrix * GetObjectRotation() const
G4RotationMatrix GetObjectRotationValue() const
G4ThreeVector ftrans
virtual ~G4VPhysicalVolume()
#define G4MT_rot
int G4int
Definition: G4Types.hh:78
void SlaveCopySubInstanceArray()
#define G4MT_trans
void SetRotation(G4RotationMatrix *)
const G4RotationMatrix * GetRotation() const
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
G4ThreeVector GetObjectTranslation() const
static G4GEOM_DLL G4PVManager subInstanceManager
HepRotation inverse() const