Geant4  10.00.p02
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 70333 2013-05-29 08:56:45Z 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 "globals.hh"
40 
41 
42 // ***************************************************************************
43 // Static class data
44 // ***************************************************************************
45 //
51 
52 // ***************************************************************************
53 // Constructor.
54 // ***************************************************************************
55 //
57 {
58 }
59 
60 // ***************************************************************************
61 // Empty destructor.
62 // ***************************************************************************
63 //
65 {
66  delete fpInstance; fpInstance = 0;
67 }
68 
69 // ***************************************************************************
70 // Returns the instance of the singleton.
71 // Creates it in case it's called for the first time.
72 // ***************************************************************************
73 //
75 {
76  if (fpInstance == 0)
77  {
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 = 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 }
static G4double fCarTolerance
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * fpInstance
G4GLOB_DLL std::ostream G4cout
G4double GetRadialTolerance() const
bool G4bool
Definition: G4Types.hh:79
static G4double fAngTolerance
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const double rad
Definition: G4SIunits.hh:130
static G4double fRadTolerance
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const double mm
Definition: G4SIunits.hh:102
static void SetSurfaceTolerance(G4double worldExtent)
G4double GetAngularTolerance() const
static G4GeometryTolerance * GetInstance()