Tessellator is a mesher focused on generate meshes and data structures which are suitable for FDTD algorithms. It includes the following capabilities:
- Generate staircased meshes from lines, surfaces, and volumes.
- Support for rectilinear (graded) grids.
- Import/Export in STL or VTK formats.
- Conflict resolution between different layers using a predefined hierarchy.
- Generate conformal meshes with fixed distance intersection with grid planes.
When using presets, make sure to define the environment variable VCPKG_ROOT to your vcpkg installation.
The standard presets build without CGAL; use the gnu-cgal preset for the optional CGAL algorithms.
The launcher application is enabled by default (TESSELLATOR_ENABLE_APP=ON) and
requires VTK 7.1 or newer. CMake fails during configuration when the launcher is enabled but VTK is unavailable. To build the mesh library and its non-app tests without VTK, configure with -DTESSELLATOR_ENABLE_APP=OFF.
For a clean build with the launcher enabled:
cmake --preset gnu -S . -B build
cmake --build build -j
ctest --test-dir build --output-on-failurectest automatically runs from the source directory, so no testData symlinks
are required.
The launcher prints its build version, commit, compiler, and flags on startup.
For source bundles built without Git, generate git_info.txt in a checkout and
include it at the source root before packaging:
./scripts/write_git_info.shThis can be done using a CMakeUserPreset.json file, for example:
{
"version": 4,
"include": ["CMakePresets.json"],
"configurePresets": [
{
"name": "gnu-local",
"displayName": "GNU local",
"environment": {
"VCPKG_ROOT": "~/workspace/vcpkg/"
},
"cacheVariables": {
"TESSELLATOR_ENABLE_CGAL": false
},
"inherits": "gnu"
}
]
}The main binary is tessellator, which uses a tessellator json format, which will be explained below.
tessellator -i MESH_NAME.tessellator.jsonThe main entries are as follows:
This object must always be present and contains the structure of the grid, which will be used to slice and adjust the mesh provided. It must contain one of these two sets of entries:
<numberOfCells>: is an array of three positive integers which indicate the number of cells in each Cartesian direction. In case of having this entry, it also must contain a<boundingBox>:<boundingBox>is represented by an array which contains two triplets of integers, representing the minimum and maximum values of the grid in each cartesian direction.
"grid": {
"numberOfCells": [20, 20, 30],
"boundingBox": [
[-1, -1, -1],
[ 1, 1, 2]
]
}planes: This array contains other three arrays of floating point numbers. Each number must be in sequential order, from lowest to highest, each value representing the position of every plane forming the cells of the grid. This allows the definition of a non-uniform (rectilinear) grid.
"grid": {
"planes": [
[600, 603.25],
[25.0, 30.5, 92, 130, 1000],
[1000, 1111, 1111.1]
]
}This contains the information about the mesh file(s). You can specify a single object or multiple objects:
Single object:
filename: A string containing the name of the mesh file. Its location is relative to that of the json file.volume: (optional boolean, default:false) Treats the object as a volume. A volume may be supplied as a closed triangle/quad surface or as tetrahedral/hexahedral cells. Its input boundary is validated before meshing. Conformal volume components that collapse geometrically to a surface, line, or point are selectively staircased and remain valid. The output may therefore contain a different number of closed volume regions, together with surface, line, or point remnants.
"object": {"filename": "thinCylinder.stl", "volume": true}Multiple objects:
objects: An array of object definitions. Each object can have:filename: (required) The mesh file name, relative to the JSON file locationgroup: (optional) Group name for the object (defaults to filename without extension)volume: (optional boolean, default:false) Applies the same volume validation and meshing behavior as the single-object formghost: (optional boolean, default: false) Excludes the object from cross-object decisions while still meshing and exporting it normallymesher: (optional) Override the global mesher settings for this specific object
"objects": [
{"filename": "object1.stl", "group": "group1", "volume": true, "ghost": true},
{"filename": "object2.stl", "group": "group2", "mesher": {"type": "conformal"}}
]This optional entry configures the meshing algorithm and its options. If not specified, the staircase mesher is used with default options.
Mesher types:
staircase(default): Generates staircased meshes from geometric inputsconformal: Creates conformal meshes with fixed-distance grid plane intersections
Mesher options:
For staircase mesher:
compress: (boolean, default: true) Merges compatible adjacent surfaces and lines to minimize exported element countssplitHexahedra: (boolean, default: false) Splits filled volumes into one conforming hexahedron per occupied grid cell
For conformal mesher:
edgePoints: (non-negative integer, default:0) Number of evenly spaced candidate snap points added along each grid edge. These points are placed in the portion of the edge outside the endpoint exclusion regions defined byforbiddenLength. Set to0to add no interior edge points.forbiddenLength: (number, default:0.0) Fraction of each grid edge kept clear next to both endpoints when placing or snapping to edge points. It must be between0.0and0.5, inclusive.compress: (boolean, default: true) Applies final surface and line compression after conformal validation and any selective staircasingstaircaseSharedCells: (boolean, default: true) Selectively staircases cells occupied by this conformal object and another objectmergeAxisAlignedTriangles: (boolean, default: true) Merges two triangles that form a cell-sized quad parallel to a grid plane
Global options:
exportGrid: (boolean, default: true) Controls whether to export the grid file
Example with staircase mesher and compression disabled:
"mesher": {
"type": "staircase",
"options": {
"compress": false,
"exportGrid": true
}
}This optional entry controls how multi-object results are written:
singleFile: (boolean, default: false) Writes all objects to one{basename}.tessellator.vtkfile instead of separate per-object mesh files. Object groups remain identifiable through thegroupandgroupNamescell attributes. Group names must be unique.
"output": {
"singleFile": true
}Example with conformal mesher:
"mesher": {
"type": "conformal",
"options": {
"edgePoints": 3,
"forbiddenLength": 0.001
}
}The tessellator generates output files with the following naming convention:
{group_name}.tessellator.str.vtk- Staircase meshed object{group_name}.tessellator.cmsh.vtk- Conformal meshed object{basename}.tessellator.vtk- Combined multi-object mesh whenoutput.singleFileis true{basename}.tessellator.grid.vtk- Grid file (ifexportGridis true)
{
"grid": {
"numberOfCells": [50, 50, 50],
"boundingBox": [
[-100.0, -100.0, -100.0],
[ 100.0, 100.0, 100.0]
]
},
"objects": [
{"filename": "sphere.stl"},
{"filename": "cylinder.stl", "mesher": {"type": "conformal"}}
],
"mesher": {
"type": "staircase",
"options": {
"compress": true,
"exportGrid": true
}
}
}If you use this software, please give proper attribution by citing it as indicated in the citation file.
This code and its copyright is property of to the University of Granada (UGR), CIF: Q1818002F, www.ugr.es. UGR has licensed its distribution under terms of the GPL-3.0 and MIT licenses (see LICENSE file) with the name of meshlib
testData/cervezas_alhambra logo has been downloaded from https://cults3d.com/es/modelo-3d/arte/celosia-alhambra-logo-cervezas-alhambra where is available with license CC BY-NC-SA.
- Spanish Ministry of Science and Innovation (MICIN/AEI) (Grant Number: PID2022-137495OB-C31)
- European Union, HECATE project. (HE-HORIZON-JU-Clean-Aviation-2022-01)
- iSense Project. In-Situ Monitoring of Electromagnetic Interference. (HE-HORIZON-MSCA-2023-DN-01)