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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4BooleanSolid
 27 //
 28 // Class description:
 29 //
 30 // Abstract base class for solids created by boolean operations
 31 // between other solids.
 32 
 33 // 10.09.98 V.Grichine - created
 34 // --------------------------------------------------------------------
 35 #ifndef G4BOOLEANSOLID_HH
 36 #define G4BOOLEANSOLID_HH
 37 
 38 #include "G4DisplacedSolid.hh"
 39 
 40 #include "G4ThreeVector.hh"
 41 #include "G4RotationMatrix.hh"
 42 #include "G4Transform3D.hh"
 43 
 44 #include "G4VBooleanProcessor.hh"
 45 
 46 class HepPolyhedronProcessor;
 47 
 48 
 49 class G4BooleanSolid : public G4VSolid
 50 {
 51   public:
 52  
 53     G4BooleanSolid( const G4String& pName,
 54                           G4VSolid* pSolidA ,
 55                           G4VSolid* pSolidB   );
 56 
 57     G4BooleanSolid( const G4String& pName,
 58                           G4VSolid* pSolidA ,
 59                           G4VSolid* pSolidB,
 60                           G4RotationMatrix* rotMatrix,
 61                     const G4ThreeVector& transVector    );
 62 
 63     G4BooleanSolid( const G4String& pName,
 64                           G4VSolid* pSolidA ,
 65                           G4VSolid* pSolidB , 
 66                     const G4Transform3D& transform   );
 67 
 68     ~G4BooleanSolid() override;
 69 
 70     const G4VSolid* GetConstituentSolid(G4int no) const override;
 71           G4VSolid* GetConstituentSolid(G4int no) override;
 72       // If Solid is made up from a Boolean operation of two solids,
 73       // return the corresponding solid (for no=0 and 1).
 74       // If the solid is not a "Boolean", return 0.
 75 
 76     G4double GetCubicVolume() override;
 77     inline G4double GetSurfaceArea() override;
 78 
 79     G4GeometryType GetEntityType() const override;
 80     G4Polyhedron* GetPolyhedron() const override;
 81 
 82     std::ostream& StreamInfo(std::ostream& os) const override;
 83 
 84     inline G4int GetCubVolStatistics() const;
 85     inline G4double GetCubVolEpsilon() const;
 86     void SetCubVolStatistics(G4int st);
 87     void SetCubVolEpsilon(G4double ep);
 88    
 89     inline G4int GetAreaStatistics() const;
 90     inline G4double GetAreaAccuracy() const;
 91     inline void SetAreaStatistics(G4int st);
 92     inline void SetAreaAccuracy(G4double ep);
 93    
 94     G4ThreeVector GetPointOnSurface() const override;
 95 
 96     G4int GetNumOfConstituents() const override;
 97     G4bool IsFaceted() const override;
 98 
 99     G4BooleanSolid(__void__&);
100       // Fake default constructor for usage restricted to direct object
101       // persistency for clients requiring preallocation of memory for
102       // persistifiable objects.
103 
104     G4BooleanSolid(const G4BooleanSolid& rhs);
105     G4BooleanSolid& operator=(const G4BooleanSolid& rhs);
106       // Copy constructor and assignment operator.
107 
108     static void SetExternalBooleanProcessor(G4VBooleanProcessor* extProcessor);
109       // Set Boolean processor to replace default processor.
110     static G4VBooleanProcessor* GetExternalBooleanProcessor();
111       // Get Boolean processor needed for G4MultiUnion.
112 
113   protected:
114   
115     void GetListOfPrimitives(std::vector<std::pair<G4VSolid *,G4Transform3D>>&,
116                              const G4Transform3D&) const;
117       // Get list of constituent primitives of the solid and their placements.
118 
119     G4Polyhedron* StackPolyhedron(HepPolyhedronProcessor&,
120                                   const G4VSolid*) const;
121       // Stack polyhedra for processing. Return top polyhedron.
122 
123   protected:
124   
125     G4VSolid* fPtrSolidA = nullptr;
126     G4VSolid* fPtrSolidB = nullptr;
127 
128     G4double fCubicVolume = -1.0;
129       // Cached value of Cubic Volume 
130     G4double fSurfaceArea = -1.0;
131       // Cached value of Surface Area
132 
133     static G4VBooleanProcessor* fExternalBoolProcessor;
134       // External Boolean processor
135 
136   private:
137 
138     G4int    fCubVolStatistics = 1000000;
139     G4int    fAreaStatistics = 1000000;
140     G4double fCubVolEpsilon = 0.001;
141     G4double fAreaAccuracy = -1;
142 
143     mutable G4bool fRebuildPolyhedron = false;
144     mutable G4Polyhedron* fpPolyhedron = nullptr;
145 
146     mutable std::vector<std::pair<G4VSolid *,G4Transform3D>> fPrimitives;
147     mutable G4double fPrimitivesSurfaceArea = 0.0;
148 
149     G4bool  createdDisplacedSolid = false;
150       // If & only if this object created it, it must delete it
151 };
152 
153 #include "G4BooleanSolid.icc"
154 
155 #endif
156