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

Function main

Tools/VolumeSampling/main.cpp:80–288  ·  view source on GitHub ↗

main

Source from the content-addressed store, hash-verified

78
79// main
80int main(int argc, char **argv)
81{
82 REPORT_MEMORY_LEAKS;
83
84 exePath = FileSystem::getProgramPath();
85
86 Timing::m_dontPrintTimes = true;
87
88 try
89 {
90 cxxopts::Options options(argv[0], "VolumeSampling - Sample a volumetric geometry given by an surface mesh file.");
91
92 options.add_options()
93 ("h,help", "Print help")
94 ("i,input", "Input file (obj or ply)", cxxopts::value<std::string>())
95 ("o,output", "Output file (bgeo or vtk)", cxxopts::value<std::string>())
96 ("r,radius", "Particle radius", cxxopts::value<Real>()->default_value("0.025"))
97 ("s,scale", "Scaling of input geometry (e.g. --scale 2,1,2)", cxxopts::value<std::vector<Real>>()->default_value("1,1,1"))
98 ("m,mode", "Mode (regular=0, almost dense=1, dense=2, Jiang et al. 2015=3, Kugelstadt et al. 2021=4)", cxxopts::value<int>()->default_value("4"))
99 ("region", "Region to fill with particles (e.g. --region 0,0,0,1,1,1)", cxxopts::value<std::vector<Real>>())
100 ("steps", "SPH time steps", cxxopts::value<unsigned int>()->default_value("100"))
101 ("cflFactor", "CFL factor", cxxopts::value<Real>()->default_value("0.25"))
102 ("viscosity", "Viscosity coefficient (XSPH)", cxxopts::value<Real>()->default_value("0.25"))
103 ("cohesion", "Cohesion coefficient", cxxopts::value<Real>())
104 ("adhesion", "Adhesion coefficient", cxxopts::value<Real>())
105 ("stiffness", "Stiffness coefficient (only mode 3)", cxxopts::value<Real>()->default_value("10000.0"))
106 ("dt", "Time step size (only mode 3)", cxxopts::value<Real>()->default_value("0.0005"))
107 ("res", "Resolution of the Signed Distance Field (e.g. --res 30,30,30)", cxxopts::value<std::vector<unsigned int>>())
108 ("invert", "Invert the SDF to sample the outside of the object in the bounding box/region")
109 ("no-cache", "Disable caching of SDF.")
110 ;
111
112 auto result = options.parse(argc, argv);
113
114 if (result.count("help"))
115 {
116 std::cout << options.help({ "", "Group" }) << std::endl;
117 exit(0);
118 }
119
120 if (result.count("input") && result.count("output"))
121 {
122 inputFile = result["input"].as<std::string>();
123 outputFile = result["output"].as<std::string>();
124 output_format = 0;
125 if (Utilities::StringTools::to_upper(FileSystem::getFileExt(outputFile)) == "VTK")
126 output_format = 1;
127 }
128 else
129 {
130 std::cout << "Input or output missing!" << std::endl;
131 std::cout << options.help({ "", "Group" }) << std::endl;
132 exit(1);
133 }
134
135 if (result.count("mode"))
136 mode = result["mode"].as<int>();
137

Callers

nothing calls this directly

Calls 15

RegionClass · 0.85
computeBoundingBoxFunction · 0.85
generateSDFFunction · 0.85
sampleObjectFunction · 0.85
writeParticlesVTKFunction · 0.85
add_optionsMethod · 0.80
default_valueMethod · 0.80
helpMethod · 0.80
addSinkMethod · 0.80
setOutputPathMethod · 0.80
setScaleMethod · 0.80
setUseRegionMethod · 0.80

Tested by

no test coverage detected