Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ on:
branches:
- main
- dev

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
builds-and-tests:
env:
VCPKG_BINARY_SOURCES: clear
strategy:
matrix:
preset: [
Expand Down Expand Up @@ -69,4 +74,4 @@ jobs:
run: build/bin/tessellator_tests




3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ CMakeUserPresets.json
sliced.vtk
contour.vtk

testData/
testData/
build
65 changes: 65 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "tessellator (gdb)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dbg/bin/tessellator",
"args": ["-i", "testData/cases/alhambra/alhambra.tessellator.json"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"visualizerFile": [
"${workspaceFolder}/resources/Eigen.natvis",
"${workspaceFolder}/resources/nlohmann_json.natvis"
],
"additionalSOLibSearchPath": "",
"showDisplayString": true,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "tessellator_tests (gdb)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-dbg/bin/tesselator_tests",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"visualizerFile": [
"${workspaceFolder}/resources/Eigen.natvis",
"${workspaceFolder}/resources/nlohmann_json.natvis"
],
"additionalSOLibSearchPath": "",
"showDisplayString": true,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
15 changes: 14 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@
"name": "gnu",
"displayName": "GNU g++ compiler",
"generator": "Ninja",
"inherits": "default"
"inherits": "default",
"cacheVariables": {
"TESSELLATOR_ENABLE_TESTS": "ON",
"TESSELLATOR_ENABLE_CGAL": "OFF"
}
},
{
"name": "gnu-dbg",
"displayName": "GNU g++ compiler - Debug",
"inherits": "gnu",
"binaryDir": "build-dbg/",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "docker",
Expand Down
97 changes: 90 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ The main binary is `tessellator`, which uses a tessellator json format, which wi
```

## JSON Format
The two main entries are as follows:
The main entries are as follows:

### `<grid>`
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 contairs two triplets of integers, representing the minimum and maximum values of the gread in each cartesian direction.
- `<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.

```json
"grid": {
Expand All @@ -80,17 +80,100 @@ This object must always be present and contains the structure of the grid, which
}
```

### `<object>`
This contains the information about the mesh file. It must contain the following entry:
### `<object>` or `<objects>`
This contains the information about the mesh file(s). You can specify a single object or multiple objects:

- `filename`: with an string containing the name of the mesh file. Its location is relative to that of the json file.

Example:
**Single object:**
- `filename`: A string containing the name of the mesh file. Its location is relative to that of the json file.

```json
"object": {"filename": "thinCylinder.stl"}
```

**Multiple objects:**
- `objects`: An array of object definitions. Each object can have:
- `filename`: (required) The mesh file name, relative to the JSON file location
- `group`: (optional) Group name for the object (defaults to filename without extension)
- `mesher`: (optional) Override the global mesher settings for this specific object

```json
"objects": [
{"filename": "object1.stl", "group": "group1"},
{"filename": "object2.stl", "group": "group2", "mesher": {"type": "conformal"}}
]
```

### `<mesher>`
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 inputs
- `conformal`: Creates conformal meshes with fixed-distance grid plane intersections

**Mesher options:**

For **staircase** mesher:
- `compress`: (boolean, default: false) Enables surface compression to merge adjacent coplanar quads into larger surfaces

For **conformal** mesher:
- `edgePoints`: Controls edge point snapping behavior
- `forbiddenLength`: Minimum length threshold for snapping

**Global options:**
- `exportGrid`: (boolean, default: true) Controls whether to export the grid file

Example with staircase mesher and compression enabled:
```json
"mesher": {
"type": "staircase",
"options": {
"compress": true,
"exportGrid": true
}
}
```

Example with conformal mesher:
```json
"mesher": {
"type": "conformal",
"options": {
"edgePoints": true,
"forbiddenLength": 0.001
}
}
```

### Output Files
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.grid.vtk` - Grid file (if `exportGrid` is true)

### Complete Example
```json
{
"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
}
}
}
```

## Contributing

## Citing this work
Expand Down
Loading
Loading