Geant4
10.02.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4GeometryTolerance.cc
Go to the documentation of this file.
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 97527 2016-06-03 14:59:04Z 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
//
47
G4ThreadLocal
G4GeometryTolerance
*
G4GeometryTolerance::fpInstance
= 0;
48
49
// ***************************************************************************
50
// Constructor.
51
// ***************************************************************************
52
//
53
G4GeometryTolerance::G4GeometryTolerance
() : fInitialised(false)
54
{
55
fCarTolerance
= 1E-9*
mm
;
56
fAngTolerance
= 1E-9*
rad
;
57
fRadTolerance
= 1E-9*
mm
;
58
}
59
60
// ***************************************************************************
61
// Empty destructor.
62
// ***************************************************************************
63
//
64
G4GeometryTolerance::~G4GeometryTolerance
()
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
//
73
G4GeometryTolerance
*
G4GeometryTolerance::GetInstance
()
74
{
75
if
(
fpInstance
== 0)
76
{
77
fpInstance
=
new
G4GeometryTolerance
;
78
G4AutoDelete::Register
(
fpInstance
);
79
}
80
return
fpInstance
;
81
}
82
83
// ***************************************************************************
84
// Accessors.
85
// ***************************************************************************
86
//
87
G4double
G4GeometryTolerance::GetSurfaceTolerance
()
const
88
{
89
return
fCarTolerance
;
90
}
91
92
G4double
G4GeometryTolerance::GetAngularTolerance
()
const
93
{
94
return
fAngTolerance
;
95
}
96
97
G4double
G4GeometryTolerance::GetRadialTolerance
()
const
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
//
107
void
G4GeometryTolerance::SetSurfaceTolerance
(
G4double
worldExtent)
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
}
G4GeometryTolerance::fCarTolerance
G4double fCarTolerance
Definition:
G4GeometryTolerance.hh:91
G4GeometryTolerance::GetSurfaceTolerance
G4double GetSurfaceTolerance() const
Definition:
G4GeometryTolerance.cc:87
G4GeometryTolerance::fInitialised
G4bool fInitialised
Definition:
G4GeometryTolerance.hh:94
G4GeometryTolerance::G4GeometryTolerance
G4GeometryTolerance()
Definition:
G4GeometryTolerance.cc:53
G4ThreadLocal
#define G4ThreadLocal
Definition:
tls.hh:89
G4AutoDelete.hh
JustWarning
Definition:
G4ExceptionSeverity.hh:64
G4GeometryTolerance::fpInstance
static G4ThreadLocal G4GeometryTolerance * fpInstance
Definition:
G4GeometryTolerance.hh:90
G4AutoDelete::Register
void Register(T *inst)
Definition:
G4AutoDelete.hh:65
G4cout
G4GLOB_DLL std::ostream G4cout
G4GeometryTolerance::GetRadialTolerance
G4double GetRadialTolerance() const
Definition:
G4GeometryTolerance.cc:97
G4GeometryTolerance::~G4GeometryTolerance
~G4GeometryTolerance()
Definition:
G4GeometryTolerance.cc:64
G4GeometryTolerance::fAngTolerance
G4double fAngTolerance
Definition:
G4GeometryTolerance.hh:92
globals.hh
G4Exception
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition:
G4Exception.cc:41
rad
static const double rad
Definition:
G4SIunits.hh:148
G4GeometryTolerance::fRadTolerance
G4double fRadTolerance
Definition:
G4GeometryTolerance.hh:93
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
G4GeometryTolerance
Definition:
G4GeometryTolerance.hh:56
G4GeometryTolerance.hh
mm
static const double mm
Definition:
G4SIunits.hh:114
G4GeometryTolerance::SetSurfaceTolerance
void SetSurfaceTolerance(G4double worldExtent)
Definition:
G4GeometryTolerance.cc:107
G4GeometryTolerance::GetAngularTolerance
G4double GetAngularTolerance() const
Definition:
G4GeometryTolerance.cc:92
G4GeometryTolerance::GetInstance
static G4GeometryTolerance * GetInstance()
Definition:
G4GeometryTolerance.cc:73
geant4.10.02.p02
source
global
management
src
G4GeometryTolerance.cc
Generated on Fri Jul 1 2016 14:11:14 for Geant4 by
1.8.8