Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-20 08:37:38

0001 /*
0002  * TUnplacedBooleanMinusVolume.h
0003  *
0004  *  Created on: Aug 13, 2014
0005  *      Author: swenzel
0006  */
0007 
0008 #ifndef TUNPLACEDBOOLEANMINUSVOLUME_H_
0009 #define TUNPLACEDBOOLEANMINUSVOLUME_H_
0010 
0011 #include "VecGeom/base/Cuda.h"
0012 #include "VecGeom/base/Global.h"
0013 #include "VecGeom/base/AlignedBase.h"
0014 #include "VecGeom/base/Vector3D.h"
0015 #include "VecGeom/volumes/UnplacedVolume.h"
0016 // #include "VecGeom/volumes/TSpecializedBooleanMinusVolume.h"
0017 
0018 namespace VECGEOM_NAMESPACE {
0019 
0020 /**
0021  * A class representing a simple UNPLACED substraction boolean volume A-B
0022  * It takes two template arguments:
0023  * 1.: the mother (or left) volume A in unplaced form
0024  * 2.: the subtraction (or right) volume B in placed form; the placement is with respect to the left volume
0025  *
0026  *
0027  * Example:
0028  *
0029  * typedef TUnplacedBooleanMinusVolume<UnplacedBox,
0030  *           SpecializedBox<translation::kGeneric,rotation::kIdentity> > BoxMinusTranslatedBox_t
0031  *
0032  *
0033  * will be a boolean solid where two boxes are subtracted
0034  * and B is only translated (not rotated) with respect to A
0035  *
0036  */
0037 // template< typename LeftUnplacedVolume_t, typename RightPlacedVolume_t >
0038 typedef VPlacedVolume LeftUnplacedVolume_t;
0039 typedef VPlacedVolume RightPlacedVolume_t;
0040 class TUnplacedBooleanMinusVolume : public VUnplacedVolume, public AlignedBase {
0041 
0042 public:
0043   VPlacedVolume const *fLeftVolume;
0044   VPlacedVolume const *fRightVolume;
0045   // LeftUnplacedVolume_t const* fLeftVolume;
0046   // RightPlacedVolume_t  const* fRightVolume;
0047 
0048 public:
0049   // need a constructor
0050   TUnplacedBooleanMinusVolume(LeftUnplacedVolume_t const *left, RightPlacedVolume_t const *right)
0051       : fLeftVolume(left), fRightVolume(right)
0052   {
0053   }
0054 
0055   typedef LeftUnplacedVolume_t LeftType;
0056   typedef RightPlacedVolume_t RightType;
0057 
0058   virtual int MemorySize() const { return sizeof(*this); }
0059 
0060 #ifdef VECGEOM_CUDA_INTERFACE
0061   virtual VUnplacedVolume *CopyToGpu() const;
0062   virtual VUnplacedVolume *CopyToGpu(VUnplacedVolume *const gpu_ptr) const;
0063 #endif
0064 
0065   VECCORE_ATT_HOST_DEVICE
0066   VECGEOM_FORCE_INLINE
0067   Precision Capacity() const
0068   {
0069     // TBDONE -- need some sampling
0070     return 0.;
0071   }
0072 
0073   VECCORE_ATT_HOST_DEVICE
0074   VECGEOM_FORCE_INLINE
0075   Precision SurfaceArea() const
0076   {
0077     // TBDONE -- need some sampling
0078     return 0.;
0079   }
0080 
0081   VECCORE_ATT_HOST_DEVICE
0082   void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const {
0083       // TBDONE
0084   };
0085 
0086   VECCORE_ATT_HOST_DEVICE
0087   virtual void Print() const {};
0088 
0089   virtual void Print(std::ostream &os) const {};
0090 
0091 #ifndef VECCORE_CUDA
0092   template <typename LeftUnplacedVolume_t, typename RightPlacedVolume_t>
0093   static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0094                                VPlacedVolume *const placement = NULL)
0095   {
0096   }
0097 
0098   static VPlacedVolume *CreateSpecializedVolume(LogicalVolume const *const volume,
0099                                                 Transformation3D const *const transformation,
0100                                                 VPlacedVolume *const placement = NULL)
0101   {
0102   }
0103 
0104 #else // for CUDA
0105   VECCORE_ATT_DEVICE
0106   static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0107                                const int id, VPlacedVolume *const placement = NULL);
0108 
0109   VECCORE_ATT_DEVICE static VPlacedVolume *CreateSpecializedVolume(LogicalVolume const *const volume,
0110                                                                    Transformation3D const *const transformation,
0111                                                                    const int id, VPlacedVolume *const placement = NULL);
0112 #endif
0113 
0114 private:
0115 #ifndef VECCORE_CUDA
0116   virtual VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0117                                            Transformation3D const *const transformation,
0118                                            VPlacedVolume *const placement = NULL) const
0119   {
0120     return CreateSpecializedVolume(volume, transformation, placement);
0121   }
0122 #else
0123   VECCORE_ATT_DEVICE virtual VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0124                                                               Transformation3D const *const transformation,
0125                                                               const int id, VPlacedVolume *const placement = NULL) const
0126   {
0127     return CreateSpecializedVolume(volume, transformation, id, placement);
0128   }
0129 #endif
0130 
0131 }; // End class
0132 
0133 } // namespace VECGEOM_NAMESPACE
0134 
0135 #endif /* TUNPLACEDBOOLEANMINUSVOLUME_H_ */