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;
}
|