예제 #1
0
int main(int argc,char *argv[]) {
  int errCode= 0;
  VUSolid* solid;
  if(argc>1){
    if(strcmp(argv[1],"vec")==0)
    {
      solid = new Trap_t("test_VecGeomTrap",5.,0.,0.,5.,5.,5.,0.,5.,5.,5.,0.);   
    }
    else
    {   
     solid = new UTrap("test_USolidsTrap",40,0,0,30,20,20,0,30,20,20,0);  
     solid->StreamInfo(std::cout);      
    }
  }
  else
    {
     solid = new Trap_t("test_VecGeomTrap",5.,0.,0.,5.,5.,5.,0.,5.,5.,5.,0.);    
    }
  
  ShapeTester tester;

  if(argc>2)
  {
    if(strcmp(argv[2],"vis")==0)
    {
     #ifdef VECGEOM_ROOT
     TApplication theApp("App",0,0);
     errCode = tester.Run(solid);
     theApp.Run();
     #endif
    }
  }
  else
  {
    errCode = tester.Run(solid);
   }
  std::cout<<"Final Error count for Shape *** "<<solid->GetName()<<"*** = "<<errCode<<std::endl;
  std::cout<<"========================================================="<<std::endl;
  return 0;
}
예제 #2
0
int main(int argc, char *argv[])
{
  if (argc == 1) {
    std::cout << "Usage: shape_testPolyhedron -test <#>:\n"
                 "       0 - case 0\n"
                 "       1 - case 1\n";
  }
  OPTION_INT(npoints, 10000);
  OPTION_BOOL(debug, false);
  OPTION_BOOL(stat, false);
  OPTION_INT(type, 0);
  using namespace vecgeom;

  Polyhedron_t *solid = 0;

  switch (type) {
  case 0: {
    // Non-zero alpha, theta, phi
    std::cout << "Testing polyhedron #0\n";
    Precision phiStart = 0., deltaPhi = 120. * kDegToRad;
    int sides               = 4;
    constexpr int nPlanes   = 5;
    double zPlanes[nPlanes] = {-2, -1, 1, 1, 2};
    double rInner[nPlanes]  = {0, 1, 0.5, 1, 0};
    double rOuter[nPlanes]  = {1, 2, 2, 2.5, 1};
    solid = new Polyhedron_t("test_VecGeomPolyhedron", phiStart, deltaPhi, sides, nPlanes, zPlanes, rInner, rOuter);
  } break;
  case 1:
    // Polyhedron degenerated to box
    std::cout << "NOT implemented polyhedron #1\n";
    return 1;
    break;
  default:
    std::cout << "Unknown test case.\n";
  }

  if (!solid) return 0;

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

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

  if (solid) delete solid;
  return 0;
}
예제 #3
0
int main(int argc, char *argv[])
{
  if (argc == 1) {
    std::cout << "Usage: shape_testCutTube -test <#>:\n"
                 "       0 - rmin = 0, dphi = 2*kPi\n"
                 "       1 - rmin > 0, dphi = 2*kPi\n"
                 "       2 - rmin = 0, dphi < 2*kPi\n"
                 "       3 - rmin > 0, dphi < 2*kPi\n"
              << std::endl;
  }
  using namespace vecgeom;

  OPTION_INT(npoints, 10000);
  OPTION_BOOL(debug, false);
  OPTION_BOOL(stat, false);
  OPTION_INT(type, 3);

  double rmin = 0.;
  double rmax = 5.;
  double dz   = 10.;
  double sphi = 0.;
  double dphi = 2 * kPi;
  double thb  = 3 * kPi / 4;
  double phib = kPi / 3;
  double tht  = kPi / 4;
  double phit = 2 * kPi / 3;

  switch (type) {
  case 0:
    break;
  case 1:
    rmin = 3.;
    break;
  case 2:
    dphi = 2 * kPi / 3;
    break;
  case 3:
    rmin = 3.;
    dphi = 2 * kPi / 3;
    break;
  default:
    printf("Unknown test\n");
    return 1;
  }
  Vector3D<double> nbottom(std::sin(thb) * std::cos(phib), std::sin(thb) * std::sin(phib), std::cos(thb));
  Vector3D<double> ntop(std::sin(tht) * std::cos(phit), std::sin(tht) * std::sin(phit), std::cos(tht));

  CutTube_t *cuttube = new CutTube_t("test_VecGeomCutTube", rmin, rmax, dz, sphi, dphi, nbottom, ntop);
  cuttube->Print();

  ShapeTester<vecgeom::VPlacedVolume> tester;
  tester.setDebug(debug);
  tester.setStat(stat);
  tester.SetMaxPoints(npoints);
  tester.SetSolidTolerance(1.e-9);
  tester.SetTestBoundaryErrors(true);
  int errCode = tester.Run(cuttube);

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

  if (cuttube) delete cuttube;
  return 0;
}
예제 #4
0
int main(int argc, char *argv[])
{
  if (argc == 1) {
    std::cout << "Usage: shape_testGenTrap -test <#>:\n"
                 "       0 - twisted\n"
                 "       1 - planar\n"
                 "       2 - one face triangle\n"
                 "       3 - one face line\n"
                 "       4 - one face point\n"
                 "       5 - one face line, other triangle\n"
                 "       6 - degenerated planar\n";
  }
  OPTION_INT(npoints, 10000);
  OPTION_BOOL(debug, false);
  OPTION_BOOL(stat, false);
  OPTION_INT(type, 0);

  using namespace vecgeom;
  // 4 different vertices, twisted
  Precision verticesx0[8] = {-3, -2.5, 3, 2.5, -2, -2, 2, 2};
  Precision verticesy0[8] = {-2.5, 3, 2.5, -3, -2, 2, 2, -2};
  // 4 different vertices, planar
  Precision verticesx1[8] = {-3, -3, 3, 3, -2, -2, 2, 2};
  Precision verticesy1[8] = {-3, 3, 3, -3, -2, 2, 2, -2};
  // 3 different vertices
  Precision verticesx2[8] = {-3, -3, 3, 2.5, -2, -2, 2, 2};
  Precision verticesy2[8] = {-2.5, -2.5, 2.5, -3, -2, 2, 2, -2};
  // 2 different vertices
  Precision verticesx3[8] = {-3, -3, 2.5, 2.5, -2, -2, 2, 2};
  Precision verticesy3[8] = {-2.5, -2.5, -3, -3, -2, 2, 2, -2};
  // 1 vertex (pyramid)
  Precision verticesx4[8] = {-3, -3, -3, -3, -2, -2, 2, 2};
  Precision verticesy4[8] = {-2.5, -2.5, -2.5, -2.5, -2, 2, 2, -2};
  // 2 vertex bottom, 3 vertices top
  Precision verticesx5[8] = {-3, -3, 2.5, 2.5, -2, -2, 2, 2};
  Precision verticesy5[8] = {-2.5, -2.5, -3, -3, -2, -2, 2, -2};
  //
  Precision verticesx6[8] = {-0.507492, -0.507508, 1.522492, -0.507492, -0.507492, -0.507508, 1.522492, -0.507492};
  Precision verticesy6[8] = {-3.634000, 3.63400, 3.634000, -3.634000, -3.634000, 3.634000, 3.634000, -3.634000};
  GenTrap_t *solid        = 0;
  switch (type) {
  case 0:
    // 4 different vertices, twisted
    std::cout << "Testing twisted trapezoid\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx0, verticesy0, 5);
    break;
  case 1:
    // 4 different vertices, planar
    std::cout << "Testing planar trapezoid\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx1, verticesy1, 5);
    break;
  case 2:
    // 3 different vertices
    std::cout << "Testing trapezoid with one face triangle\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx2, verticesy2, 5);
    break;
  case 3:
    // 2 different vertices
    std::cout << "Testing trapezoid with one face line degenerated\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx3, verticesy3, 5);
    break;
  case 4:
    // 1 vertex (pyramid)
    std::cout << "Testing trapezoid with one face point degenerated (pyramid)\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx4, verticesy4, 5);
    break;
  case 5:
    // 2 vertex bottom, 3 vertices top
    std::cout << "Testing trapezoid with line on one face and triangle on other\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx5, verticesy5, 5);
    break;
  case 6:
    // 3 vertexes top, 3 vertexes bottom
    std::cout << "Testing degenerated planar trapezoid\n";
    solid = new GenTrap_t("test_VecGeomGenTrap", verticesx6, verticesy6, 5);
    break;
  default:
    std::cout << "Unknown test case.\n";
  }

  solid->Print();

  ShapeTester<vecgeom::VPlacedVolume> tester;
  tester.setDebug(debug);
  tester.setStat(stat);
  tester.SetMaxPoints(npoints);
  tester.SetSolidTolerance(1.e-7);
  tester.SetTestBoundaryErrors(true);
  int errCode = tester.Run(solid);

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

  if (solid) delete solid;
  return 0;
}