File: NavigationSpecializerTest.cpp

package info (click to toggle)
vecgeom 1.2.8%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 24,016 kB
  • sloc: cpp: 88,803; ansic: 6,888; python: 1,035; sh: 582; sql: 538; makefile: 23
file content (52 lines) | stat: -rw-r--r-- 1,551 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
49
50
51
52
/*
 * NavigationSpecializerTest.cpp
 *
 *  Created on: 11.09.2015
 *      Author: swenzel
 */

#include "source/NavigationSpecializer.h"

#include "VecGeomTest/RootGeoManager.h"

#include <iostream>
#include <fstream>
#include <sstream>
using namespace vecgeom;

int main(int argc, char *argv[])
{
  if (argc < 3) {
    std::cerr << "usage: " << argv[0] << " geometryfile.root volumename [--loopunroll] [--basenav BasicNavigator]\n";
    return 1;
  }

  vecgeom::RootGeoManager::Instance().LoadRootGeometry(argv[1]);

  // we assume a naming convention as in NavigationKernelBenchmarker
  std::stringstream instatestream;
  instatestream << "states_" << argv[1] << "_" << argv[2] << ".bin";
  std::stringstream outstatestream;
  outstatestream << "outstates_" << argv[1] << "_" << argv[2] << "_simple.bin";

  vecgeom::NavigationSpecializer specializer(instatestream.str(), outstatestream.str());
  for (auto i = 3; i < argc; i++) {
    if (strcmp(argv[i], "--basenav") == 0) {
      std::cerr << "setting a basenav\n";
      specializer.SetBaseNavigator(argv[i + 1]);
    }
  }

  for (auto i = 3; i < argc; i++) {
    if (strcmp(argv[i], "--loopunroll") == 0) specializer.EnableLoopUnrolling();
  }

  std::ofstream outputfile;
  std::stringstream outputname;
  // TODO: think about making this an command line option
  outputname << argv[2] << "Navigator.h";
  outputfile.open(outputname.str());
  specializer.ProduceSpecializedNavigator(vecgeom::GeoManager::Instance().FindLogicalVolume(argv[2]), outputfile);
  outputfile.close();
  return 0;
}