Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:09:50

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 // G4SolidsWorkspace
0027 //
0028 // Class description:
0029 //
0030 // Manages the per-thread state of solids - those which have a per-thread
0031 // state and dependent classes (if any)
0032 // In particular it owns:
0033 // - the arrays that implement 'split' classes 
0034 // - classes/objects which are owned by the split classes.
0035 // Background: the classes/objects affected are:
0036 // - 'split' classes part of its state is per-thread,
0037 // - per-thread objects, in particular those which are owned by split classes.
0038 // Goal: Take ownership and control of per-thread state of 
0039 //       classes to work with multi-threading. 
0040 //       Offshoot of G4GeometryWorkspace, to deal with Solids.
0041 
0042 // Authors: John Apostolakis, Andrea Dotti (CERN), 04.10.2013 - Created
0043 // --------------------------------------------------------------------
0044 #ifndef G4SOLIDSWORKSPACE_HH
0045 #define G4SOLIDSWORKSPACE_HH
0046 
0047 #include "G4TWorkspacePool.hh"
0048 #include "G4VSolid.hh"
0049 
0050 #include "G4PolyconeSide.hh"
0051 #include "G4PolyhedraSide.hh"
0052 
0053 /**
0054  * @brief G4SolidsWorkspace manages the per-thread state of thoese solids
0055  * which have a per-thread state and dependent classes (if any). It takes
0056  * ownership and control of per-thread state of classes to work with
0057  * multi-threading.
0058  */
0059 
0060 class G4SolidsWorkspace
0061 {
0062   public: 
0063 
0064     using pool_type = G4TWorkspacePool<G4SolidsWorkspace>;
0065 
0066     /**
0067      * Constructor.
0068      *  @param[in] verbose Verbosity flag.
0069      */
0070     G4SolidsWorkspace(G4bool verbose = false);
0071 
0072     /**
0073      * Default Destructor.
0074      */
0075     ~G4SolidsWorkspace() = default;
0076 
0077     /**
0078      * Methods to achieve/release ownership.
0079      */
0080     void UseWorkspace();     // Take ownership
0081     void ReleaseWorkspace(); // Release ownership
0082     void DestroyWorkspace(); // Release ownership and destroy
0083 
0084     /**
0085      * Method to be called at start of each run (especially at the
0086      * 2nd and further runs).
0087      */
0088     void InitialiseWorkspace();
0089 
0090     /**
0091      * Accessor/modifier for verbosity.
0092      */
0093     inline void SetVerbose(G4bool v) { fVerbose=v; } 
0094     inline G4bool GetVerbose()  { return fVerbose; } 
0095 
0096     /**
0097      * Accessor to the object pool.
0098      */
0099     static pool_type* GetPool();
0100 
0101   private:
0102 
0103     /**
0104      * Does nothing.
0105      */
0106     void InitialiseSolids();
0107 
0108   private:
0109 
0110     /** Helper pointers - can be per instance or shared. */
0111     G4PlSideManager* fpPolyconeSideSIM = nullptr;
0112     G4PhSideManager* fpPolyhedraSideSIM = nullptr;
0113   
0114     // Per Instance variables
0115     // NOTE: the ownership of the Data Arrays is IN this object
0116  
0117     /** Store SubInstanceManager object pointers (SIM pointers). */
0118     G4PlSideData* fPolyconeSideOffset = nullptr;
0119     G4PhSideData* fPolyhedraSideOffset = nullptr;
0120 
0121     G4bool fVerbose = false;
0122 };
0123 
0124 #endif // G4SOLIDSWORKSPACE_HH