Jurwen / Adaptive-grid-generation

The code of paper "Adaptive grid generation for discretizing implicit complexes" (Proc. SIGGRAPH 2024)
https://jurwen.github.io/Adaptive-grid-for-implicit-complexes/
Apache License 2.0
17 stars 2 forks source link

Adaptive Grid Generation

This code implements the ACM SIGGRAPH 2024 paper: Adaptive grid generation for discretizing implicit complexes. Given one or multiple functions in 3D and desired type of implicit complex defined by these functions (e.g., implicit arrangement, material interface, CSG, or curve network), this algorithm generates an adaptive simplicial (tetrahedral) grid, which can then be used to discretize the implicit complex using this robust method.

Build

Use the following command to build:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

The program isosurfacing will be generated in the build file.

Dependency

Currently, all the packages dependencies are available. These are currently in a release process and will be available shortly.

Usage

To use the isosurfacing tool, you must provide an initial mesh file and implicit function file as arguments, along with any desired options.

./isosurfacing <mesh> <function> [OPTIONS]

Positional Arguments

Options

Example

The following is an example of how to use the isosurfacing tool with all available options:

./isosurfacing ../data/mesh/cube6.msh ../data/function_examples/1-sphere.json -t 0.01 -o "IA" -m 10000 -s 0.05

In this example, cube6.msh is the initial mesh file, sphere.json is the implicit function file, 0.01 is the threshold value, "IA" is the type of implicit complexes, 10000 is the maximum number of elements, and 0.05 is the shortest edge length.

Examples from the paper can be found in the data folder, where each example contains a mesh file and a function file. If the example is a CSG, then it also includes a CSG tree file. Each figure folder also contains a figure.sh and a figure.bat file containing the exact commandline to produce the examples from the paper.

Help

You can always run ./isosurfacing -h to display the help message which provides usage information and describes all the options available.

Output and After Grid Generation

The complete set of output files include data files (tet_mesh.msh, active_tets.msh, mesh.json, and function_value.json) and information files (timings.json and stats.json). The first two files can be viewed using Gmsh software showing the entire background grid or only the grid elements containing the surfaces. The last two files are for the later isosurfacing tool.

We have an off-the-shelf algorithm that extracts the isosurfacs robustly from the grid for implicit complexes. First download and build this isosurfacing method following its instructions.

After generating the grid using our method, please use the above isosurfacing tool by replacing its config_file with data/config.json according its usage example:

./impl_arrangement [OPTIONS] config_file

Currently, this isosurfacing tool supports implicit arrangement, material interface, and CSG. For CSG, please specify the same path to the CSG tree file using the same command.

Information Files

timing.json: timing of different stages of our pipeline. Details can be found in the paper.

stats.json: statistics of the background grid, e.g., the worst tetrahedral quality (radius ratio).