|
|
|||
File indexing completed on 2026-09-11 09:12:10
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 // G4UTesselladedSolid 0027 // 0028 // Class description: 0029 // 0030 // Wrapper class for G4TessellatedSolid to make use of VecGeom TessellatedSolid. 0031 0032 // Author: Gabriele Cosmo (CERN), 11.01.2018 0033 // -------------------------------------------------------------------- 0034 #ifndef G4UTESSELLATEDSOLID_HH 0035 #define G4UTESSELLATEDSOLID_HH 0036 0037 #include "G4UAdapter.hh" 0038 0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) ) 0040 0041 #include <VecGeom/volumes/UnplacedTessellated.h> 0042 0043 #include "G4Polyhedron.hh" 0044 #include "G4VFacet.hh" 0045 0046 /** 0047 * @brief G4UTessellatedSolid is a wrapper class for G4TessellatedSolid 0048 * to make use of VecGeom TessellatedSolid. 0049 */ 0050 0051 class G4UTessellatedSolid : public G4UAdapter<vecgeom::UnplacedTessellated> 0052 { 0053 using Shape_t = vecgeom::UnplacedTessellated; 0054 using Base_t = G4UAdapter<vecgeom::UnplacedTessellated>; 0055 0056 public: 0057 0058 /** 0059 * Default Constructor. 0060 */ 0061 G4UTessellatedSolid(); 0062 0063 /** 0064 * Constructor with solid's name. 0065 * @param[in] name The name of the solid. 0066 */ 0067 G4UTessellatedSolid(const G4String& pName); 0068 0069 /** 0070 * Destructor. Clearing all allocated facets and data. 0071 */ 0072 ~G4UTessellatedSolid() override; 0073 0074 /** 0075 * Methods for adding or retrieving a facet given an index. 0076 */ 0077 G4bool AddFacet(G4VFacet* aFacet); 0078 G4VFacet* GetFacet(G4int i) const; 0079 0080 /** 0081 * Returns the total number of facets. 0082 */ 0083 G4int GetNumberOfFacets() const; 0084 0085 /** 0086 * Returns the type ID, "G4TessellatedSolid" of the solid. 0087 */ 0088 inline G4GeometryType GetEntityType() const override; 0089 0090 /** 0091 * Returns true as the solid has only planar faces. 0092 */ 0093 inline G4bool IsFaceted() const override; 0094 0095 /** 0096 * Modifier and accessor to close/finalise the solid. 0097 */ 0098 void SetSolidClosed(const G4bool t); 0099 G4bool GetSolidClosed() const; 0100 0101 /** 0102 * Allowing to tune the maximum number of voxels to use for optimisation. 0103 */ 0104 void SetMaxVoxels(G4int); 0105 0106 /** 0107 * Accessors. 0108 */ 0109 G4double GetMinXExtent() const; 0110 G4double GetMaxXExtent() const; 0111 G4double GetMinYExtent() const; 0112 G4double GetMaxYExtent() const; 0113 G4double GetMinZExtent() const; 0114 G4double GetMaxZExtent() const; 0115 0116 /** 0117 * Loggers reporting the total allocated memory. 0118 */ 0119 G4int AllocatedMemoryWithoutVoxels(); 0120 G4int AllocatedMemory(); 0121 void DisplayAllocatedMemory(); 0122 0123 /** 0124 * Computes the bounding limits of the solid. 0125 * @param[out] pMin The minimum bounding limit point. 0126 * @param[out] pMax The maximum bounding limit point. 0127 */ 0128 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0129 0130 /** 0131 * Calculates the minimum and maximum extent of the solid, when under the 0132 * specified transform, and within the specified limits. 0133 * @param[in] pAxis The axis along which compute the extent. 0134 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0135 * @param[in] pTransform The internal transformation applied to the solid. 0136 * @param[out] pMin The minimum extent value. 0137 * @param[out] pMax The maximum extent value. 0138 * @returns True if the solid is intersected by the extent region. 0139 */ 0140 G4bool CalculateExtent(const EAxis pAxis, 0141 const G4VoxelLimits& pVoxelLimit, 0142 const G4AffineTransform& pTransform, 0143 G4double& pMin, G4double& pMax) const override; 0144 0145 /** 0146 * Returns a generated polyhedron as graphical representations. 0147 */ 0148 G4Polyhedron* CreatePolyhedron() const override; 0149 0150 /** 0151 * Copy constructor and assignment operator. 0152 */ 0153 G4UTessellatedSolid( const G4UTessellatedSolid& source ); 0154 G4UTessellatedSolid& operator=(const G4UTessellatedSolid& source); 0155 0156 private: 0157 0158 std::vector<G4VFacet*> fFacets; 0159 std::vector<G4ThreeVector> fVertexList; 0160 }; 0161 0162 // -------------------------------------------------------------------- 0163 // Inline methods 0164 // -------------------------------------------------------------------- 0165 0166 inline G4GeometryType G4UTessellatedSolid::GetEntityType() const 0167 { 0168 return "G4TessellatedSolid"; 0169 } 0170 0171 inline G4bool G4UTessellatedSolid::IsFaceted() const 0172 { 0173 return true; 0174 } 0175 0176 #endif // G4GEOM_USE_USOLIDS 0177 0178 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|