Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4BooleanSolid.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // G4BooleanSolid
0027 //
0028 // Class description:
0029 //
0030 // Abstract base class for solids created by boolean operations
0031 // between other solids.
0032 
0033 // 10.09.98 V.Grichine - created
0034 // --------------------------------------------------------------------
0035 #ifndef G4BOOLEANSOLID_HH
0036 #define G4BOOLEANSOLID_HH
0037 
0038 #include "G4DisplacedSolid.hh"
0039 
0040 #include "G4ThreeVector.hh"
0041 #include "G4RotationMatrix.hh"
0042 #include "G4Transform3D.hh"
0043 
0044 #include "G4VBooleanProcessor.hh"
0045 
0046 class HepPolyhedronProcessor;
0047 
0048 
0049 class G4BooleanSolid : public G4VSolid
0050 {
0051   public:
0052  
0053     G4BooleanSolid( const G4String& pName,
0054                           G4VSolid* pSolidA ,
0055                           G4VSolid* pSolidB   );
0056 
0057     G4BooleanSolid( const G4String& pName,
0058                           G4VSolid* pSolidA ,
0059                           G4VSolid* pSolidB,
0060                           G4RotationMatrix* rotMatrix,
0061                     const G4ThreeVector& transVector    );
0062 
0063     G4BooleanSolid( const G4String& pName,
0064                           G4VSolid* pSolidA ,
0065                           G4VSolid* pSolidB , 
0066                     const G4Transform3D& transform   );
0067 
0068     ~G4BooleanSolid() override;
0069 
0070     const G4VSolid* GetConstituentSolid(G4int no) const override;
0071           G4VSolid* GetConstituentSolid(G4int no) override;
0072       // If Solid is made up from a Boolean operation of two solids,
0073       // return the corresponding solid (for no=0 and 1).
0074       // If the solid is not a "Boolean", return 0.
0075 
0076     G4double GetCubicVolume() override;
0077     inline G4double GetSurfaceArea() override;
0078 
0079     G4GeometryType GetEntityType() const override;
0080     G4Polyhedron* GetPolyhedron() const override;
0081 
0082     std::ostream& StreamInfo(std::ostream& os) const override;
0083 
0084     inline G4int GetCubVolStatistics() const;
0085     inline G4double GetCubVolEpsilon() const;
0086     void SetCubVolStatistics(G4int st);
0087     void SetCubVolEpsilon(G4double ep);
0088    
0089     inline G4int GetAreaStatistics() const;
0090     inline G4double GetAreaAccuracy() const;
0091     inline void SetAreaStatistics(G4int st);
0092     inline void SetAreaAccuracy(G4double ep);
0093    
0094     G4ThreeVector GetPointOnSurface() const override;
0095 
0096     G4int GetNumOfConstituents() const override;
0097     G4bool IsFaceted() const override;
0098 
0099     G4BooleanSolid(__void__&);
0100       // Fake default constructor for usage restricted to direct object
0101       // persistency for clients requiring preallocation of memory for
0102       // persistifiable objects.
0103 
0104     G4BooleanSolid(const G4BooleanSolid& rhs);
0105     G4BooleanSolid& operator=(const G4BooleanSolid& rhs);
0106       // Copy constructor and assignment operator.
0107 
0108     static void SetExternalBooleanProcessor(G4VBooleanProcessor* extProcessor);
0109       // Set Boolean processor to replace default processor.
0110     static G4VBooleanProcessor* GetExternalBooleanProcessor();
0111       // Get Boolean processor needed for G4MultiUnion.
0112 
0113   protected:
0114   
0115     void GetListOfPrimitives(std::vector<std::pair<G4VSolid *,G4Transform3D>>&,
0116                              const G4Transform3D&) const;
0117       // Get list of constituent primitives of the solid and their placements.
0118 
0119     G4Polyhedron* StackPolyhedron(HepPolyhedronProcessor&,
0120                                   const G4VSolid*) const;
0121       // Stack polyhedra for processing. Return top polyhedron.
0122 
0123   protected:
0124   
0125     G4VSolid* fPtrSolidA = nullptr;
0126     G4VSolid* fPtrSolidB = nullptr;
0127 
0128     G4double fCubicVolume = -1.0;
0129       // Cached value of Cubic Volume 
0130     G4double fSurfaceArea = -1.0;
0131       // Cached value of Surface Area
0132 
0133     static G4VBooleanProcessor* fExternalBoolProcessor;
0134       // External Boolean processor
0135 
0136   private:
0137 
0138     G4int    fCubVolStatistics = 1000000;
0139     G4int    fAreaStatistics = 1000000;
0140     G4double fCubVolEpsilon = 0.001;
0141     G4double fAreaAccuracy = -1;
0142 
0143     mutable G4bool fRebuildPolyhedron = false;
0144     mutable G4Polyhedron* fpPolyhedron = nullptr;
0145 
0146     mutable std::vector<std::pair<G4VSolid *,G4Transform3D>> fPrimitives;
0147     mutable G4double fPrimitivesSurfaceArea = 0.0;
0148 
0149     G4bool  createdDisplacedSolid = false;
0150       // If & only if this object created it, it must delete it
0151 };
0152 
0153 #include "G4BooleanSolid.icc"
0154 
0155 #endif