SCIInstitute / Cleaver

A MultiMaterial Tetrahedral Meshing Library and Application
https://cleaver.readthedocs.io
Other
40 stars 18 forks source link

COMP: Fix Cxx17 build error #119

Closed lassoan closed 1 year ago

lassoan commented 2 years ago

The old boost version that was included in the library was very old and it was not compatible with Cxx17 anymore. Instead of bringing in 1500+ files just for command-line argument parsing, updated the library to use CLI11 for this purpose.

CLI11.hpp was downloaded from https://github.com/CLIUtils/CLI11/releases/tag/v2.2.0

jcfr commented 2 years ago

Thanks @lassoan 🙏💯

The overall change makes sense.

Would it be possible to display the output of --help before/after ?

lassoan commented 2 years ago

Before:

Command line flags:
  -a [ --alpha ] arg                 initial alpha value
  -s [ --alpha_short ] arg           alpha short value for constant element 
                                     sizing method
  -l [ --alpha_long ] arg            alpha long value for constant element 
                                     sizing method
  -b [ --background_mesh ] arg       input background mesh
  -B [ --blend_sigma ] arg           blending function sigma for input(s) to 
                                     remove alias artifacts
  -m [ --element_sizing_method ] arg background mesh mode (adaptive [default], 
                                     constant)
  -F [ --feature_scaling ] arg       feature size scaling (higher values make a
                                     coarser mesh)
  -j [ --fix_tet_windup ]            ensure positive Jacobians with proper 
                                     vertex wind-up
  -h [ --help ]                      display help message
  -i [ --input_files ] arg           material field paths or segmentation path
  -L [ --lipschitz ] arg             maximum rate of change of element size (1 
                                     is uniform)
  -f [ --output_format ] arg         output mesh format (tetgen [default], 
                                     scirun, matlab, vtkUSG, vtkPoly, ply 
                                     [surface mesh only])
  -n [ --output_name ] arg           output mesh name (default 'output')
  -o [ --output_path ] arg           output path prefix
  -r [ --record ] arg                record operations on tets from input file
  -R [ --sampling_rate ] arg         volume sampling rate (lower values make a 
                                     coarser mesh)
  -I [ --indicator_functions ]       the input files are indicator functions
  --simple                           use simple interface approximation
  -z [ --sizing_field ] arg          sizing field path
  -t [ --strict ]                    warnings become errors
  -e [ --strip_exterior ]            strip exterior tetrahedra
  -w [ --write_background_mesh ]     write background mesh
  -v [ --verbose ]                   enable verbose output
  -V [ --version ]                   display version information

After:

Cleaver - A MultiMaterial Conforming Tetrahedral Meshing Library - mesher
Usage: c:\D\SlicerSegmentMesher_R\bin\Release\cleaver-cli.exe [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  -a,--alpha FLOAT            initial alpha value
  -s,--alpha_short FLOAT      alpha short value for constant element sizing method
  -l,--alpha_long FLOAT       alpha long value for constant element sizing method
  -b,--background_mesh TEXT   input background mesh
  -B,--blend_sigma FLOAT      blending function sigma for input(s) to remove alias artifacts
  -m,--element_sizing_method TEXT
                              background mesh mode (adaptive [default], constant)
  -F,--feature_scaling FLOAT  feature size scaling (higher values make a coarser mesh)
  -j,--fix_tet_windup         ensure positive Jacobians with proper vertex wind-up
  -i,--input_files TEXT ...   material field paths or segmentation path
  -L,--lipschitz FLOAT        maximum rate of change of element size (1 is uniform)
  -f,--output_format TEXT     output mesh format (tetgen [default], scirun, matlab, vtkUSG, vtkPoly, ply [surface mesh only])
  -n,--output_name TEXT       output mesh name (default 'output')
  -o,--output_path TEXT       output path prefix
  -r,--record TEXT            record operations on tets from input file
  -R,--sampling_rate FLOAT    volume sampling rate (lower values make a coarser mesh)
  -I,--indicator_functions    the input files are indicator functions
  --simple                    use simple interface approximation
  -z,--sizing_field TEXT      sizing field path
  -t,--strict                 warnings become errors
  -e,--strip_exterior         strip exterior tetrahedra
  -w,--write_background_mesh  write background mesh
  -v,--verbose                enable verbose output
  -V,--version                display version information
jcfr commented 2 years ago

Topic has been rebased, and the commits split into three different ones to further streamline the review process.

Outputs corresponding to the integration with CLI11 and associated with the --help parameter for mesh-info, cleaver-cli and sfcreator CLIs can be inspected below.

./mesh-info --help ``` Cleaver - A MultiMaterial Conforming Tetrahedral Meshing Library - mesh information Usage: ./mesh-info [OPTIONS] Options: -h,--help Print this help message and exit -i,--input TEXT REQUIRED input mesh -v,--verbose enable verbose output ```
./cleaver-cli --help ``` Cleaver - A MultiMaterial Conforming Tetrahedral Meshing Library - mesher Usage: ./cleaver-cli [OPTIONS] Options: -h,--help Print this help message and exit -a,--alpha FLOAT initial alpha value -s,--alpha_short FLOAT alpha short value for constant element sizing method -l,--alpha_long FLOAT alpha long value for constant element sizing method -b,--background_mesh TEXT input background mesh -B,--blend_sigma FLOAT blending function sigma for input(s) to remove alias artifacts -m,--element_sizing_method TEXT background mesh mode (adaptive [default], constant) -F,--feature_scaling FLOAT feature size scaling (higher values make a coarser mesh) -j,--fix_tet_windup ensure positive Jacobians with proper vertex wind-up -i,--input_files TEXT ... material field paths or segmentation path -L,--lipschitz FLOAT maximum rate of change of element size (1 is uniform) -f,--output_format TEXT output mesh format (tetgen [default], scirun, matlab, vtkUSG, vtkPoly, ply [surface mesh only]) -n,--output_name TEXT output mesh name (default 'output') -o,--output_path TEXT output path prefix -r,--record TEXT record operations on tets from input file -R,--sampling_rate FLOAT volume sampling rate (lower values make a coarser mesh) -I,--indicator_functions the input files are indicator functions --simple use simple interface approximation -z,--sizing_field TEXT sizing field path -t,--strict warnings become errors -e,--strip_exterior strip exterior tetrahedra -w,--write_background_mesh write background mesh -v,--verbose enable verbose output -V,--version display version information ```
./sfcreator --help ``` Cleaver - A MultiMaterial Conforming Tetrahedral Meshing Library - sizing field creator Usage: ./sfcreator [OPTIONS] Options: -h,--help Print this help message and exit -v,--verbose enable verbose output --version display version information --material_fields TEXT ... REQUIRED material field paths --lipschitz FLOAT maximum rate of change of element size (1 is uniform) --feature_scaling FLOAT feature size scaling (higher values make a coarser mesh) --sampling_rate FLOAT volume sampling rate (lower values make a coarser mesh) --output TEXT output path --padding INT volume padding ```
lassoan commented 1 year ago

Please merge. Otherwise we need to switch to a fork to make the SegmentMesher Slicer extension work again.