Commit bb455751 authored by Martin Kostelnik's avatar Martin Kostelnik
Browse files

Implement ApproachSolid utility and store BBox in UnplacedVolume

parent 3879e33c
......@@ -43,7 +43,7 @@ private:
Vector3D<Precision> fUpperCorner;
void SetLogicalVolume(LogicalVolume *lv) { fLogicalVolume = lv; }
void UpdateExtent() { UnplacedAssembly::Extent(fLowerCorner, fUpperCorner); }
void UpdateExtent() { UnplacedAssembly::Extent(fLowerCorner, fUpperCorner); ComputeBBox(); }
friend class LogicalVolume;
public:
......
......@@ -59,6 +59,7 @@ public:
: fBoolean(op, left, right)
{
fGlobalConvexity = false;
VUnplacedVolume::ComputeBBox();
#ifndef VECCORE_CUDA
if (fBoolean.fLeftVolume->IsAssembly() || fBoolean.fRightVolume->IsAssembly()) {
throw std::runtime_error("Trying to make boolean out of assembly which is not supported\n");
......
......@@ -23,17 +23,19 @@ private:
public:
using Kernel = BoxImplementation;
UnplacedBox(Vector3D<Precision> const &dim) : fBox(dim) {}
UnplacedBox(char const *, Vector3D<Precision> const &dim) : fBox(dim) {}
UnplacedBox(Vector3D<Precision> const &dim) : fBox(dim) { ComputeBBox(); }
UnplacedBox(char const *, Vector3D<Precision> const &dim) : fBox(dim) { ComputeBBox(); }
VECCORE_ATT_HOST_DEVICE
UnplacedBox(const Precision dx, const Precision dy, const Precision dz) : fBox(dx, dy, dz)
{
fGlobalConvexity = true;
ComputeBBox();
}
UnplacedBox(char const *, const Precision dx, const Precision dy, const Precision dz) : fBox(dx, dy, dz)
{
fGlobalConvexity = true;
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -30,13 +30,14 @@ public:
*
*/
VECCORE_ATT_HOST_DEVICE
UnplacedCoaxialCones() {}
UnplacedCoaxialCones() { ComputeBBox(); }
VECCORE_ATT_HOST_DEVICE
UnplacedCoaxialCones(unsigned int numOfCones, Precision *rmin1Vect, Precision *rmax1Vect, Precision *rmin2Vect,
Precision *rmax2Vect, Precision dz, Precision sphi, Precision dphi)
: fCoaxialCones(numOfCones, rmin1Vect, rmax1Vect, rmin2Vect, rmax2Vect, dz, sphi, dphi)
{
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -52,6 +52,7 @@ public:
: fCone(rmin1, rmax1, rmin2, rmax2, dz, phimin, deltaphi)
{
DetectConvexity();
ComputeBBox();
}
// Constructor needed by specialization when Cone becomes Tube
......@@ -59,6 +60,7 @@ public:
: fCone(rmin, rmax, rmin, rmax, dz, phimin, deltaphi)
{
DetectConvexity();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -29,7 +29,7 @@ private:
public:
VECCORE_ATT_HOST_DEVICE
UnplacedCutTube() : fCutTube() {}
UnplacedCutTube() : fCutTube() { ComputeBBox(); }
VECCORE_ATT_HOST_DEVICE
UnplacedCutTube(Precision const &rmin, Precision const &rmax, Precision const &z, Precision const &sphi,
......@@ -46,6 +46,7 @@ public:
#endif
}
DetectConvexity();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......@@ -64,6 +65,7 @@ public:
#endif
}
DetectConvexity();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -31,7 +31,10 @@ private:
public:
/** @brief Dummy constructor */
VECCORE_ATT_HOST_DEVICE
UnplacedExtruded() : fXtru() {}
UnplacedExtruded() : fXtru()
{
ComputeBBox();
}
/** @brief Constructor providing polygone vertices and sections */
VECCORE_ATT_HOST_DEVICE
......@@ -39,6 +42,7 @@ public:
: fXtru(nvertices, vertices, nsections, sections)
{
fGlobalConvexity = (nsections == 2) && fXtru.IsConvexPolygon();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......@@ -46,6 +50,7 @@ public:
: fXtru(nvertices, x, y, zmin, zmax)
{
fGlobalConvexity = fXtru.IsConvexPolygon();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -46,6 +46,7 @@ public:
: fGenTrap(verticesx, verticesy, halfzheight)
{
fGlobalConvexity = !fGenTrap.fIsTwisted;
ComputeBBox();
}
/** @brief UnplacedGenTrap destructor */
......
......@@ -42,7 +42,7 @@ public:
*
*/
VECCORE_ATT_HOST_DEVICE
UnplacedGenericPolycone() {}
UnplacedGenericPolycone();
VECCORE_ATT_HOST_DEVICE
UnplacedGenericPolycone(Precision phiStart, // initial phi starting angle
......
......@@ -57,6 +57,7 @@ public:
: fHype(rMin, rMax, stIn, stOut, dz)
{
DetectConvexity();
ComputeBBox();
}
/// Getter for the structure storing hyperboloid data.
......
......@@ -29,7 +29,11 @@ protected:
public:
// the constructor
VECCORE_ATT_HOST_DEVICE
UnplacedMultiUnion() : fMultiUnion() { fGlobalConvexity = false; }
UnplacedMultiUnion() : fMultiUnion()
{
fGlobalConvexity = false;
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
VECGEOM_FORCE_INLINE
......
......@@ -50,6 +50,7 @@ public:
: fPara(dimensions, alpha, theta, phi)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Constructor from three dimensions and three angles
......@@ -65,6 +66,7 @@ public:
: fPara(dx, dy, dz, alpha, theta, phi)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Default constructor
......
......@@ -49,6 +49,7 @@ public:
fPolycone.fEqualRmax = true;
fPolycone.Init(phistart, deltaphi, Nz, z, rMin, rMax);
DetectConvexity();
ComputeBBox();
}
// Constructor needed by specialization when Polycone becomes Tube
......@@ -69,6 +70,7 @@ public:
fPolycone.fEqualRmax = true;
fPolycone.Init(phistart, deltaphi, Nz, z, rMin, rMax);
DetectConvexity();
ComputeBBox();
}
// the constructor
......@@ -82,6 +84,7 @@ public:
fPolycone.fEqualRmax = true;
fPolycone.Init(phistart, deltaphi, Nz, z, rmin, rmax);
DetectConvexity();
ComputeBBox();
}
// alternative constructor, required for integration with Geant4
......
......@@ -28,10 +28,14 @@ public:
UnplacedSExtruVolume(int nvertices, Precision *x, Precision *y, Precision lowerz, Precision upperz)
: fPolyShell(nvertices, x, y, lowerz, upperz)
{
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
UnplacedSExtruVolume(UnplacedSExtruVolume const &other) : fPolyShell(other.fPolyShell) {}
UnplacedSExtruVolume(UnplacedSExtruVolume const &other) : fPolyShell(other.fPolyShell)
{
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
PolygonalShell const &GetStruct() const { return fPolyShell; }
......
......@@ -58,7 +58,11 @@ public:
public:
/// Dummy ctor
VECCORE_ATT_HOST_DEVICE
UnplacedScaledShape() : fScaled() { fGlobalConvexity = fScaled.fPlaced->GetUnplacedVolume()->IsConvex(); }
UnplacedScaledShape() : fScaled()
{
fGlobalConvexity = fScaled.fPlaced->GetUnplacedVolume()->IsConvex();
ComputeBBox();
}
/// Constructor based on placed volume
VECCORE_ATT_HOST_DEVICE
......@@ -66,6 +70,7 @@ public:
: fScaled(placed, sx, sy, sz)
{
fGlobalConvexity = fScaled.fPlaced->GetUnplacedVolume()->IsConvex();
ComputeBBox();
}
#if defined(VECCORE_CUDA)
......@@ -95,6 +100,7 @@ public:
LogicalVolume *lvol = new LogicalVolume("", shape);
fScaled.fPlaced = lvol->Place();
fGlobalConvexity = fScaled.fPlaced->GetUnplacedVolume()->IsConvex();
ComputeBBox();
}
#endif
......@@ -105,6 +111,7 @@ public:
fScaled.fPlaced = other.fScaled.fPlaced->GetLogicalVolume()->Place();
fScaled.fScale = other.fScaled.fScale;
fGlobalConvexity = other.fGlobalConvexity;
ComputeBBox();
}
/// Assignment operator
......
......@@ -41,7 +41,11 @@ protected:
public:
/// Default constructor for the unplaced tessellated shape class.
VECCORE_ATT_HOST_DEVICE
UnplacedTessellated() : fTessellated() { fGlobalConvexity = false; }
UnplacedTessellated() : fTessellated()
{
fGlobalConvexity = false;
ComputeBBox();
}
/// Getter for the TessellatedStruct object containing the actual data (facets, vertices, clusters of facets)
/** @return The tessellatedStruct object */
......
......@@ -70,6 +70,7 @@ public:
fTorus.fRtor + fTorus.fRmax + kTolerance, fTorus.fRmax, _sphi, _dphi);
DetectConvexity();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
......@@ -59,11 +59,16 @@ public:
{
fGlobalConvexity = true;
MakePlanes();
ComputeBBox();
}
// default constructor
VECCORE_ATT_HOST_DEVICE
UnplacedTrapezoid() : fTrap(0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.) { fGlobalConvexity = true; }
UnplacedTrapezoid() : fTrap(0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// \brief Fast constructor: all parameters from one array
VECCORE_ATT_HOST_DEVICE
......@@ -71,6 +76,7 @@ public:
: UnplacedTrapezoid(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7],
params[8], params[9], params[10])
{
ComputeBBox();
}
/// \brief Constructor based on 8 corner points
......
......@@ -36,14 +36,22 @@ private:
public:
/// Default constructor
VECCORE_ATT_HOST_DEVICE
UnplacedTrd() : fTrd() { fGlobalConvexity = true; }
UnplacedTrd() : fTrd()
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Constructor, special case where Trd is a box
/// @param x Half-length in x
/// @param y Half-length in y
/// @param z Half-length in z
VECCORE_ATT_HOST_DEVICE
UnplacedTrd(const Precision x, const Precision y, const Precision z) : fTrd(x, y, z) { fGlobalConvexity = true; }
UnplacedTrd(const Precision x, const Precision y, const Precision z) : fTrd(x, y, z)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Constructor, special case where y dimension remains constant
/// @param x1 Half-length along x at the surface positioned at -dz
......@@ -54,6 +62,7 @@ public:
UnplacedTrd(const Precision x1, const Precision x2, const Precision y, const Precision z) : fTrd(x1, x2, y, z)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Constructor
......@@ -67,6 +76,7 @@ public:
: fTrd(x1, x2, y1, y2, z)
{
fGlobalConvexity = true;
ComputeBBox();
}
/// Getter for the structure storing Trd data
......
......@@ -30,6 +30,7 @@ public:
: fTube(_rmin, _rmax, _z, _sphi, _dphi)
{
DetectConvexity();
ComputeBBox();
}
VECCORE_ATT_HOST_DEVICE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment