Computational Meshing

This lecture covers slides 6 .

Reading Material

Introduction to Meshing

  • This video introduces concepts of structured regular grids versus unstructured meshes such as triangle meshes. It shows how to use NumPy to work with vertex and face arrays, defines the orientation of faces, uses meshplot tool for visualization, and how to various existing meshing tools.
  • The aim of this video is to learn practical tools to get up on running with code oneself.
  • Try to repeat the examples by yourself in your own Jupyter notebook to become familiar with creating your own mesh examples.

CSG with Signed Distance Fields

Simple 3D Examples with PyDistMesh

  • This video shows how to create volumetric tetrahedral meshes using CSG operations of signed distance fields
  • Get the DistMesh software from https://pypi.org/project/PyDistMesh/
  • The aim is by example to learn how to use CSG for modeling meshes in 3D.

Data Structure for a Tetrahedral Mesh

Marching Triangles Introduction

  • This video demonstrates the basic principles behind the marching triangles method and outlines the case-by-case analysis that is the key to understanding how the algorithm works.
  • The aim of this video is to learn a simple algorithm for meshing and study some of the difficulties in creating a nice "output" mesh.
  • This type of algorithm is closely related to contouring algorithms that are used in computer graphics for visualizing implicit surfaces, often referred to as isosurfaces. The same type of algorithm is often used to extract surface meshes from image segmentations. Like getting bone surfaces from a CT image. The "classical" contouring algorithm is considered to be the "marching cubes" method, see the link below. Today many derived methods exist. The contouring idea has also been extended to volume mesh generation and is sometimes called "stuffing", see the paper link below. The marching triangle method we introduced here in 2D can be trivially extended to 3D. This we leave as an optional home programming exercise for those students that like to explore meshing more.
  • Supplementary reading: Marching cubes: A high-resolution 3D surface construction algorithm and Isosurface stuffing: fast tetrahedral meshes with good dihedral angles.
  • Covers slides 6 (pages 13-17)

Marching Triangles made Efficient

  • This video explains how to use bitmasks and stencils to efficiently encode all the triangle cases of the marching triangles method.
  • The aim of this method is to learn how to efficiently implement typical mesh operations efficiently.
  • Test yourself
    • How would you change the algorithm such that vertices in the triangle mesh are only generated once without using comparison of coordinates or advanced data structures like dictionaries etc. (Hint: think about the multipass algorithm and smart indexing)?
    • How would you create an embarrassingly parallel version of this algorithm that could run on a GPU?  (Hint: think about using a thread for every cell in the grid, how do you avoid race conditions when generating vertices and triangles?)
  • Covers slides 6 (pages 23-25)

Introduction to quality measures

  • This video introduces quality measures and histograms as tools to verify if a computational mesh can be expected to behave nicely for simulation purposes.
  • The aim is not to get deep into the theory of quality measures but to achieve a good practice of always using multiple measures to inspect a mesh before using that mesh.
  • Read about different quality measures in this paper What Is a Good Linear Finite Element? Interpolation, Conditioning, Anisotropy, and Quality Measures. The paper is dense so focus on fair measures in section 6. Particular Table 7 is a quite useful reference.
  • Covers slides 6 (pages 29-30)

(Optional) Learn more

  • You have seen examples of meshing algorithms that use stuffing into an implicit representation above. However, two other types of algorithms are frequently used. One is based on constrained Delaunay triangulations and the other is based on variational meshing. Read these papers for an introduction TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator, and Variational Tetrahedral Meshing.
  • Adaptive quality meshing is another interesting topic. You can play with some 2D software from this GRIT.
  • There are many open and free tools for segmentation. If you want to create your own meshes to simulate human tissue you may want to check out 3D slicer. Here is a link for a tutorial on how to do image segmentation.