Skip to content

mtao/mandoline

Repository files navigation

Mandoline

CircleCI A robust cut-cell mesh generator for arbitrary triangle-mesh inputs

State of the code

The dev branch has more features and has several bug fixes but requires C++20 and doesn't consistently pass circleci. As there is currently one developer working on this in their free time (while using it in their own work) the development efforts are fairly focused. But please let mtao know if you encounter any issues! There may already be a fix in dev that needs to be ported over to master or he might have the time / be able to fix it up for you!

Serialization

By default Mandoline uses protobuf for serialization, following the format of defined at proto/cutmesh.proto. This is language agnostic and so in theory, so long as your language has protobuf support/bindings you can read the output of Mandoline. In fact a lot of initial validity testing on Mandoline were done in python.

Examples/Tools

There are a few examples / tools that are provided. They can be built by

make example_name

curve_drawing_2d

In examples/curve_drawing_2d there is an example of how to run the 2D version of Mandoline on a drawn curve.

After drawing a curve press Make CCM to build the cutmesh. By default it should show Random colors for each cut-cell, but that visualization mode can be changed by the Combo box at the top of the gui widget (regions = 1 color per region; Harmonic = the solution to a Poisson equation based off the boundary; Harmonic_RHS shows the right hands used in the Poisson equations).

Boundary curve input/output

in boundary_curve_to_cutmesh2 one can pass in a cutmesh file of the format defined in 2D Format.

make_cutmesh_gui

We provide a visual interface for creating cutmeshes from OBJ files whose code is found at tools/make_cutmesh_gui.cpp, which provides a gui widget for changing the grid resolution, grid bounding box, etc before making a cutmesh and saving it to disk. The obj file is a commandoline argument.

make_cutmesh_gui obj_filename.obj

cutmesh_info

We provide a simple tool for inspecting high level details about a cutmesh file, whose code is found in tools/cutmesh_info.cpp. The meat of it is found at src/tools/cutmesh_info.cpp for those curious.

cutmesh_info cutmesh_file.cutmesh

Compilation

Mandoline depends on a C++17 enabled compiler

  • gcc with version >= 8.2.0 or clang with version >= 8 should work.
  • cmake with version >= 3.11.1 .
apt install git cmake build-essential gcc

as well as a few other annoying things in the subsequent sections.

Once everything in subsequent sections has been installed, mandoline can be bulit by

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

Built-in Libraries

Mandoline depends on a few libraries that it will fetch on its own:

  • Michael Tao's messy ``core'' library,
  • libigl for its ability to make intersection-free triangle meshes,

Required External Libraries

  • A relatively new verison of Eigen3 is required (3.3.7 or the development branch?). The version provided by libigl will not suffice. MAndoline might fetch its own if your Eigen is not new enough.
  • tbb for multithreading.
  • Google Protobuf is required for the default cutmesh serialization format.
  • Eigen is required for almost every bit of linear algebra. If the currently available version is insufficeintly high mandoline's build will fetch a sufficiently new version
apt install libboost-thread-dev  libeigen3-dev protobuf-compiler 

In order to handle self-intersections Mandoline requires, on top of libigl,

apt install libboost-thread-dev libmpfr-dev libmpfrc++-dev libcgal-dev 
libmpfr-dev libmpfrc++-dev libcgal-dev

Optional Libraries

  • OpenMP is a really good idea, Eigen uses it a bit but I'm trying to switch to tbb for most uses in Mandoline itself.
  • Magnum and Corrade (version >= 2019.10) for visualization.
  • imgui for visualizing things as well. Targets that depend on visualization can be enabled by -DUSE_OPENGL ON when running cmake. They will be automatically fetched.

OpenGL stuff probably requiers the following on ubuntu:

apt install libgl-dev libopenal-dev libglfw3-dev libsdl2-dev libbullet-dev libglm-dev

About

A robust cut-cell mesh generator for arbitrary triangle-mesh inputs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published