Commit df737d9e authored by Jonas Hahnfeld's avatar Jonas Hahnfeld
Browse files

Consistently mark functions with VECCORE_ATT_HOST_DEVICE

CUDA support in Clang requires that all definitions and declarations
specify a consistent set of attributes.
parent 4b68c2b4
......@@ -120,6 +120,7 @@ Array<Type>::~Array()
}
template <typename Type>
VECCORE_ATT_HOST_DEVICE
void Array<Type>::Allocate(const unsigned initSize)
{
Deallocate();
......@@ -132,6 +133,7 @@ void Array<Type>::Allocate(const unsigned initSize)
}
template <typename Type>
VECCORE_ATT_HOST_DEVICE
void Array<Type>::Deallocate()
{
if (fAllocated) {
......
......@@ -262,6 +262,7 @@ size_t SOA3D<T>::capacity() const
}
template <typename T>
VECCORE_ATT_HOST_DEVICE
void SOA3D<T>::resize(size_t newSize)
{
assert(newSize <= fCapacity);
......
......@@ -495,6 +495,7 @@ public:
// Transformation3D const * GetGlobalMatrixFromPath() const;
}; // end of class
VECCORE_ATT_HOST_DEVICE
NavStatePath &NavStatePath::operator=(NavStatePath const &rhs)
{
if (this != &rhs) {
......@@ -524,6 +525,7 @@ NavStatePath::NavStatePath( NavStatePath const & rhs ) :
*/
// private implementation of standard constructor
VECCORE_ATT_HOST_DEVICE
NavStatePath::NavStatePath(size_t nvalues) : fCurrentLevel(0), fCache(-1), fOnBoundary(false), fPath(nvalues)
{
// clear the buffer
......@@ -533,6 +535,7 @@ NavStatePath::NavStatePath(size_t nvalues) : fCurrentLevel(0), fCache(-1), fOnBo
VECCORE_ATT_HOST_DEVICE
NavStatePath::~NavStatePath() {}
VECCORE_ATT_HOST_DEVICE
void NavStatePath::Pop()
{
if (fCurrentLevel > 0) {
......@@ -546,6 +549,7 @@ void NavStatePath::Pop()
}
}
VECCORE_ATT_HOST_DEVICE
void NavStatePath::Clear()
{
fCurrentLevel = 0;
......@@ -556,6 +560,7 @@ void NavStatePath::Clear()
#endif
}
VECCORE_ATT_HOST_DEVICE
void NavStatePath::Push(VPlacedVolume const *v)
{
#ifdef DEBUG
......@@ -568,6 +573,7 @@ void NavStatePath::Push(VPlacedVolume const *v)
}
// Allow pushing by child index
VECCORE_ATT_HOST_DEVICE
void NavStatePath::Push(unsigned short child)
{
if (fCurrentLevel > 0) {
......@@ -582,6 +588,7 @@ void NavStatePath::Push(unsigned short child)
}
}
VECCORE_ATT_HOST_DEVICE
void NavStatePath::PushIndexType(NavStateIndex_t v)
{
#ifdef DEBUG
......@@ -593,6 +600,7 @@ void NavStatePath::PushIndexType(NavStateIndex_t v)
#endif
}
VECCORE_ATT_HOST_DEVICE
VPlacedVolume const *NavStatePath::Top() const
{
return (fCurrentLevel > 0) ? ToPlacedVolume(fPath[fCurrentLevel - 1]) : nullptr;
......
......@@ -442,6 +442,7 @@ private:
#ifdef SPECIALIZE
template <>
VECCORE_ATT_HOST_DEVICE
inline bool PlanarPolygon::ContainsConvex(Vector3D<Precision> const &point) const
{
const size_t S = fVertices.size();
......@@ -454,6 +455,7 @@ inline bool PlanarPolygon::ContainsConvex(Vector3D<Precision> const &point) cons
}
template <>
VECCORE_ATT_HOST_DEVICE
inline bool PlanarPolygon::Contains(Vector3D<Precision> const &point) const
{
......@@ -507,6 +509,7 @@ inline bool PlanarPolygon::Contains(Vector3D<Precision> const &point) const
}
template <>
VECCORE_ATT_HOST_DEVICE
inline Inside_t PlanarPolygon::InsideConvex(Vector3D<Precision> const &point) const
{
const size_t S = fVertices.size();
......@@ -523,6 +526,7 @@ inline Inside_t PlanarPolygon::InsideConvex(Vector3D<Precision> const &point) co
// template specialization for convex safety
template <>
VECCORE_ATT_HOST_DEVICE
inline Precision PlanarPolygon::SafetyConvex(Vector3D<Precision> const &point, bool inside) const
{
const size_t S = fVertices.size();
......@@ -538,6 +542,7 @@ inline Precision PlanarPolygon::SafetyConvex(Vector3D<Precision> const &point, b
// template specialization for scalar safety
template <>
VECCORE_ATT_HOST_DEVICE
inline Precision PlanarPolygon::SafetySqr(Vector3D<Precision> const &point, int &closestid) const
{
using Real_v = vecgeom::VectorBackend::Real_v;
......
......@@ -300,6 +300,7 @@ public:
#ifdef SPECIALIZATION
// template specialization for Distance functions
template <>
VECCORE_ATT_HOST_DEVICE
inline Precision PolygonalShell::DistanceToOutConvex(Vector3D<Precision> const &point,
Vector3D<Precision> const &dir) const
{
......@@ -327,6 +328,7 @@ inline Precision PolygonalShell::DistanceToOutConvex(Vector3D<Precision> const &
// template specialization for Distance functions
template <>
VECCORE_ATT_HOST_DEVICE
inline Precision PolygonalShell::DistanceToInConvex(Vector3D<Precision> const &point,
Vector3D<Precision> const &dir) const
{
......
......@@ -94,6 +94,7 @@ BVH::BVH(LogicalVolume const *volume, int depth, int *dPrimId, AABB *dAABBs, int
}
#endif
VECCORE_ATT_HOST_DEVICE
void BVH::Print() const
{
printf("BVH(%u): addr: %p, depth: %d, nodes: %d, children: %lu\n", fLV.id(), this, fDepth, (2 << fDepth) - 1,
......@@ -206,6 +207,7 @@ void BVH::ComputeNodes(unsigned int id, int *first, int *last, unsigned int node
* sum of children in the left+right child nodes will be less than for the current node.
*/
VECCORE_ATT_HOST_DEVICE
void BVH::CheckDaughterIntersections(Vector3D<Precision> localpoint, Vector3D<Precision> localdir, Precision &step,
VPlacedVolume const *last, VPlacedVolume const *&hitcandidate) const
{
......@@ -257,6 +259,7 @@ void BVH::CheckDaughterIntersections(Vector3D<Precision> localpoint, Vector3D<Pr
} while (ptr > stack);
}
VECCORE_ATT_HOST_DEVICE
void BVH::ApproachNextDaughter(Vector3D<Precision> localpoint, Vector3D<Precision> localdir, Precision &step,
VPlacedVolume const *last) const
{
......@@ -313,6 +316,7 @@ void BVH::ApproachNextDaughter(Vector3D<Precision> localpoint, Vector3D<Precisio
* computes only the safety instead of the intersection using a ray, so the logic is a bit simpler.
*/
VECCORE_ATT_HOST_DEVICE
Precision BVH::ComputeSafety(Vector3D<Precision> localpoint, Precision safety) const
{
int stack[BVH_MAX_DEPTH] = {0}, *ptr = &stack[1];
......@@ -351,6 +355,7 @@ Precision BVH::ComputeSafety(Vector3D<Precision> localpoint, Precision safety) c
return safety;
}
VECCORE_ATT_HOST_DEVICE
bool BVH::LevelLocate(Vector3D<Precision> const &localpoint, VPlacedVolume const *&pvol,
Vector3D<Precision> &daughterlocalpoint) const
{
......@@ -382,6 +387,7 @@ bool BVH::LevelLocate(Vector3D<Precision> const &localpoint, VPlacedVolume const
return false;
}
VECCORE_ATT_HOST_DEVICE
bool BVH::LevelLocate(Vector3D<Precision> const &localpoint, NavigationState &state,
Vector3D<Precision> &daughterlocalpoint) const
{
......@@ -413,6 +419,7 @@ bool BVH::LevelLocate(Vector3D<Precision> const &localpoint, NavigationState &st
return false;
}
VECCORE_ATT_HOST_DEVICE
bool BVH::LevelLocate(VPlacedVolume const *exclvol, Vector3D<Precision> const &localpoint, VPlacedVolume const *&pvol,
Vector3D<Precision> &daughterlocalpoint) const
{
......@@ -444,6 +451,7 @@ bool BVH::LevelLocate(VPlacedVolume const *exclvol, Vector3D<Precision> const &l
return false;
}
VECCORE_ATT_HOST_DEVICE
bool BVH::LevelLocate(VPlacedVolume const *exclvol, Vector3D<Precision> const &localpoint,
Vector3D<Precision> const &localdirection, VPlacedVolume const *&pvol,
Vector3D<Precision> &daughterlocalpoint) const
......
......@@ -48,6 +48,7 @@ void BVHManager::DeviceInit()
}
#endif
VECCORE_ATT_HOST_DEVICE
BVH const *BVHManager::GetBVH(int id)
{
#ifndef VECCORE_CUDA_DEVICE_COMPILATION
......
......@@ -57,6 +57,7 @@ void Planes::Set(int index, Vector3D<Precision> const &normal, Precision distanc
fDistances[index] = distance;
}
VECCORE_ATT_HOST_DEVICE
void Planes::FlipSign(int index)
{
fNormals.set(index, -fNormals[index]);
......
......@@ -39,6 +39,7 @@ Quadrilaterals::~Quadrilaterals()
{
}
VECCORE_ATT_HOST_DEVICE
Quadrilaterals &Quadrilaterals::operator=(Quadrilaterals const &other)
{
fPlanes = other.fPlanes;
......@@ -136,6 +137,7 @@ void Quadrilaterals::Set(int index, Vector3D<Precision> const &corner0, Vector3D
ComputeSideVector(fSideVectors[3], corner3, corner0);
}
VECCORE_ATT_HOST_DEVICE
void Quadrilaterals::FlipSign(int index)
{
fPlanes.FlipSign(index);
......
......@@ -5,6 +5,7 @@ namespace vecgeom {
inline namespace VECGEOM_IMPL_NAMESPACE {
#ifdef VECCORE_CUDA
VECCORE_ATT_HOST_DEVICE
Rectangles::Rectangles(int size) : fPlanes(size), fSides(size)
{
fCorners[0].reserve(size);
......
......@@ -29,6 +29,7 @@ const Transformation3D Transformation3D::kIdentity = Transformation3D();
// SetProperties();
//}
VECCORE_ATT_HOST_DEVICE
Transformation3D::Transformation3D(const Precision tx, const Precision ty, const Precision tz, const Precision phi,
const Precision theta, const Precision psi)
: fIdentity(false), fHasRotation(true), fHasTranslation(true)
......@@ -38,6 +39,7 @@ Transformation3D::Transformation3D(const Precision tx, const Precision ty, const
SetProperties();
}
VECCORE_ATT_HOST_DEVICE
Transformation3D::Transformation3D(const Precision tx, const Precision ty, const Precision tz, const Precision r0,
const Precision r1, const Precision r2, const Precision r3, const Precision r4,
const Precision r5, const Precision r6, const Precision r7, const Precision r8)
......@@ -48,6 +50,7 @@ Transformation3D::Transformation3D(const Precision tx, const Precision ty, const
SetProperties();
}
VECCORE_ATT_HOST_DEVICE
Transformation3D::Transformation3D(const Vector3D<Precision> &axis, bool inverse)
{
SetTranslation(0, 0, 0);
......
......@@ -9,6 +9,7 @@
namespace vecgeom {
inline namespace VECGEOM_IMPL_NAMESPACE {
VECCORE_ATT_HOST_DEVICE
UnplacedAssembly::UnplacedAssembly() : fLogicalVolume(nullptr), fLowerCorner(-kInfLength), fUpperCorner(kInfLength)
{
fIsAssembly = true;
......@@ -33,6 +34,7 @@ void UnplacedAssembly::Print(std::ostream &os) const
}
//______________________________________________________________________________
VECCORE_ATT_HOST_DEVICE
void UnplacedAssembly::Extent(Vector3D<Precision> &aMin, Vector3D<Precision> &aMax) const
{
#ifndef VECCORE_CUDA
......
......@@ -442,6 +442,7 @@ void TransformedExtent(VPlacedVolume const *pvol, Vector3D<Precision> &aMin, Vec
}
template <>
VECCORE_ATT_HOST_DEVICE
void UnplacedBooleanVolume<kSubtraction>::Extent(Vector3D<Precision> &aMin, Vector3D<Precision> &aMax) const
{
Vector3D<Precision> minLeft, maxLeft, minRight, maxRight;
......@@ -457,6 +458,7 @@ void UnplacedBooleanVolume<kSubtraction>::Extent(Vector3D<Precision> &aMin, Vect
}
template <>
VECCORE_ATT_HOST_DEVICE
void UnplacedBooleanVolume<kUnion>::Extent(Vector3D<Precision> &aMin, Vector3D<Precision> &aMax) const
{
Vector3D<Precision> minLeft, maxLeft, minRight, maxRight;
......@@ -474,6 +476,7 @@ void UnplacedBooleanVolume<kUnion>::Extent(Vector3D<Precision> &aMin, Vector3D<P
}
template <>
VECCORE_ATT_HOST_DEVICE
void UnplacedBooleanVolume<kIntersection>::Extent(Vector3D<Precision> &aMin, Vector3D<Precision> &aMax) const
{
Vector3D<Precision> minLeft, maxLeft, minRight, maxRight;
......
......@@ -31,6 +31,7 @@ std::ostream &UnplacedCoaxialCones::StreamInfo(std::ostream &os) const
return os;
}
VECCORE_ATT_HOST_DEVICE
void UnplacedCoaxialCones::Print() const
{
printf("CoaxialCones");
......
......@@ -49,6 +49,7 @@ G4VSolid const *UnplacedCone::ConvertToGeant4(char const *label) const
#endif
#endif
VECCORE_ATT_HOST_DEVICE
void UnplacedCone::Print() const
{
printf("UnplacedCone {rmin1 %.2f, rmax1 %.2f, rmin2 %.2f, "
......
......@@ -19,6 +19,7 @@
namespace vecgeom {
inline namespace VECGEOM_IMPL_NAMESPACE {
VECCORE_ATT_HOST_DEVICE
void UnplacedCutTube::Print() const
{
printf("UnplacedCutTube {rmin=%.2f, rmax=%.2f, z=%.2f, sphi=%.2f, dphi=%.2f bottom=(%f, %f, %f) top=(%f, %f, %f)}",
......
......@@ -254,6 +254,7 @@ std::ostream &UnplacedEllipsoid::StreamInfo(std::ostream &os) const
return os;
}
VECCORE_ATT_HOST_DEVICE
void UnplacedEllipsoid::Print() const
{
printf("Ellipsoid {%.2f, %.2f, %.2f, %.2f, %.2f}", fEllipsoid.fDx, fEllipsoid.fDy, fEllipsoid.fDz,
......
......@@ -185,6 +185,7 @@ std::ostream &UnplacedEllipticalCone::StreamInfo(std::ostream &os) const
return os;
}
VECCORE_ATT_HOST_DEVICE
void UnplacedEllipticalCone::Print() const
{
printf("EllipticalCone {%.2f, %.2f, %.2f, %.2f}", fEllipticalCone.fDx, fEllipticalCone.fDy, fEllipticalCone.fDz,
......
......@@ -129,6 +129,7 @@ std::ostream &UnplacedEllipticalTube::StreamInfo(std::ostream &os) const
return os;
}
VECCORE_ATT_HOST_DEVICE
void UnplacedEllipticalTube::Print() const
{
printf("EllipticalTube {%.2f, %.2f, %.2f}", fEllipticalTube.fDx, fEllipticalTube.fDy, fEllipticalTube.fDz);
......
......@@ -147,6 +147,7 @@ Vector3D<Precision> UnplacedGenericPolycone::SamplePointOnSurface() const
return coneUnplaced->SamplePointOnSurface();
}
VECCORE_ATT_HOST_DEVICE
void UnplacedGenericPolycone::Print() const
{
// Provided Elliptical Cone Parameters as done for Tube below
......
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