File: Rectangles.cpp

package info (click to toggle)
vecgeom 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,928 kB
  • sloc: cpp: 88,717; ansic: 6,894; python: 1,035; sh: 582; sql: 538; makefile: 29
file content (37 lines) | stat: -rw-r--r-- 921 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "VecGeom/volumes/Rectangles.h"

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);
  fCorners[1].reserve(size);
}
#else
Rectangles::Rectangles(int size) : fPlanes(size), fSides(size), fCorners{size, size}
{
}
#endif

Rectangles::~Rectangles()
{
}

std::ostream &operator<<(std::ostream &os, Rectangles const &rhs)
{
  for (int i = 0, iMax = rhs.size(); i < iMax; ++i) {
    Vector3D<Precision> normal = rhs.GetNormal(i);
    os << "{(" << normal[0] << ", " << normal[1] << ", " << normal[2] << ", " << rhs.GetDistance(i) << ") at "
       << rhs.GetCenter(i) << ", corners in " << rhs.GetCorner(0, i) << " and " << rhs.GetCorner(1, i) << ", side "
       << rhs.GetSide(i) << "}\n";
  }
  return os;
}

} // End inline impl namespace

} // End global namespace