File: shape_testTessellated.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 (48 lines) | stat: -rw-r--r-- 1,509 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
#ifndef VECGEOM_ENABLE_CUDA

#include "test/benchmark/ArgParser.h"
#include "ShapeTester.h"
#include "VecGeom/volumes/Tessellated.h"
#include "test/core/TessellatedOrb.h"

using namespace vecgeom;
using Tessellated_t = vecgeom::SimpleTessellated;
#endif

int main(int argc, char *argv[])
{
#ifndef VECGEOM_ENABLE_CUDA
  if (argc == 1) {
    std::cout << "Usage: shape_testTessellated <-ngrid N>\n"
                 "       N - number of theta/phi segments for the sphere\n";
  }
  OPTION_INT(npoints, 1000);
  OPTION_BOOL(debug, false);
  OPTION_BOOL(stat, false);
  OPTION_INT(ngrid, 50);
  constexpr double r = 10.;

  Tessellated_t *solid     = 0;
  solid                    = new Tessellated_t("test_VecGeomTessellated");
  UnplacedTessellated *tsl = (UnplacedTessellated *)solid->GetUnplacedVolume();
  size_t nfacets           = TessellatedOrb(r, ngrid, *tsl);
  std::cout << "Testing tessellated sphere with ngrid = " << ngrid << " (nfacets=" << nfacets << ")\n";
  tsl->Close();

  ShapeTester<vecgeom::VPlacedVolume> tester;
  tester.setDebug(debug);
  tester.setStat(stat);
  tester.SetMaxPoints(npoints);
  tester.SetTestBoundaryErrors(false);
  #ifdef VECGEOM_FLOAT_PRECISION
    tester.SetSolidTolerance(1e-5);
  #endif
  int errCode = tester.Run(solid);

  std::cout << "Final Error count for Shape *** " << solid->GetName() << "*** = " << errCode << "\n";
  std::cout << "=========================================================" << std::endl;

  if (solid) delete solid;
#endif
  return 0;
}