MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / main

Function main

Tools/partio2vtk/main.cpp:43–174  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

41
42// main
43int main(int argc, char **argv)
44{
45 REPORT_MEMORY_LEAKS;
46
47 Utilities::logger.addSink(std::shared_ptr<Utilities::ConsoleSink>(new Utilities::ConsoleSink(Utilities::LogLevel::INFO)));
48
49 LOG_INFO << "Git refspec: " << GIT_REFSPEC;
50 LOG_INFO << "Git SHA1: " << GIT_SHA1;
51 LOG_INFO << "Git status: " << GIT_LOCAL_STATUS;
52
53 exePath = FileSystem::getProgramPath();
54
55 try
56 {
57 cxxopts::Options options(argv[0], "partio2vtk - Converts partio to vtk files");
58 options
59 .positional_help("[single-file or sequence, e.g. particles_#.bgeo]")
60 .show_positional_help();
61
62 options.add_options()
63 ("h,help", "Print help")
64 ("s,startFrame", "Start frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1"))
65 ("e,endFrame", "End frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1"))
66 ("o,outputDir", "Output directory", cxxopts::value<std::string>())
67 ;
68
69 options.add_options("invisible")
70 ("input-file", "Input file", cxxopts::value<std::string>());
71
72 options.parse_positional("input-file");
73 auto result = options.parse(argc, argv);
74
75 if (result.count("help"))
76 {
77 std::cout << options.help({ "" }) << std::endl;
78 exit(0);
79 }
80
81 if (result.count("input-file"))
82 {
83 inputFile = result["input-file"].as<std::string>();;
84 }
85 else
86 {
87 std::cout << options.help({ "" }) << std::endl;
88 exit(0);
89 }
90
91 if (result.count("outputDir"))
92 outDir = result["outputDir"].as<std::string>();
93 LOG_INFO << "Output directory: " << outDir;
94
95 if (result.count("startFrame"))
96 startFrame = result["startFrame"].as<int>();
97 LOG_INFO << "Start frame: " << startFrame;
98
99 if (result.count("endFrame"))
100 endFrame = result["endFrame"].as<int>();

Callers

nothing calls this directly

Calls 15

saveParticleCloudVTKFunction · 0.85
maxFunction · 0.85
addSinkMethod · 0.80
add_optionsMethod · 0.80
default_valueMethod · 0.80
helpMethod · 0.80
readFunction · 0.50
to_stringFunction · 0.50
parse_positionalMethod · 0.45
parseMethod · 0.45
countMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected