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

Function main

Tools/FoamGenerator/main.cpp:156–467  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

154
155// main
156int main( int argc, char **argv )
157{
158 REPORT_MEMORY_LEAKS;
159
160 Utilities::logger.addSink(shared_ptr<Utilities::ConsoleSink>(new Utilities::ConsoleSink(Utilities::LogLevel::INFO)));
161 exePath = FileSystem::getProgramPath();
162
163 try
164 {
165 cxxopts::Options options(argv[0], "FoamGen - An implementation of Bender et al. \"Turbulent Micropolar SPH Fluids with Foam\", 2018\n\n"
166 "By default the limits and the factors (ta, wc, vo) are determined automatically. The amount of generated foam particles "
167 "is solely determined by the parameter foamscale. If the -no_auto flag is set, all parameters can be set manually.\n"
168 );
169
170 options.add_options()
171 ("i,input", "Input file (partio)", cxxopts::value<std::string>())
172 ("o,output", "Output file (partio or vtk)", cxxopts::value<std::string>())
173 ("q,query", "Query mode: determines max/avg values ")
174 ("no-auto", "Disable automatic mode. Limits and factors ta, wc, vo must be set manually.")
175 ("splittypes", "Output each foam type to a different file")
176 ("splitgenerators", "Output different foam files depending on which potential generated the foam. Overrides --splittypes.")
177 ("s,startframe", "Start frame", cxxopts::value<unsigned int>()->default_value("1"))
178 ("e,endframe", "End frame", cxxopts::value<unsigned int>())
179 ("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025"))
180 ("t,timestepsize", "Time step size", cxxopts::value<Real>()->default_value("0.02"))
181 ("k,kernel", "0: Cubic spline, 1: Ihmsen et al. 2012", cxxopts::value<int>()->default_value("0"))
182 ("l,limits", "Limits (min/max) for potentials (trapped air, wave crest, vorticity, kinetic energy)", cxxopts::value<std::string>()->default_value("5,20,2,8,5,20,5,50"))
183 ("lifetime", "Lifetime (min/max)", cxxopts::value<std::string>()->default_value("2.0,5.0"))
184 ("b,buoyancy", "Buoyancy", cxxopts::value<Real>()->default_value("2.0"))
185 ("d,drag", "Drag", cxxopts::value<Real>()->default_value("0.8"))
186 ("ta", "Trapped air factor", cxxopts::value<Real>()->default_value("4000"))
187 ("wc", "Wave crest factor", cxxopts::value<Real>()->default_value("50000"))
188 ("vo", "Vorticity factor", cxxopts::value<Real>()->default_value("4000"))
189 ("bbsize", "minimum and maximum coordinates of and axis aligned bounding-box (minX, minY, minZ, maxX, maxY, maxZ)", cxxopts::value<std::string>())
190 ("bbtype", "chose how the bounding-box is used [kill | lifesteal | clamp]. Use in combination with --bbsize.", cxxopts::value<std::string>())
191 ("skipframes", "number of frames to skip when writing foam", cxxopts::value<unsigned int>()->default_value("0"))
192 ("f,foamscale", "Global multiplier for number of generated foam particles", cxxopts::value<Real>()->default_value("1000"))
193 ("h,help", "Print help")
194 ;
195
196 auto result = options.parse(argc, argv);
197
198 if (result.count("help"))
199 {
200 std::cout << options.help({ "", "Group" }) << std::endl;
201 exit(0);
202 }
203
204 queryMode = false;
205 if (result.count("query"))
206 {
207 queryMode = true;
208 }
209
210 automaticMode = true;
211 if (result.count("no-auto"))
212 {
213 automaticMode = false;

Callers

nothing calls this directly

Calls 15

stringFunction · 0.85
queryValuesFunction · 0.85
generateFoamFilesFunction · 0.85
addSinkMethod · 0.80
add_optionsMethod · 0.80
default_valueMethod · 0.80
helpMethod · 0.80
parseMethod · 0.45
countMethod · 0.45
sizeMethod · 0.45
anyMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected