Skip to content

Commit 051891d

Browse files
committed
Enable mesh cleanup if smoothing is enabled, update CLI help text
1 parent faa6c0a commit 051891d

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

splashsurf/src/reconstruction.rs

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ use std::path::PathBuf;
2020
static ARGS_IO: &str = "Input/output";
2121
static ARGS_BASIC: &str = "Numerical reconstruction parameters";
2222
static ARGS_ADV: &str = "Advanced parameters";
23-
static ARGS_OCTREE: &str = "Domain decomposition (octree or grid) parameters";
23+
static ARGS_OCTREE: &str = "Domain decomposition parameters";
2424
static ARGS_DEBUG: &str = "Debug options";
2525
static ARGS_INTERP: &str = "Interpolation & normals";
26-
static ARGS_POSTPROC: &str = "Postprocessing";
26+
static ARGS_DECIMATE: &str = "Mesh decimation and cleanup";
27+
static ARGS_SMOOTHING: &str = "Mesh smoothing";
28+
static ARGS_POSTPROC: &str = "General postprocessing";
2729
static ARGS_OTHER: &str = "Remaining options";
2830

2931
/// Command line arguments for the `reconstruct` subcommand
@@ -53,13 +55,13 @@ pub struct ReconstructSubcommandArgs {
5355
/// The rest density of the fluid
5456
#[arg(help_heading = ARGS_BASIC, long, default_value = "1000.0")]
5557
pub rest_density: f64,
56-
/// The smoothing length radius used for the SPH kernel, the kernel compact support radius will be twice the smoothing length (in multiplies of the particle radius)
58+
/// The smoothing length radius used for the SPH kernel, the kernel compact support radius will be twice the smoothing length (in multiples of the particle radius)
5759
#[arg(help_heading = ARGS_BASIC, short = 'l', long)]
5860
pub smoothing_length: f64,
59-
/// The cube edge length used for marching cubes in multiplies of the particle radius, corresponds to the cell size of the implicit background grid
61+
/// The cube edge length used for marching cubes in multiples of the particle radius, corresponds to the cell size of the implicit background grid
6062
#[arg(help_heading = ARGS_BASIC, short = 'c', long)]
6163
pub cube_size: f64,
62-
/// The iso-surface threshold for the density, i.e. the normalized value of the reconstructed density level that indicates the fluid surface (in multiplies of the rest density)
64+
/// The iso-surface threshold used for the marching cubes algorithm, this is the value of the implicit surface function (here the color field) at which the surface is reconstructed
6365
#[arg(help_heading = ARGS_BASIC, short = 't', long, default_value = "0.6")]
6466
pub surface_threshold: f64,
6567

@@ -95,7 +97,7 @@ pub struct ReconstructSubcommandArgs {
9597
)]
9698
pub particle_aabb_max: Option<Vec<f64>>,
9799

98-
/// Enable multi-threading to process multiple input files in parallel (NOTE: Currently, the subdomain-grid domain decomposition approach and some post-processing functions including interpolation do not have sequential versions and therefore do not work well with this option enabled)
100+
/// Enable multithreading to process multiple input files in parallel (NOTE: Currently, the subdomain-grid domain decomposition approach and some post-processing functions including interpolation do not have sequential versions and therefore do not work well with this option enabled)
99101
#[arg(
100102
help_heading = ARGS_ADV,
101103
long = "mt-files",
@@ -105,7 +107,7 @@ pub struct ReconstructSubcommandArgs {
105107
require_equals = true
106108
)]
107109
pub parallelize_over_files: Switch,
108-
/// Enable multi-threading for a single input file by processing chunks of particles in parallel
110+
/// Enable multithreading for a single input file by processing chunks of particles in parallel
109111
#[arg(
110112
help_heading = ARGS_ADV,
111113
long = "mt-particles",
@@ -119,7 +121,7 @@ pub struct ReconstructSubcommandArgs {
119121
#[arg(help_heading = ARGS_ADV, long, short = 'n')]
120122
pub num_threads: Option<usize>,
121123

122-
/// Enable spatial decomposition using a regular grid-based approach
124+
/// Enable spatial decomposition using a regular grid-based approach (for efficient multithreading)
123125
#[arg(
124126
help_heading = ARGS_OCTREE,
125127
long,
@@ -129,11 +131,11 @@ pub struct ReconstructSubcommandArgs {
129131
require_equals = true
130132
)]
131133
pub subdomain_grid: Switch,
132-
/// Each subdomain will be a cube consisting of this number of MC cube cells along each coordinate axis
134+
/// Each subdomain will be a cube consisting of this number of MC grid cells along each coordinate axis
133135
#[arg(help_heading = ARGS_OCTREE, long, default_value="64")]
134136
pub subdomain_cubes: u32,
135137

136-
/// Enable omputing surface normals at the mesh vertices and write them to the output file
138+
/// Enable computing surface normals at the mesh vertices and write them to the output file
137139
#[arg(
138140
help_heading = ARGS_INTERP,
139141
long,
@@ -153,7 +155,7 @@ pub struct ReconstructSubcommandArgs {
153155
require_equals = true
154156
)]
155157
pub sph_normals: Switch,
156-
/// Number of smoothing iterations to run on the normal field if normal interpolation is enabled (disabled by default)
158+
/// Number of smoothing iterations to apply to normals if normal interpolation is enabled (disabled by default)
157159
#[arg(help_heading = ARGS_INTERP, long)]
158160
pub normals_smoothing_iters: Option<usize>,
159161
/// Enable writing raw normals without smoothing to the output mesh if normal smoothing is enabled
@@ -170,55 +172,60 @@ pub struct ReconstructSubcommandArgs {
170172
#[arg(help_heading = ARGS_INTERP, long = "interpolate_attribute", short = 'a', value_name = "ATTRIBUTE_NAME")]
171173
pub interpolate_attributes: Vec<String>,
172174

173-
/// Enable MC specific mesh decimation/simplification which removes bad quality triangles typically generated by MC
175+
/// Enable MC specific mesh decimation/simplification which removes bad quality triangles typically generated by MC by snapping (enabled by default if smoothing is enabled)
174176
#[arg(
175-
help_heading = ARGS_POSTPROC,
177+
help_heading = ARGS_DECIMATE,
176178
long,
177179
default_value = "off",
180+
default_value_ifs([
181+
("mesh_smoothing_iters", clap::builder::ArgPredicate::Equals("0".into()), "off"),
182+
("mesh_smoothing_iters", clap::builder::ArgPredicate::IsPresent, "on")
183+
]),
178184
value_name = "off|on",
179185
ignore_case = true,
180186
require_equals = true
181187
)]
182188
pub mesh_cleanup: Switch,
183189
/// Enable decimation of some typical bad marching cubes triangle configurations (resulting in "barnacles" after Laplacian smoothing)
184190
#[arg(
185-
help_heading = ARGS_POSTPROC,
191+
help_heading = ARGS_DECIMATE,
186192
long,
187193
default_value = "off",
188194
value_name = "off|on",
189195
ignore_case = true,
190196
require_equals = true
191197
)]
192198
pub decimate_barnacles: Switch,
193-
/// Enable keeping vertices without connectivity during decimation instead of filtering them out (faster and helps with debugging)
199+
/// Enable preserving vertices without connectivity during decimation instead of filtering them out (faster and helps with debugging)
194200
#[arg(
195-
help_heading = ARGS_POSTPROC,
201+
help_heading = ARGS_DECIMATE,
196202
long,
197203
default_value = "off",
198204
value_name = "off|on",
199205
ignore_case = true,
200206
require_equals = true
201207
)]
202208
pub keep_verts: Switch,
209+
203210
/// Number of smoothing iterations to run on the reconstructed mesh
204-
#[arg(help_heading = ARGS_POSTPROC, long)]
211+
#[arg(help_heading = ARGS_SMOOTHING, long)]
205212
pub mesh_smoothing_iters: Option<usize>,
206213
/// Enable feature weights for mesh smoothing if mesh smoothing enabled. Preserves isolated particles even under strong smoothing.
207214
#[arg(
208-
help_heading = ARGS_POSTPROC,
215+
help_heading = ARGS_SMOOTHING,
209216
long,
210217
default_value = "off",
211218
value_name = "off|on",
212219
ignore_case = true,
213220
require_equals = true
214221
)]
215222
pub mesh_smoothing_weights: Switch,
216-
/// Normalization value from weighted number of neighbors to mesh smoothing weights
217-
#[arg(help_heading = ARGS_POSTPROC, long, default_value = "13.0")]
223+
/// Override a manual normalization value from weighted number of neighbors to mesh smoothing weights
224+
#[arg(help_heading = ARGS_SMOOTHING, long, default_value = "13.0")]
218225
pub mesh_smoothing_weights_normalization: f64,
219226
/// Enable writing the smoothing weights as a vertex attribute to the output mesh file
220227
#[arg(
221-
help_heading = ARGS_POSTPROC,
228+
help_heading = ARGS_SMOOTHING,
222229
long,
223230
default_value = "off",
224231
value_name = "off|on",
@@ -227,7 +234,7 @@ pub struct ReconstructSubcommandArgs {
227234
)]
228235
pub output_smoothing_weights: Switch,
229236

230-
/// Enable trying to convert triangles to quads if they meet quality criteria
237+
/// Enable conversion of triangles to quads if they meet quality criteria
231238
#[arg(
232239
help_heading = ARGS_POSTPROC,
233240
long,
@@ -278,7 +285,7 @@ pub struct ReconstructSubcommandArgs {
278285
)]
279286
pub mesh_aabb_clamp_verts: Switch,
280287

281-
/// Enable writing the raw reconstructed mesh before applying any post-processing steps
288+
/// Enable writing the raw reconstructed mesh before applying any post-processing steps (like smoothing or decimation)
282289
#[arg(
283290
help_heading = ARGS_POSTPROC,
284291
long,

0 commit comments

Comments
 (0)