Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4GeometryTolerance.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: G4GeometryTolerance.cc 96427 2016-04-14 09:37:29Z gcosmo $
28 //
29 // class G4GeometryTolerance
30 //
31 // Implementation
32 //
33 // Author:
34 // 30.10.06 - G.Cosmo, first implementation
35 // --------------------------------------------------------------------
36 
37 #include "G4GeometryTolerance.hh"
38 #include "G4SystemOfUnits.hh"
39 #include "G4AutoDelete.hh"
40 #include "globals.hh"
41 
42 
43 // ***************************************************************************
44 // Static class instance
45 // ***************************************************************************
46 //
48 
49 // ***************************************************************************
50 // Constructor.
51 // ***************************************************************************
52 //
54 {
55  fCarTolerance = 1E-9*mm;
56  fAngTolerance = 1E-9*rad;
57  fRadTolerance = 1E-9*mm;
58 }
59 
60 // ***************************************************************************
61 // Empty destructor.
62 // ***************************************************************************
63 //
65 {
66 }
67 
68 // ***************************************************************************
69 // Returns the instance of the singleton.
70 // Creates it in case it's called for the first time.
71 // ***************************************************************************
72 //
74 {
75  if (fpInstance == 0)
76  {
79  }
80  return fpInstance;
81 }
82 
83 // ***************************************************************************
84 // Accessors.
85 // ***************************************************************************
86 //
88 {
89  return fCarTolerance;
90 }
91 
93 {
94  return fAngTolerance;
95 }
96 
98 {
99  return fRadTolerance;
100 }
101 
102 // ***************************************************************************
103 // Sets the tolerance to a value computed on the basis of the world volume
104 // extent provided as argument. The method can be called only once.
105 // ***************************************************************************
106 //
108 {
109  if (!fInitialised)
110  {
111  fCarTolerance = fRadTolerance = worldExtent*1E-11;
112  fInitialised = true;
113  }
114  else
115  {
116  G4cout << "WARNING - G4GeometryTolerance::SetSurfaceTolerance()" << G4endl
117  << " Tolerance can only be set once. Currently set to: "
118  << fCarTolerance/mm << " mm." << G4endl;
119  G4Exception("G4GeometryTolerance::SetSurfaceTolerance()",
120  "NotApplicable", JustWarning,
121  "The tolerance has been already set!");
122  }
123 }
void SetSurfaceTolerance(G4double worldExtent)
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
G4double GetAngularTolerance() const
G4double GetRadialTolerance() const
#define G4ThreadLocal
Definition: tls.hh:69
void Register(T *inst)
Definition: G4AutoDelete.hh:65
double G4double
Definition: G4Types.hh:76
static constexpr double rad
Definition: G4SIunits.hh:149
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
static G4ThreadLocal G4GeometryTolerance * fpInstance
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
G4double GetSurfaceTolerance() const