Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:21

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4GeometryManager
0027 //
0028 // Class description:
0029 //
0030 // A class responsible for high level geometrical functions, and for
0031 // high level objects in the geometry subdomain.
0032 // The class is a `singleton', with access via the static method
0033 // G4GeometryManager::GetInstance().
0034 //
0035 // Member data:
0036 //
0037 //   - fgInstance
0038 //     Ptr to the unique instance of class
0039 
0040 // 26.07.95, P.Kent - Initial version, including optimisation build
0041 // --------------------------------------------------------------------
0042 #ifndef G4GEOMETRYMANAGER_HH
0043 #define G4GEOMETRYMANAGER_HH 1
0044 
0045 #include <vector>
0046 
0047 #include "G4Types.hh"
0048 #include "G4SmartVoxelStat.hh"
0049 
0050 class G4VPhysicalVolume;
0051 
0052 class G4GeometryManager
0053 {
0054   public:
0055   
0056     G4bool CloseGeometry(G4bool pOptimise = true, G4bool verbose = false,
0057                          G4VPhysicalVolume* vol = nullptr);
0058       // Close (`lock') the geometry: perform sanity and `completion' checks
0059       // and optionally [default=yes] build optimisation information.
0060       // Applies to just a specific subtree if a physical volume is specified.
0061 
0062     void OpenGeometry(G4VPhysicalVolume* vol = nullptr);
0063       // Open (`unlock') the geometry and remove optimisation information if
0064       // present. Applies to just a specific subtree if a physical volume is
0065       // specified.
0066 
0067     static G4bool IsGeometryClosed();
0068       // Return true/false according to state of optimised geoemtry.
0069 
0070     void SetWorldMaximumExtent(G4double worldExtent);
0071       // Set the maximum extent of the world volume. The operation is
0072       // allowed only if NO solids have been created already.
0073 
0074     static G4GeometryManager* GetInstance();
0075       // Return ptr to singleton instance of the class, creating it if
0076       // not existing.
0077 
0078     static G4GeometryManager* GetInstanceIfExist();
0079       // Return ptr to singleton instance.
0080 
0081   public:
0082 
0083    ~G4GeometryManager();
0084       // Destructor.
0085 
0086   protected:
0087 
0088     G4GeometryManager() = default;
0089       // Protected constructor. Set the geometry to be open
0090 
0091   private:
0092 
0093     void BuildOptimisations(G4bool allOpt, G4bool verbose = false);
0094     void BuildOptimisations(G4bool allOpt, G4VPhysicalVolume* vol);
0095     void DeleteOptimisations();
0096     void DeleteOptimisations(G4VPhysicalVolume* vol);
0097     static void ReportVoxelStats( std::vector<G4SmartVoxelStat>& stats,
0098                                   G4double totalCpuTime );
0099     static G4ThreadLocal G4GeometryManager* fgInstance;
0100     static G4ThreadLocal G4bool fIsClosed;
0101 };
0102 
0103 #endif