From c8f7f2739a719e7a22d8ae03c5501b43dbdda7ac Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Thu, 22 Oct 2026 13:13:21 +0200 Subject: [PATCH 1/6] Add .gitignore, .gitmodules, and update README with detailed usage instructions --- .gitignore | 1 + .gitmodules | 3 + README.md | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++- tessellator | 1 + 4 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 tessellator diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6f9a44 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/settings.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..eb66892 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tessellator"] + path = tessellator + url = https://github.com/OpenSEMBA/tessellator.git diff --git a/README.md b/README.md index 0c45223..c7ee333 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,200 @@ # caseMaker -A collection of python helper functions to create json files for FDTD cases + +`caseMaker` generates simulation cases for +[OpenSEMBA/fdtd](https://github.com/OpenSEMBA/fdtd) in the `.fdtd.json` format. + +The starting point is a set of files describing the geometry, mainly **lines and +triangles** in VTK format (`.vtp` / `.vtu`). The geometry is meshed with +[OpenSEMBA/tessellator](https://github.com/OpenSEMBA/tessellator), and the +resulting grid and mesh information is assembled into a case folder containing +everything needed to run the case: + +- `.fdtd.json` — the FDTD case definition; +- the excitation/magnitude files referenced by the case (e.g. `gauss.exc`); +- the geometry and grid files used to build it. + +```text +geometry files (lines, triangles, ...) + │ + ▼ + OpenSEMBA/tessellator → grid + meshes (VTK) + │ + ▼ + caseMaker → / + ├── .fdtd.json + ├── + └── needed inputs +``` + +The generated cases can be run directly with `semba-fdtd`, or through the +[Python wrapper](https://github.com/OpenSEMBA/fdtd/blob/main/src_pyWrapper/pyWrapper.py) +included in the OpenSEMBA/fdtd repository. The wrapper can launch the solver +and read the generated probe outputs back into Python, so `caseMaker` and +`pyWrapper` can be used together for an end-to-end workflow: + +```text +geometry → tessellator → caseMaker → case folder → pyWrapper → results +``` + +## Workflow + +1. **Describe the geometry.** Provide line/triangle meshes in VTK files. +2. **Mesh with tessellator.** Write a `.tessellator.json` describing the grid + and objects, then run: + + ```shell + tessellator -i .tessellator.json + ``` + + This produces the grid and the meshed geometry as VTK files. See the + [tessellator README](tessellator/README.md) for the JSON format. +3. **Build the FDTD case** with the `CaseMaker` Python API: load the grid, + add mesh elements, materials, sources and probes. +4. **Export and run.** `exportCase()` writes the `.fdtd.json` case. Run it with + `semba-fdtd -i .fdtd.json`, or use the fdtd Python wrapper + (`FDTD`) to launch it and load probe results (`Probe`). + +## Example + +The following is the sphere RCS case from `test/test_caseMaker.py`: + +```python +import numpy as np +from src.caseMaker import CaseMaker + +cm = CaseMaker() +cm.setNumberOfTimeSteps(1) +cm.setTimeStep(1e-12) +cm.setAllBoundaries("mur") + +# Grid and surface produced by tessellator. +cm.setGridFromVTK("sphere.grid.vtp") +sphere_id = cm.addCellElementsFromVTK("buggy_sphere.str.vtp") + +# PEC sphere. +pec_id = cm.addPECMaterial() +cm.addMaterialAssociation(pec_id, [sphere_id]) + +# Plane-wave source. +box_id = cm.addCellElementBox([[-75., -75., -75.], [75., 75., 75.]]) +direction = {"theta": np.pi / 2, "phi": 0.0} +polarization = {"theta": np.pi / 2, "phi": np.pi / 2} + +dt, w0, t0 = 1e-12, 0.1e-9, 10 * 0.1e-9 +t = np.arange(0, t0 + 20 * w0, dt) +data = np.column_stack((t, np.exp(-((t - t0) / w0) ** 2))) +np.savetxt("gauss.exc", data) +cm.addPlanewaveSource(box_id, "gauss.exc", direction, polarization) + +# Probes. +probe_id = cm.addNodeElement([-65.0, 0.0, 0.0]) +cm.addPointProbe(probe_id, name="front") + +n2ff_id = cm.addCellElementBox([[-85., -85., -85.], [85., 85., 85.]]) +theta = {"initial": np.pi / 2, "final": np.pi / 2, "step": 0.0} +phi = {"initial": np.pi, "final": np.pi, "step": 0.0} +domain = { + "type": "frequency", + "initialFrequency": 10e6, + "finalFrequency": 1e9, + "numberOfFrequencies": 10, + "frequencySpacing": "logarithmic", +} +cm.addFarFieldProbe(n2ff_id, "n2ff", theta, phi, domain) + +cm.exportCase("sphere_rcs") +``` + +## Running cases with the fdtd Python wrapper + +`caseMaker` only builds the case. To run it and analyse the results from +Python, use the wrapper shipped with OpenSEMBA/fdtd +(`src_pyWrapper/pyWrapper.py`). Add that directory to `PYTHONPATH` or copy the +module into your project, then: + +```python +from pyWrapper import FDTD, Probe + +# Run the case generated by caseMaker. +fdtd = FDTD( + "sphere_rcs.fdtd.json", + path_to_exe="/path/to/fdtd/build/bin/semba-fdtd", +) +fdtd.run() + +# Load the outputs of a probe defined in the case. +for probe_folder in fdtd.getSolvedProbeFolders("front"): + probe = Probe(probe_folder) + print(probe.name) + print(probe.data.head()) +``` + +The wrapper can also: + +- run with MPI or extra solver flags via `mpi_command` and `flags`; +- copy the case and its referenced input files to another directory with + `run_in_folder`; +- locate and parse point, wire, far-field, MTLN and movie probe outputs; +- remove generated output files with `cleanUp()`. + +Because `caseMaker` writes the `.fdtd.json` and its excitation files, the +wrapper can consume the resulting folder directly. This makes the combination +useful for parameter sweeps and automated post-processing: build each case with +`CaseMaker`, run it with `FDTD`, and inspect probes with `Probe`. + +## Requirements + +- Python 3 with NumPy and the VTK Python bindings. +- [pandas](https://pandas.pydata.org/) if you use the fdtd Python wrapper to + load probe results. +- [OpenSEMBA/tessellator](https://github.com/OpenSEMBA/tessellator), included as + the `tessellator/` git submodule. Clone recursively: + + ```shell + git clone --recursive + ``` + + and build it following its README. + +There is no packaging yet; run the code from the repository root or add `src/` +to `PYTHONPATH`. + +## API overview + +| Method | Purpose | +| --- | --- | +| `setGridFromVTK(path)` | Load grid origin, number of cells and steps from a VTK grid. | +| `addCellElementsFromVTK(path)` | Add staircased cell elements from QUAD/LINE VTK cells. | +| `addConformalVolumeFromVTK(path)` | Add a conformal volume from TRIANGLE VTK cells. | +| `addCellElementBox(bbox)` | Add a cell element from an absolute-coordinate box. | +| `addNodeElement(position)` | Add a mesh node (used by point probes, etc.). | +| `addPECMaterial()` / `addMaterialAssociation(...)` | Define materials and associate them with elements. | +| `addPlanewaveSource(...)` | Add a plane-wave source with an excitation file. | +| `addPointProbe(...)` / `addFarFieldProbe(...)` | Add point and far-field probes. | +| `exportCase(name)` | Write `.fdtd.json`. | + +## Tests + +```shell +python3 -m pytest test +``` + +Run from the repository root; the tests use the files in `testData/` and compare +the generated case against `testData/outputs/sphere_rcs.fdtd.json`. + +## Notes and limitations + +- Each VTK input must contain a cell-data array named `group` with a single + group; multiple groups per file are not supported. +- Cell elements are built from `VTK_QUAD` and `VTK_LINE` cells. Their points + must lie on grid nodes. +- Conformal volumes are built from `VTK_TRIANGLE` cells. +- Coordinates in the exported `.fdtd.json` are relative to the grid. +- `exportCase()` currently writes only `.fdtd.json` to the current + working directory. Input files referenced by the case (e.g. the excitation + file) must be placed alongside it; automatic creation/copying of the complete + case folder is not implemented yet. + +## License + +See [LICENSE](LICENSE). diff --git a/tessellator b/tessellator new file mode 160000 index 0000000..567b2f6 --- /dev/null +++ b/tessellator @@ -0,0 +1 @@ +Subproject commit 567b2f63476f0b964993b91ce4e37dd614f4b81a From 376d4c138030b5a66097b7238b7cf1a936e99cbf Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Fri, 23 Oct 2026 09:33:52 +0200 Subject: [PATCH 2/6] Add thin-slot test data and tessellator configurations - Created `Discretize_Wire.vtu` and `SquareInSquare.vtu` for slot centerline and staircased conductive plate respectively. - Added tessellator output files: `Discretize_Wire.tessellator.str.vtk`, `SquareInSquare.tessellator.str.vtk`, and `squareInSquare.tessellator.grid.vtk`. - Included a README.md to document the test data and usage instructions. - Introduced `squareInSquare.tessellator.json` for tessellator input configuration. --- .gitignore | 2 + README.md | 46 +- src/caseMaker.py | 165 ++++--- tessellator | 2 +- test/test_thin_slot.py | 94 ++++ test/utils.py | 1 + .../Discretize_Wire.tessellator.str.vtk | 139 ++++++ testData/thin_slot/Discretize_Wire.vtu | 46 ++ testData/thin_slot/README.md | 14 + .../SquareInSquare.tessellator.str.vtk | 410 ++++++++++++++++++ testData/thin_slot/SquareInSquare.vtu | 103 +++++ .../squareInSquare.tessellator.grid.vtk | 318 ++++++++++++++ .../thin_slot/squareInSquare.tessellator.json | 44 ++ 13 files changed, 1317 insertions(+), 67 deletions(-) create mode 100644 test/test_thin_slot.py create mode 100644 testData/thin_slot/Discretize_Wire.tessellator.str.vtk create mode 100644 testData/thin_slot/Discretize_Wire.vtu create mode 100644 testData/thin_slot/README.md create mode 100644 testData/thin_slot/SquareInSquare.tessellator.str.vtk create mode 100644 testData/thin_slot/SquareInSquare.vtu create mode 100644 testData/thin_slot/squareInSquare.tessellator.grid.vtk create mode 100644 testData/thin_slot/squareInSquare.tessellator.json diff --git a/.gitignore b/.gitignore index c6f9a44..0589af2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .vscode/settings.json +__pycache__/ +*.py[cod] diff --git a/README.md b/README.md index c7ee333..d4b3e8f 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,35 @@ cm.addFarFieldProbe(n2ff_id, "n2ff", theta, phi, domain) cm.exportCase("sphere_rcs") ``` +### Thin slots + +fdtd represents a thin slot as a material of type `thinSlot` with a `width`, +associated with line cell elements that follow the slot centerline. The +tessellator produces those line cells when the slot geometry is meshed with the +same grid as the surrounding conductor: + +```python +cm = CaseMaker() +cm.setGridFromVTK("squareInSquare.tessellator.grid.vtk") + +plate_id = cm.addCellElementsFromVTK( + "SquareInSquare.tessellator.str.vtk", name="plate") +slot_id = cm.addThinSlotElementsFromVTK( + "Discretize_Wire.tessellator.str.vtk", name="slot") + +pec_id = cm.addPECMaterial() +cm.addMaterialAssociation(pec_id, [plate_id]) + +slot_material_id = cm.addThinSlotMaterial(1e-3, name="slot") +cm.addMaterialAssociation(slot_material_id, [slot_id]) + +cm.exportCase("thin_slot") +``` + +`addThinSlotElementsFromVTK()` accepts only `VTK_LINE` cells. Its points must +lie on grid nodes, and the resulting line cells must be associated with a +conductive or surface-impedance sheet. + ## Running cases with the fdtd Python wrapper `caseMaker` only builds the case. To run it and analyse the results from @@ -165,10 +194,12 @@ to `PYTHONPATH`. | --- | --- | | `setGridFromVTK(path)` | Load grid origin, number of cells and steps from a VTK grid. | | `addCellElementsFromVTK(path)` | Add staircased cell elements from QUAD/LINE VTK cells. | -| `addConformalVolumeFromVTK(path)` | Add a conformal volume from TRIANGLE VTK cells. | +| `addThinSlotElementsFromVTK(path)` | Add line cell elements for a thin slot. | +| `addConformalVolumeFromVTK(path)` | Add a conformal volume/surface from TRIANGLE VTK cells. | | `addCellElementBox(bbox)` | Add a cell element from an absolute-coordinate box. | | `addNodeElement(position)` | Add a mesh node (used by point probes, etc.). | | `addPECMaterial()` / `addMaterialAssociation(...)` | Define materials and associate them with elements. | +| `addThinSlotMaterial(width)` | Define a `thinSlot` material (width in metres, matching the grid). | | `addPlanewaveSource(...)` | Add a plane-wave source with an excitation file. | | `addPointProbe(...)` / `addFarFieldProbe(...)` | Add point and far-field probes. | | `exportCase(name)` | Write `.fdtd.json`. | @@ -179,16 +210,23 @@ to `PYTHONPATH`. python3 -m pytest test ``` -Run from the repository root; the tests use the files in `testData/` and compare -the generated case against `testData/outputs/sphere_rcs.fdtd.json`. +Run from the repository root. The tests use the files in `testData/`; one test +compares the generated sphere case against +`testData/outputs/sphere_rcs.fdtd.json`, and the thin-slot tests use the +tessellator outputs in `testData/thin_slot/`. ## Notes and limitations +- VTK inputs may be legacy or XML files regardless of their extension; the + format is detected from the file contents. - Each VTK input must contain a cell-data array named `group` with a single group; multiple groups per file are not supported. - Cell elements are built from `VTK_QUAD` and `VTK_LINE` cells. Their points must lie on grid nodes. -- Conformal volumes are built from `VTK_TRIANGLE` cells. +- Thin-slot elements are built from `VTK_LINE` cells only and must be + associated with a conductive or surface-impedance sheet. +- Conformal elements are built from `VTK_TRIANGLE` cells and use the current + `cell` element type with a `volume` or `surface` subtype. - Coordinates in the exported `.fdtd.json` are relative to the grid. - `exportCase()` currently writes only `.fdtd.json` to the current working directory. Input files referenced by the case (e.g. the excitation diff --git a/src/caseMaker.py b/src/caseMaker.py index c6e6cc8..e787896 100644 --- a/src/caseMaker.py +++ b/src/caseMaker.py @@ -15,6 +15,31 @@ def __init__(self, json_filename=""): def __getitem__(self, key): return self.input[key] + def _readVTK(self, path_to_vtk): + assert os.path.isfile(path_to_vtk) + + with open(path_to_vtk, 'rb') as f: + header = f.read(512).lstrip() + + # The input files may use a legacy VTK header even when the extension is + # .vtu, so the format is detected from the file contents. + if header.startswith(b'<'): + reader = vtk.vtkXMLGenericDataObjectReader() + else: + reader = vtk.vtkGenericDataObjectReader() + + reader.SetFileName(path_to_vtk) + reader.Update() + return reader.GetOutput() + + def _checkSingleGroup(self, polyData): + groups = polyData.GetCellData().GetArray('group') + if groups is None: + return + vtkGroups = vtk_to_numpy(groups) + if len(np.unique(vtkGroups)) > 1: + raise ValueError("Different groups are not supported.") + def setNumberOfTimeSteps(self, steps): if 'general' not in self.input: self.input['general'] = {} @@ -28,19 +53,8 @@ def setTimeStep(self, time): self.input['general']['timeStep'] = time def setGridFromVTK(self, path_to_grid): - assert os.path.isfile(path_to_grid) - - with open(path_to_grid, 'r') as f: - c = f.read(1) - if (c == '<'): - reader = vtk.vtkXMLPolyDataReader() - else: - reader = vtk.vtkUnstructuredGridReader() - - reader.SetFileName(path_to_grid) - reader.Update() - - points = vtk_to_numpy(reader.GetOutput().GetPoints().GetData()) + polyData = self._readVTK(path_to_grid) + points = vtk_to_numpy(polyData.GetPoints().GetData()) if 'mesh' not in self.input: self.input['mesh'] = {} @@ -70,23 +84,12 @@ def setAllBoundaries(self, boundary_type): } } - def addConformalVolumeFromVTK(self, path_to_vtk): - assert os.path.isfile(path_to_vtk) - - with open(path_to_vtk, 'r') as f: - c = f.read(1) - if (c == '<'): - reader = vtk.vtkXMLPolyDataReader() - else: - reader = vtk.vtkUnstructuredGridReader() - - reader.SetFileName(path_to_vtk) - reader.Update() - polyData = reader.GetOutput() + def addConformalVolumeFromVTK(self, path_to_vtk, subtype="volume", name=None): + if subtype not in ("volume", "surface"): + raise ValueError("subtype must be 'volume' or 'surface'.") - vtkGroups = vtk_to_numpy(polyData.GetCellData().GetArray('group')) - if len(np.unique(vtkGroups)) > 1: - raise ValueError("Different groups are not supported.") + polyData = self._readVTK(path_to_vtk) + self._checkSingleGroup(polyData) # Stores in case input if 'mesh' not in self.input: @@ -97,33 +100,37 @@ def addConformalVolumeFromVTK(self, path_to_vtk): elements = self.input['mesh']['elements'] id = len(elements) + 1 - elements.append({ + element = { "id": id, - "type": "conformalVolume", + "type": "cell", + "subtype": subtype, "intervals" : [], "triangles": self._getTriangles(polyData) - }) + } + if name is not None: + element["name"] = name + elements.append(element) return id - def addCellElementsFromVTK(self, path_to_vtk): - assert os.path.isfile(path_to_vtk) + def addCellElementsFromVTK(self, path_to_vtk, name=None): + polyData = self._readVTK(path_to_vtk) + self._checkSingleGroup(polyData) + return self._addCellElement(polyData, name=name) - with open(path_to_vtk, 'r') as f: - c = f.read(1) - if (c == '<'): - reader = vtk.vtkXMLPolyDataReader() - else: - reader = vtk.vtkUnstructuredGridReader() + def addThinSlotElementsFromVTK(self, path_to_vtk, name=None): + '''Adds a cell element made of VTK_LINE cells for a thin slot.''' + polyData = self._readVTK(path_to_vtk) + self._checkSingleGroup(polyData) - reader.SetFileName(path_to_vtk) - reader.Update() - polyData = reader.GetOutput() + for i in range(polyData.GetNumberOfCells()): + if polyData.GetCellType(i) != vtk.VTK_LINE: + raise ValueError( + "Thin slot elements must be built from VTK_LINE cells only.") - vtkGroups = vtk_to_numpy(polyData.GetCellData().GetArray('group')) - if len(np.unique(vtkGroups)) > 1: - raise ValueError("Different groups are not supported.") + return self._addCellElement(polyData, name=name) + def _addCellElement(self, polyData, name=None): # Stores in case input if 'mesh' not in self.input: self.input['mesh'] = {} @@ -133,11 +140,14 @@ def addCellElementsFromVTK(self, path_to_vtk): elements = self.input['mesh']['elements'] id = len(elements) + 1 - elements.append({ + element = { "id": id, "type": "cell", "intervals": self._getCellsIntervals(polyData) - }) + } + if name is not None: + element["name"] = name + elements.append(element) return id @@ -197,6 +207,26 @@ def addNodeElement(self, position): return elementId + def addThinSlotMaterial(self, width, name=None): + '''Adds a thinSlot material. Width is in metres, as used by the grid.''' + if width <= 0: + raise ValueError("The thin slot width must be positive.") + + if 'materials' not in self.input: + self.input['materials'] = [] + + id = len(self.input['materials']) + 1 + material = { + "id": id, + "type": "thinSlot", + "width": float(width) + } + if name is not None: + material["name"] = name + self.input['materials'].append(material) + + return id + def addPECMaterial(self): if 'materials' not in self.input: self.input['materials'] = [] @@ -218,14 +248,23 @@ def addMaterialAssociation(self, materialId: int, elementIds: list): raise ValueError("No elements defined.") if len(elementIds) == 0: raise ValueError("No elements to associate.") + if materialId < 1 or materialId > len(self.input['materials']): + raise ValueError("Invalid material id.") + if any(elementId < 1 or elementId > len(self.input['mesh']['elements']) + for elementId in elementIds): + raise ValueError("Invalid element id.") if 'materialAssociations' not in self.input: self.input['materialAssociations'] = [] - self.input['materialAssociations'].append({ + association = { 'materialId': materialId, 'elementIds': elementIds - }) + } + if self.input['materials'][materialId - 1]['type'] == 'thinSlot': + association['type'] = 'thinSlot' + + self.input['materialAssociations'].append(association) def addPlanewaveSource(self, elementId, magnitudeFile, direction, polarization): assert os.path.isfile(magnitudeFile) @@ -380,27 +419,29 @@ def _getCellsIntervals(self, polyData): relative = self._absoluteToRelative( vtk_to_numpy(polyData.GetPoints().GetData())) - # Precounts - numberOfIntervals = 0 - for i in range(polyData.GetNumberOfCells()): - cellType = polyData.GetCellType(i) - if cellType == (vtk.VTK_QUAD or vtk.VTK_LINE): - numberOfIntervals += 1 - res = [None] * numberOfIntervals - - # Writes as list - c = 0 + res = [] for i in range(polyData.GetNumberOfCells()): cellType = polyData.GetCellType(i) if cellType == vtk.VTK_QUAD: p1 = polyData.GetCell(i).GetPointId(0) p2 = polyData.GetCell(i).GetPointId(2) + expectedVaryingDirections = 2 elif cellType == vtk.VTK_LINE: p1 = polyData.GetCell(i).GetPointId(0) p2 = polyData.GetCell(i).GetPointId(1) + expectedVaryingDirections = 1 else: continue - res[c] = [relative[p1].tolist(), relative[p2].tolist()] - c += 1 + + start = relative[p1] + end = relative[p2] + varyingDirections = np.count_nonzero(start != end) + if varyingDirections != expectedVaryingDirections: + raise ValueError( + "Cell elements must be axis-aligned with the grid. " + "Found a cell with {} varying directions.".format( + varyingDirections)) + + res.append([start.tolist(), end.tolist()]) return res diff --git a/tessellator b/tessellator index 567b2f6..ce8c780 160000 --- a/tessellator +++ b/tessellator @@ -1 +1 @@ -Subproject commit 567b2f63476f0b964993b91ce4e37dd614f4b81a +Subproject commit ce8c780ae86632de35142ffeb72ce548d12bc97b diff --git a/test/test_thin_slot.py b/test/test_thin_slot.py new file mode 100644 index 0000000..8b34554 --- /dev/null +++ b/test/test_thin_slot.py @@ -0,0 +1,94 @@ +import json + +import pytest + +from utils import * +from src.caseMaker import * + + +def build_thin_slot_case(): + cm = CaseMaker() + cm.setGridFromVTK( + THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') + + plateId = cm.addCellElementsFromVTK( + THIN_SLOT_FOLDER + 'SquareInSquare.tessellator.str.vtk', + name='plate') + slotId = cm.addThinSlotElementsFromVTK( + THIN_SLOT_FOLDER + 'Discretize_Wire.tessellator.str.vtk', + name='slot') + + pecId = cm.addPECMaterial() + cm.addMaterialAssociation(pecId, [plateId]) + + slotMaterialId = cm.addThinSlotMaterial(1e-3, name='slot') + cm.addMaterialAssociation(slotMaterialId, [slotId]) + + return cm, plateId, slotId, slotMaterialId + + +def test_casemaker_thin_slot_from_vtk(tmp_path, monkeypatch): + cm, plateId, slotId, slotMaterialId = build_thin_slot_case() + + assert cm['mesh']['grid']['numberOfCells'] == [40, 40, 23] + assert cm['mesh']['grid']['origin'] == [-20.0, -20.0, -10.0] + + assert cm['materials'] == [ + {'id': 1, 'type': 'pec'}, + {'id': 2, 'type': 'thinSlot', 'width': 1e-3, 'name': 'slot'} + ] + assert cm['materialAssociations'] == [ + {'materialId': 1, 'elementIds': [plateId]}, + {'materialId': slotMaterialId, 'elementIds': [slotId], + 'type': 'thinSlot'} + ] + + plate = cm['mesh']['elements'][plateId - 1] + assert plate['name'] == 'plate' + assert len(plate['intervals']) == 124 + for start, end in plate['intervals']: + assert np.count_nonzero(np.array(start) != np.array(end)) == 2 + + slot = cm['mesh']['elements'][slotId - 1] + assert slot['name'] == 'slot' + assert len(slot['intervals']) == 44 + for start, end in slot['intervals']: + assert np.count_nonzero(np.array(start) != np.array(end)) == 1 + + monkeypatch.chdir(tmp_path) + cm.exportCase('thin_slot') + with open('thin_slot.fdtd.json') as f: + exported = json.load(f) + assert exported == cm.input + + +def test_casemaker_thin_slot_rejects_non_line_cells(): + cm = CaseMaker() + cm.setGridFromVTK( + THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') + + with pytest.raises(ValueError): + cm.addThinSlotElementsFromVTK( + THIN_SLOT_FOLDER + 'SquareInSquare.tessellator.str.vtk') + + +def test_casemaker_thin_slot_rejects_non_positive_width(): + cm = CaseMaker() + + with pytest.raises(ValueError): + cm.addThinSlotMaterial(0.0) + + +def test_casemaker_conformal_volume_from_legacy_vtu(): + cm = CaseMaker() + cm.setGridFromVTK( + THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') + + elementId = cm.addConformalVolumeFromVTK( + THIN_SLOT_FOLDER + 'SquareInSquare.vtu', name='surface') + + element = cm['mesh']['elements'][elementId - 1] + assert element['type'] == 'cell' + assert element['subtype'] == 'volume' + assert element['name'] == 'surface' + assert len(element['triangles']) == 54 diff --git a/test/utils.py b/test/utils.py index a29af6d..cdcad8f 100644 --- a/test/utils.py +++ b/test/utils.py @@ -5,3 +5,4 @@ EXCITATIONS_FOLDER = os.path.join(TEST_DATA_FOLDER, 'excitations/') OUTPUTS_FOLDER = os.path.join(TEST_DATA_FOLDER, 'outputs/') GEOMETRIES_FOLDER = os.path.join(TEST_DATA_FOLDER, 'geometries/') +THIN_SLOT_FOLDER = os.path.join(TEST_DATA_FOLDER, 'thin_slot/') diff --git a/testData/thin_slot/Discretize_Wire.tessellator.str.vtk b/testData/thin_slot/Discretize_Wire.tessellator.str.vtk new file mode 100644 index 0000000..a77cc00 --- /dev/null +++ b/testData/thin_slot/Discretize_Wire.tessellator.str.vtk @@ -0,0 +1,139 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 44 float +-5 5 0 -5 4 0 -5 3 0 +-5 2 0 -5 1 0 -5 0 0 +-5 -1 0 -5 -2 0 -5 -3 0 +-5 -3 1 -5 -4 1 -5 -5 1 +-4 -5 1 -3 -5 1 -3 -5 0 +-2 -5 0 -1 -5 0 0 -5 0 +1 -5 0 2 -5 0 3 -5 0 +4 -5 0 5 -5 0 5 -4 0 +5 -3 0 5 -2 0 5 -1 0 +5 0 0 5 1 0 5 2 0 +5 3 0 5 3 1 5 4 1 +5 5 1 4 5 1 3 5 1 +3 5 0 2 5 0 1 5 0 +0 5 0 -1 5 0 -2 5 0 +-3 5 0 -4 5 0 +CELLS 45 88 +OFFSETS vtktypeint64 +0 2 4 6 8 10 12 14 16 +18 20 22 24 26 28 30 32 34 +36 38 40 42 44 46 48 50 52 +54 56 58 60 62 64 66 68 70 +72 74 76 78 80 82 84 86 88 + +CONNECTIVITY vtktypeint64 +0 1 1 2 2 3 3 4 4 +5 5 6 6 7 7 8 8 9 +9 10 10 11 11 12 12 13 13 +14 14 15 15 16 16 17 17 18 +18 19 19 20 20 21 21 22 22 +23 23 24 24 25 25 26 26 27 +27 28 28 29 29 30 30 31 31 +32 32 33 33 34 34 35 35 36 +36 37 37 38 38 39 39 40 40 +41 41 42 42 43 43 0 +CELL_TYPES 44 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 + +CELL_DATA 44 +FIELD FieldData 2 +group 1 44 int +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +groupNames 1 44 string +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire + diff --git a/testData/thin_slot/Discretize_Wire.vtu b/testData/thin_slot/Discretize_Wire.vtu new file mode 100644 index 0000000..05677d3 --- /dev/null +++ b/testData/thin_slot/Discretize_Wire.vtu @@ -0,0 +1,46 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 21 double +-5 5 0 -5 2.7981 0.0364 -5 0.5955 0.1455 +-5 -1.6088 0.3276 -5 -3.8161 0.5829 -5 -5 0.75 +-2.7858 -5 0.4546 -0.5764 -5 0.2332 1.6294 -5 0.0852 +3.8327 -5 0.0102 5 -5 0 5 -2.7981 0.0364 +5 -0.5955 0.1455 5 1.6088 0.3276 5 3.8161 0.5829 +5 5 0.75 2.7858 5 0.4546 0.5764 5 0.2332 +-1.6294 5 0.0852 -3.8327 5 0.0102 -5 5 0 + +CELLS 21 40 +OFFSETS vtktypeint64 +0 2 4 6 8 10 12 14 16 +18 20 22 24 26 28 30 32 34 +36 38 40 +CONNECTIVITY vtktypeint64 +0 1 1 2 2 3 3 4 4 +5 5 6 6 7 7 8 8 9 +9 10 10 11 11 12 12 13 13 +14 14 15 15 16 16 17 17 18 +18 19 19 20 +CELL_TYPES 20 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 + diff --git a/testData/thin_slot/README.md b/testData/thin_slot/README.md new file mode 100644 index 0000000..513d14c --- /dev/null +++ b/testData/thin_slot/README.md @@ -0,0 +1,14 @@ +# Thin-slot test data + +- `SquareInSquare.vtu`: staircased conductive plate. +- `Discretize_Wire.vtu`: slot centreline. +- `squareInSquare.tessellator.json`: tessellator input. +- `SquareInSquare.tessellator.str.vtk`, + `Discretize_Wire.tessellator.str.vtk` and + `squareInSquare.tessellator.grid.vtk`: generated with + + ```shell + tessellator -i squareInSquare.tessellator.json + ``` + + using the `OpenSEMBA/tessellator` dev commit `ce8c780`. diff --git a/testData/thin_slot/SquareInSquare.tessellator.str.vtk b/testData/thin_slot/SquareInSquare.tessellator.str.vtk new file mode 100644 index 0000000..56ca758 --- /dev/null +++ b/testData/thin_slot/SquareInSquare.tessellator.str.vtk @@ -0,0 +1,410 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 186 float +-10 -10 3 -9 -10 3 -9 -9 3 +-9 -9 2 -10 -9 3 -10 -9 2 +-10 -8 2 -10 -8 3 -9 -7 2 +-9 -6 2 -9 -10 2 -8 -10 2 +-8 -10 3 -6 -9 2 -9 -4 2 +-9 -4 1 -10 -4 1 -10 -4 2 +-4 -10 2 -4 -9 2 -4 -9 1 +-4 -10 1 -4 -8 1 -4 -7 1 +-4 -6 1 -9 -6 1 -7 -7 2 +-7 -6 2 -7 -6 1 -7 -7 1 +-6 -7 2 -6 -7 1 -6 -9 1 +-4 -5 1 -3 -5 1 -2 -6 1 +-2 -5 1 -2 -5 0 -3 -5 0 +-2 -6 0 -1 -7 1 -1 -6 1 +-1 -6 0 -1 -7 0 -7 -1 1 +-7 -1 0 -6 -3 1 -6 -2 1 +-6 -1 1 -6 -1 0 -6 -2 0 +-5 -3 1 -5 -2 1 -5 -2 0 +-5 -3 0 -10 4 0 -10 5 0 +-10 6 0 -10 7 0 10 -5 0 +10 -4 0 0 7 0 0 8 0 +0 8 1 1 6 0 1 7 0 +1 7 1 0 7 1 1 6 1 +-2 9 0 -2 10 0 -2 10 1 +-1 8 0 -1 9 0 -1 9 1 +-2 9 1 -1 8 1 6 1 0 +5 2 0 6 2 0 7 0 0 +7 1 0 7 1 1 6 2 1 +6 1 1 8 0 0 8 0 1 +7 0 1 9 0 1 8 -1 0 +9 -2 0 9 -1 0 9 -1 1 +8 -1 1 10 -3 0 10 -2 0 +10 -2 1 9 -2 1 5 5 1 +5 6 1 5 7 1 6 7 1 +5 8 1 6 9 2 5 9 2 +5 9 1 6 9 1 5 10 2 +7 6 1 7 7 1 7 7 2 +6 7 2 7 6 2 9 6 2 +9 5 1 9 5 2 9 6 1 +9 7 2 10 5 2 8 10 2 +9 9 2 9 10 2 9 10 3 +8 10 3 9 9 3 10 8 2 +10 9 2 10 9 3 10 8 3 +10 10 3 -9 0 1 -9 1 1 +-9 2 1 -9 2 0 -10 2 0 +-10 2 1 -9 1 0 -8 1 1 +-8 1 0 -8 0 1 -8 0 0 +-7 0 0 -7 0 1 1 -9 1 +1 -8 1 1 -8 0 0 -8 0 +0 -8 1 1 -9 0 2 -10 1 +2 -9 1 2 -9 0 2 -10 0 +0 -7 0 0 -7 1 10 -10 0 +10 -9 0 10 -8 0 10 -7 0 +10 -6 0 -10 8 0 -10 9 0 +-10 10 0 4 10 1 4 10 2 +5 10 1 3 5 0 3 5 1 +3 6 1 4 5 1 3 6 0 +10 4 1 10 4 2 10 5 1 +5 4 1 5 2 1 -4 -4 1 +-4 -3 1 -4 -3 0 -4 -4 0 +-3 -4 1 -3 -4 0 4 4 0 +4 4 1 4 5 0 5 4 0 + +CELLS 125 496 +OFFSETS vtktypeint64 +0 4 8 12 16 20 24 28 32 +36 40 44 48 52 56 60 64 68 +72 76 80 84 88 92 96 100 104 +108 112 116 120 124 128 132 136 140 +144 148 152 156 160 164 168 172 176 +180 184 188 192 196 200 204 208 212 +216 220 224 228 232 236 240 244 248 +252 256 260 264 268 272 276 280 284 +288 292 296 300 304 308 312 316 320 +324 328 332 336 340 344 348 352 356 +360 364 368 372 376 380 384 388 392 +396 400 404 408 412 416 420 424 428 +432 436 440 444 448 452 456 460 464 +468 472 476 480 484 488 492 496 +CONNECTIVITY vtktypeint64 +5 6 7 4 10 1 12 11 134 +78 185 55 55 182 184 56 56 166 +170 57 57 64 65 58 58 61 62 +160 160 72 73 161 161 69 70 162 +136 77 79 133 140 80 81 138 45 +89 85 141 50 90 91 49 54 94 +95 53 179 60 94 178 38 59 60 +181 39 159 59 37 43 158 159 42 +146 157 158 153 148 156 157 145 152 +155 156 151 10 3 2 1 25 15 +14 9 136 133 132 131 5 4 2 +3 32 13 19 20 148 143 150 151 +16 15 132 135 25 28 142 130 130 +139 137 131 29 31 48 44 32 20 +177 46 46 51 52 47 21 149 150 +20 20 143 144 22 22 147 154 23 +23 40 41 24 24 35 36 33 33 +34 180 176 75 105 165 71 76 102 +105 74 67 100 102 63 68 99 100 +66 167 98 99 168 183 174 98 169 +175 83 106 105 84 82 109 101 87 +88 116 108 93 92 88 86 97 96 +173 114 140 138 137 139 146 147 144 +145 5 3 14 17 10 18 19 3 +3 13 30 8 8 26 27 9 104 +120 121 107 111 117 120 103 112 113 +117 110 115 118 126 120 29 28 27 +26 45 141 142 44 29 26 30 31 +43 40 154 153 0 1 2 4 124 +127 129 122 32 31 30 13 50 49 +48 47 25 9 27 28 39 35 41 +42 54 53 52 51 38 34 36 37 +21 20 19 18 179 178 177 176 16 +17 14 15 179 176 180 181 38 181 +180 34 54 51 177 178 69 75 71 +70 90 95 96 97 39 37 36 35 +50 47 52 53 72 76 74 73 89 +91 92 93 43 42 41 40 45 44 +48 49 61 67 63 62 80 85 86 +87 146 153 154 147 140 139 142 141 +64 68 66 65 77 81 82 84 148 +145 144 143 136 131 137 138 78 79 +83 175 152 151 150 149 134 135 132 +133 166 167 168 170 182 183 169 184 +182 185 174 183 105 104 107 165 78 +175 174 185 114 173 118 115 166 184 +169 167 77 84 83 79 101 111 103 +106 64 170 168 68 108 116 113 112 +80 87 82 81 108 112 110 109 61 +65 66 67 101 109 110 111 89 93 +86 85 72 62 63 76 90 97 92 +91 114 115 113 116 120 124 122 121 +69 73 74 75 105 106 103 104 120 +126 127 124 125 128 127 126 171 172 +118 173 119 121 122 123 163 165 107 +164 +CELL_TYPES 124 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 + +CELL_DATA 124 +FIELD FieldData 2 +group 1 124 int +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 +groupNames 1 124 string +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare + diff --git a/testData/thin_slot/SquareInSquare.vtu b/testData/thin_slot/SquareInSquare.vtu new file mode 100644 index 0000000..2010774 --- /dev/null +++ b/testData/thin_slot/SquareInSquare.vtu @@ -0,0 +1,103 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 37 double +-10 -5.2512040138 1.7444941998 -10 -10 3 -5.2512040138 -10 1.7444941998 +-5 -5 0.75 -10 -0.50240826607 0.82725435495 -0.50240826607 -10 0.82725435495 +-0.55555558205 -5 0.23148147762 -5 -0.55555558205 0.23148147762 5 -5 0 +4.1737427711 -10 0.25458955765 7.0868711472 -10 0.063647389412 2.2222223282 -5 0.057870369405 +-5 5 0 -10 7.0868711472 0.063647389412 -10 4.1737427711 0.25458955765 +-5 2.2222223282 0.057870369405 -4.836022377 10 0.20000000298 -0.55555558205 5 0.14814814925 +10 -4.836022377 0.20000000298 5 -0.55555558205 0.14814814925 0.3279556036 10 0.80000001192 +2.2222223282 5 0.3912037015 10 0.3279556036 0.80000001192 5 2.2222223282 0.3912037015 +10 5.163977623 1.7245966196 5.163977623 10 1.7245966196 5 5 0.75 +10 10 3 -7.5 0.85990697145 0.3306812644 0.85990697145 -7.5 0.3306812644 +8.5434360504 -7.4180111885 0.0094993533567 10 -10 0 -7.4180111885 8.5434360504 0.0094993533567 +-10 10 0 3.6930999756 7.5 0.93964117765 7.5 3.6930999756 0.93964117765 +0 0 0 +CELLS 55 162 +OFFSETS vtktypeint64 +0 3 6 9 12 15 18 21 24 +27 30 33 36 39 42 45 48 51 +54 57 60 63 66 69 72 75 78 +81 84 87 90 93 96 99 102 105 +108 111 114 117 120 123 126 129 132 +135 138 141 144 147 150 153 156 159 +162 +CONNECTIVITY vtktypeint64 +0 1 2 3 4 0 3 2 5 +3 0 2 6 3 5 7 4 3 +8 9 10 8 11 9 12 13 14 +12 14 15 16 12 17 18 19 8 +20 17 21 20 16 17 22 23 19 +22 19 18 24 25 26 27 25 24 +28 14 4 28 7 15 28 4 7 +28 15 14 29 5 9 29 11 6 +29 6 5 29 9 11 30 10 31 +30 31 18 30 18 8 30 8 10 +32 33 13 32 16 33 32 13 12 +32 12 16 34 25 20 34 21 26 +34 20 21 34 26 25 35 22 24 +35 26 23 35 23 22 35 24 26 +6 7 3 19 11 8 17 12 15 +26 21 23 36 15 7 36 6 11 +36 19 23 36 21 17 36 7 6 +36 11 19 36 17 15 36 23 21 + +CELL_TYPES 54 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 + diff --git a/testData/thin_slot/squareInSquare.tessellator.grid.vtk b/testData/thin_slot/squareInSquare.tessellator.grid.vtk new file mode 100644 index 0000000..8909d7d --- /dev/null +++ b/testData/thin_slot/squareInSquare.tessellator.grid.vtk @@ -0,0 +1,318 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 424 float +-20 -20 -10 -20 20 -10 -20 20 13 +-20 -20 13 -19 -20 -10 -19 20 -10 +-19 20 13 -19 -20 13 -18 -20 -10 +-18 20 -10 -18 20 13 -18 -20 13 +-17 -20 -10 -17 20 -10 -17 20 13 +-17 -20 13 -16 -20 -10 -16 20 -10 +-16 20 13 -16 -20 13 -15 -20 -10 +-15 20 -10 -15 20 13 -15 -20 13 +-14 -20 -10 -14 20 -10 -14 20 13 +-14 -20 13 -13 -20 -10 -13 20 -10 +-13 20 13 -13 -20 13 -12 -20 -10 +-12 20 -10 -12 20 13 -12 -20 13 +-11 -20 -10 -11 20 -10 -11 20 13 +-11 -20 13 -10 -20 -10 -10 20 -10 +-10 20 13 -10 -20 13 -9 -20 -10 +-9 20 -10 -9 20 13 -9 -20 13 +-8 -20 -10 -8 20 -10 -8 20 13 +-8 -20 13 -7 -20 -10 -7 20 -10 +-7 20 13 -7 -20 13 -6 -20 -10 +-6 20 -10 -6 20 13 -6 -20 13 +-5 -20 -10 -5 20 -10 -5 20 13 +-5 -20 13 -4 -20 -10 -4 20 -10 +-4 20 13 -4 -20 13 -3 -20 -10 +-3 20 -10 -3 20 13 -3 -20 13 +-2 -20 -10 -2 20 -10 -2 20 13 +-2 -20 13 -1 -20 -10 -1 20 -10 +-1 20 13 -1 -20 13 0 -20 -10 +0 20 -10 0 20 13 0 -20 13 +1 -20 -10 1 20 -10 1 20 13 +1 -20 13 2 -20 -10 2 20 -10 +2 20 13 2 -20 13 3 -20 -10 +3 20 -10 3 20 13 3 -20 13 +4 -20 -10 4 20 -10 4 20 13 +4 -20 13 5 -20 -10 5 20 -10 +5 20 13 5 -20 13 6 -20 -10 +6 20 -10 6 20 13 6 -20 13 +7 -20 -10 7 20 -10 7 20 13 +7 -20 13 8 -20 -10 8 20 -10 +8 20 13 8 -20 13 9 -20 -10 +9 20 -10 9 20 13 9 -20 13 +10 -20 -10 10 20 -10 10 20 13 +10 -20 13 11 -20 -10 11 20 -10 +11 20 13 11 -20 13 12 -20 -10 +12 20 -10 12 20 13 12 -20 13 +13 -20 -10 13 20 -10 13 20 13 +13 -20 13 14 -20 -10 14 20 -10 +14 20 13 14 -20 13 15 -20 -10 +15 20 -10 15 20 13 15 -20 13 +16 -20 -10 16 20 -10 16 20 13 +16 -20 13 17 -20 -10 17 20 -10 +17 20 13 17 -20 13 18 -20 -10 +18 20 -10 18 20 13 18 -20 13 +19 -20 -10 19 20 -10 19 20 13 +19 -20 13 20 -20 -10 20 20 -10 +20 20 13 20 -20 13 -20 -20 -10 +-20 -20 13 20 -20 13 20 -20 -10 +-20 -19 -10 -20 -19 13 20 -19 13 +20 -19 -10 -20 -18 -10 -20 -18 13 +20 -18 13 20 -18 -10 -20 -17 -10 +-20 -17 13 20 -17 13 20 -17 -10 +-20 -16 -10 -20 -16 13 20 -16 13 +20 -16 -10 -20 -15 -10 -20 -15 13 +20 -15 13 20 -15 -10 -20 -14 -10 +-20 -14 13 20 -14 13 20 -14 -10 +-20 -13 -10 -20 -13 13 20 -13 13 +20 -13 -10 -20 -12 -10 -20 -12 13 +20 -12 13 20 -12 -10 -20 -11 -10 +-20 -11 13 20 -11 13 20 -11 -10 +-20 -10 -10 -20 -10 13 20 -10 13 +20 -10 -10 -20 -9 -10 -20 -9 13 +20 -9 13 20 -9 -10 -20 -8 -10 +-20 -8 13 20 -8 13 20 -8 -10 +-20 -7 -10 -20 -7 13 20 -7 13 +20 -7 -10 -20 -6 -10 -20 -6 13 +20 -6 13 20 -6 -10 -20 -5 -10 +-20 -5 13 20 -5 13 20 -5 -10 +-20 -4 -10 -20 -4 13 20 -4 13 +20 -4 -10 -20 -3 -10 -20 -3 13 +20 -3 13 20 -3 -10 -20 -2 -10 +-20 -2 13 20 -2 13 20 -2 -10 +-20 -1 -10 -20 -1 13 20 -1 13 +20 -1 -10 -20 0 -10 -20 0 13 +20 0 13 20 0 -10 -20 1 -10 +-20 1 13 20 1 13 20 1 -10 +-20 2 -10 -20 2 13 20 2 13 +20 2 -10 -20 3 -10 -20 3 13 +20 3 13 20 3 -10 -20 4 -10 +-20 4 13 20 4 13 20 4 -10 +-20 5 -10 -20 5 13 20 5 13 +20 5 -10 -20 6 -10 -20 6 13 +20 6 13 20 6 -10 -20 7 -10 +-20 7 13 20 7 13 20 7 -10 +-20 8 -10 -20 8 13 20 8 13 +20 8 -10 -20 9 -10 -20 9 13 +20 9 13 20 9 -10 -20 10 -10 +-20 10 13 20 10 13 20 10 -10 +-20 11 -10 -20 11 13 20 11 13 +20 11 -10 -20 12 -10 -20 12 13 +20 12 13 20 12 -10 -20 13 -10 +-20 13 13 20 13 13 20 13 -10 +-20 14 -10 -20 14 13 20 14 13 +20 14 -10 -20 15 -10 -20 15 13 +20 15 13 20 15 -10 -20 16 -10 +-20 16 13 20 16 13 20 16 -10 +-20 17 -10 -20 17 13 20 17 13 +20 17 -10 -20 18 -10 -20 18 13 +20 18 13 20 18 -10 -20 19 -10 +-20 19 13 20 19 13 20 19 -10 +-20 20 -10 -20 20 13 20 20 13 +20 20 -10 -20 -20 -10 20 -20 -10 +20 20 -10 -20 20 -10 -20 -20 -9 +20 -20 -9 20 20 -9 -20 20 -9 +-20 -20 -8 20 -20 -8 20 20 -8 +-20 20 -8 -20 -20 -7 20 -20 -7 +20 20 -7 -20 20 -7 -20 -20 -6 +20 -20 -6 20 20 -6 -20 20 -6 +-20 -20 -5 20 -20 -5 20 20 -5 +-20 20 -5 -20 -20 -4 20 -20 -4 +20 20 -4 -20 20 -4 -20 -20 -3 +20 -20 -3 20 20 -3 -20 20 -3 +-20 -20 -2 20 -20 -2 20 20 -2 +-20 20 -2 -20 -20 -1 20 -20 -1 +20 20 -1 -20 20 -1 -20 -20 0 +20 -20 0 20 20 0 -20 20 0 +-20 -20 1 20 -20 1 20 20 1 +-20 20 1 -20 -20 2 20 -20 2 +20 20 2 -20 20 2 -20 -20 3 +20 -20 3 20 20 3 -20 20 3 +-20 -20 4 20 -20 4 20 20 4 +-20 20 4 -20 -20 5 20 -20 5 +20 20 5 -20 20 5 -20 -20 6 +20 -20 6 20 20 6 -20 20 6 +-20 -20 7 20 -20 7 20 20 7 +-20 20 7 -20 -20 8 20 -20 8 +20 20 8 -20 20 8 -20 -20 9 +20 -20 9 20 20 9 -20 20 9 +-20 -20 10 20 -20 10 20 20 10 +-20 20 10 -20 -20 11 20 -20 11 +20 20 11 -20 20 11 -20 -20 12 +20 -20 12 20 20 12 -20 20 12 +-20 -20 13 20 -20 13 20 20 13 +-20 20 13 +CELLS 107 424 +OFFSETS vtktypeint64 +0 4 8 12 16 20 24 28 32 +36 40 44 48 52 56 60 64 68 +72 76 80 84 88 92 96 100 104 +108 112 116 120 124 128 132 136 140 +144 148 152 156 160 164 168 172 176 +180 184 188 192 196 200 204 208 212 +216 220 224 228 232 236 240 244 248 +252 256 260 264 268 272 276 280 284 +288 292 296 300 304 308 312 316 320 +324 328 332 336 340 344 348 352 356 +360 364 368 372 376 380 384 388 392 +396 400 404 408 412 416 420 424 +CONNECTIVITY vtktypeint64 +0 1 2 3 4 5 6 7 8 +9 10 11 12 13 14 15 16 17 +18 19 20 21 22 23 24 25 26 +27 28 29 30 31 32 33 34 35 +36 37 38 39 40 41 42 43 44 +45 46 47 48 49 50 51 52 53 +54 55 56 57 58 59 60 61 62 +63 64 65 66 67 68 69 70 71 +72 73 74 75 76 77 78 79 80 +81 82 83 84 85 86 87 88 89 +90 91 92 93 94 95 96 97 98 +99 100 101 102 103 104 105 106 107 +108 109 110 111 112 113 114 115 116 +117 118 119 120 121 122 123 124 125 +126 127 128 129 130 131 132 133 134 +135 136 137 138 139 140 141 142 143 +144 145 146 147 148 149 150 151 152 +153 154 155 156 157 158 159 160 161 +162 163 164 165 166 167 168 169 170 +171 172 173 174 175 176 177 178 179 +180 181 182 183 184 185 186 187 188 +189 190 191 192 193 194 195 196 197 +198 199 200 201 202 203 204 205 206 +207 208 209 210 211 212 213 214 215 +216 217 218 219 220 221 222 223 224 +225 226 227 228 229 230 231 232 233 +234 235 236 237 238 239 240 241 242 +243 244 245 246 247 248 249 250 251 +252 253 254 255 256 257 258 259 260 +261 262 263 264 265 266 267 268 269 +270 271 272 273 274 275 276 277 278 +279 280 281 282 283 284 285 286 287 +288 289 290 291 292 293 294 295 296 +297 298 299 300 301 302 303 304 305 +306 307 308 309 310 311 312 313 314 +315 316 317 318 319 320 321 322 323 +324 325 326 327 328 329 330 331 332 +333 334 335 336 337 338 339 340 341 +342 343 344 345 346 347 348 349 350 +351 352 353 354 355 356 357 358 359 +360 361 362 363 364 365 366 367 368 +369 370 371 372 373 374 375 376 377 +378 379 380 381 382 383 384 385 386 +387 388 389 390 391 392 393 394 395 +396 397 398 399 400 401 402 403 404 +405 406 407 408 409 410 411 412 413 +414 415 416 417 418 419 420 421 422 +423 +CELL_TYPES 106 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 + diff --git a/testData/thin_slot/squareInSquare.tessellator.json b/testData/thin_slot/squareInSquare.tessellator.json new file mode 100644 index 0000000..a218727 --- /dev/null +++ b/testData/thin_slot/squareInSquare.tessellator.json @@ -0,0 +1,44 @@ +{ + "_version": "0.1", + "_format": "Tessellator Data File in JSON format", + "grid": { + "numberOfCells": [ + 40, + 40, + 23 + ], + "boundingBox": [ + [ + -20.0, + -20.0, + -10.0 + ], + [ + 20.0, + 20.0, + 13.0 + ] + ] + }, + "mesher": { + "type": "staircase", + "options": { + "compress": true + } + }, + "objects": [ + { + "filename": "SquareInSquare.vtu", + "group": "SquareInSquare", + "ghost": false + }, + { + "filename": "Discretize_Wire.vtu", + "group": "Discretize_Wire", + "ghost": false + } + ], + "output": { + "singleFile": false + } +} \ No newline at end of file From ce2b5a1b302b3a4d594638e3a1a74e2f70725a0f Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Fri, 23 Oct 2026 10:03:48 +0200 Subject: [PATCH 3/6] Add GitHub Actions workflow for testing and create requirements file --- .github/workflows/tests.yml | 49 +++++++++++++++++++++++++++++++++++++ requirements.txt | 3 +++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 requirements.txt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f8081d0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,49 @@ +name: tests + +on: + push: + branches: + - main + - dev + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + pytest: + name: pytest / python ${{ matrix.python-version }} + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.12"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Run tests + run: python -m pytest -vv test/ --durations=0 --junitxml=pytest-results.xml + + - name: Upload failed test diagnostics + if: failure() + uses: actions/upload-artifact@v4 + with: + name: pytest-results-${{ matrix.python-version }} + path: pytest-results.xml + if-no-files-found: warn diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d4921a1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +numpy +vtk +pytest From 918da073175b79c20b497f408641a4b2319d0207 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Tue, 27 Oct 2026 09:45:25 +0100 Subject: [PATCH 4/6] Add new VTU and JSON files for SquareInSquare and Discretize_Wire - Created SquareInSquare.vtu with point and cell data for the square in square geometry. - Added squareInSquare.embeddedSurface.tessellator.grid.vtk for the tessellated grid representation. - Introduced squareInSquare.embeddedSurface.tessellator.json to define grid properties and object references. - Added Discretize_Wire.vtu containing point and cell data for the wire discretization. - Created squareInSquare.tessellator.json to specify grid dimensions, bounding box, and mesher options. --- .../check-submodules-default-branch.yml | 125 ++++++ .github/workflows/tests.yml | 116 +++++ .gitmodules | 5 + README.md | 62 ++- fdtd | 1 + src/caseMaker.py | 84 ++-- tessellator | 2 +- test/test_thin_slot.py | 158 ++++++- test/utils.py | 15 + testData/thin_slot/README.md | 17 +- .../Discretize_Wire.tessellator.str.vtk | 160 +++++++ .../thin_slot/surface/Discretize_Wire.vtu | 46 ++ .../SquareInSquare.tessellator.str.vtk | 410 ++++++++++++++++++ testData/thin_slot/surface/SquareInSquare.vtu | 103 +++++ ...quare.embeddedSurface.tessellator.grid.vtk | 318 ++++++++++++++ ...eInSquare.embeddedSurface.tessellator.json | 25 ++ tmp_cases/Discretize_Wire.vtu | 46 ++ tmp_cases/SquareInSquare.vtu | 103 +++++ tmp_cases/squareInSquare.tessellator.json | 44 ++ 19 files changed, 1755 insertions(+), 85 deletions(-) create mode 100644 .github/workflows/check-submodules-default-branch.yml create mode 160000 fdtd create mode 100644 testData/thin_slot/surface/Discretize_Wire.tessellator.str.vtk create mode 100644 testData/thin_slot/surface/Discretize_Wire.vtu create mode 100644 testData/thin_slot/surface/SquareInSquare.tessellator.str.vtk create mode 100644 testData/thin_slot/surface/SquareInSquare.vtu create mode 100644 testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.grid.vtk create mode 100644 testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.json create mode 100644 tmp_cases/Discretize_Wire.vtu create mode 100644 tmp_cases/SquareInSquare.vtu create mode 100644 tmp_cases/squareInSquare.tessellator.json diff --git a/.github/workflows/check-submodules-default-branch.yml b/.github/workflows/check-submodules-default-branch.yml new file mode 100644 index 0000000..25f0034 --- /dev/null +++ b/.github/workflows/check-submodules-default-branch.yml @@ -0,0 +1,125 @@ +name: check-submodules-default-branch + +'on': + push: + branches: + - main + - dev + - thin-slots-cases + pull_request: + branches: + - main + - dev + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + check-submodules-default-branch: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository with submodules + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Validate submodules point to their configured branch + shell: bash + run: | + set -euo pipefail + + if [[ ! -f .gitmodules ]]; then + echo "No .gitmodules file found. Nothing to validate." + exit 0 + fi + + mapfile -t submodule_entries < <(git config -f .gitmodules --get-regexp '^submodule\..*\.path$') + + if [[ ${#submodule_entries[@]} -eq 0 ]]; then + echo "No submodules found in .gitmodules." + exit 0 + fi + + failed=0 + + for entry in "${submodule_entries[@]}"; do + key="${entry%% *}" + path="${entry#* }" + branch_key="${key%.path}.branch" + configured_branch="$(git config -f .gitmodules --get "${branch_key}" || true)" + + echo "" + echo "Checking submodule: ${path}" + if [[ -n "${configured_branch}" ]]; then + echo "Configured branch: ${configured_branch}" + fi + + if [[ ! -d "${path}" ]]; then + echo "::error title=Missing submodule directory::Submodule path '${path}' is missing in checkout" + failed=1 + continue + fi + + if ! git -C "${path}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "::error title=Invalid submodule checkout::Path '${path}' is not a valid git repository" + failed=1 + continue + fi + + sha="$(git -C "${path}" rev-parse HEAD)" + echo "Pinned commit: ${sha}" + + git -C "${path}" remote set-branches --add origin '*' + git -C "${path}" fetch --no-tags origin '+refs/heads/*:refs/remotes/origin/*' >/dev/null + + if git -C "${path}" rev-parse --is-shallow-repository | grep -q true; then + git -C "${path}" fetch --unshallow --no-tags origin >/dev/null + fi + + candidate_branches=() + if [[ -n "${configured_branch}" ]]; then + candidate_branches+=("${configured_branch}") + fi + if git -C "${path}" show-ref --verify --quiet refs/remotes/origin/main; then + candidate_branches+=("main") + fi + if git -C "${path}" show-ref --verify --quiet refs/remotes/origin/master; then + candidate_branches+=("master") + fi + + if [[ ${#candidate_branches[@]} -eq 0 ]]; then + echo "::error title=Cannot determine branch::No configured branch or main/master found for submodule '${path}'" + failed=1 + continue + fi + + is_valid=0 + for branch in "${candidate_branches[@]}"; do + if ! git -C "${path}" show-ref --verify --quiet "refs/remotes/origin/${branch}"; then + echo "::warning title=Missing submodule branch::Branch '${branch}' does not exist in '${path}'" + continue + fi + if git -C "${path}" merge-base --is-ancestor "${sha}" "origin/${branch}"; then + echo "OK: ${path} commit belongs to origin/${branch} history" + is_valid=1 + break + fi + done + + if [[ ${is_valid} -eq 0 ]]; then + echo "::error title=Submodule not on configured history::Submodule '${path}' points to ${sha}, which is not contained in any accepted branch: ${candidate_branches[*]}" + failed=1 + fi + done + + if [[ ${failed} -ne 0 ]]; then + echo "" + echo "One or more submodules are not aligned with their configured branch history." + exit 1 + fi + + echo "" + echo "All submodule commits are contained in their configured branch history." diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f8081d0..98fc018 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,7 @@ on: branches: - main - dev + - thin-slots-cases pull_request: workflow_dispatch: @@ -47,3 +48,118 @@ jobs: name: pytest-results-${{ matrix.python-version }} path: pytest-results.xml if-no-files-found: warn + + fdtd-integration: + name: fdtd integration + runs-on: ubuntu-latest + timeout-minutes: 45 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Setup Fortran compiler + uses: fortran-lang/setup-fortran@v1 + with: + compiler: gcc + version: "11" + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + + - name: Install HDF5 + run: | + sudo apt-get update + sudo apt-get install -y libhdf5-dev + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Build fdtd + run: | + cmake -S fdtd -B fdtd/build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DSEMBA_FDTD_ENABLE_MPI=OFF \ + -DSEMBA_FDTD_ENABLE_MTLN=OFF \ + -DSEMBA_FDTD_ENABLE_TEST=ON + cmake --build fdtd/build -j + + - name: Run fdtd native tests + run: ctest --test-dir fdtd/build --output-on-failure + + - name: Run caseMaker tests with fdtd + env: + SEMBA_EXE: ${{ github.workspace }}/fdtd/build/bin/semba-fdtd + OMP_NUM_THREADS: "1" + run: python -m pytest -vv test/ --durations=0 --junitxml=pytest-fdtd-results.xml + + - name: Upload failed test diagnostics + if: failure() + uses: actions/upload-artifact@v4 + with: + name: fdtd-integration-results + path: | + pytest-fdtd-results.xml + fdtd/build/Testing/Temporary/LastTest.log + if-no-files-found: warn + + tessellator-smoke: + name: tessellator embedded-surface smoke test + runs-on: ubuntu-latest + timeout-minutes: 45 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout tessellator submodule + run: git submodule update --init tessellator + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libvtk9-dev ninja-build + + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: eed289f6e06a5e7a5c9e6a729671b0a56af7dd69 + runVcpkgInstall: false + + - name: Build tessellator + run: | + cmake -S tessellator -B tessellator/build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DTESSELLATOR_ENABLE_TESTS=OFF \ + -DTESSELLATOR_ENABLE_CGAL=OFF \ + -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" + cmake --build tessellator/build -j + + - name: Run embedded-surface case + run: | + rm -rf /tmp/thin-slot-smoke + mkdir -p /tmp/thin-slot-smoke + cp testData/thin_slot/surface/* /tmp/thin-slot-smoke/ + cd /tmp/thin-slot-smoke + "${GITHUB_WORKSPACE}/tessellator/build/bin/tessellator" \ + -i squareInSquare.embeddedSurface.tessellator.json + test -f SquareInSquare.tessellator.str.vtk + test -f Discretize_Wire.tessellator.str.vtk + test -f squareInSquare.embeddedSurface.tessellator.grid.vtk diff --git a/.gitmodules b/.gitmodules index eb66892..018e983 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,8 @@ [submodule "tessellator"] path = tessellator url = https://github.com/OpenSEMBA/tessellator.git + branch = 112-thin-slots-meshing +[submodule "fdtd"] + path = fdtd + url = https://github.com/OpenSEMBA/fdtd.git + branch = 493-thin-slots-on-surfaces diff --git a/README.md b/README.md index d4b3e8f..ee73148 100644 --- a/README.md +++ b/README.md @@ -107,14 +107,22 @@ cm.exportCase("sphere_rcs") ### Thin slots -fdtd represents a thin slot as a material of type `thinSlot` with a `width`, -associated with line cell elements that follow the slot centerline. The -tessellator produces those line cells when the slot geometry is meshed with the -same grid as the surrounding conductor: +fdtd represents a thin slot as a material of type `thinSlot` with a `width`. +The slot can be meshed either as a line or as an embedded one-quad-wide surface +strip. The surface form is recommended because fdtd can use the cell faces +directly: + +```json +"mesher": { + "type": "staircase", + "options": {"embedded": "surface"} +} +``` ```python cm = CaseMaker() -cm.setGridFromVTK("squareInSquare.tessellator.grid.vtk") +cm.setGridFromVTK( + "squareInSquare.embeddedSurface.tessellator.grid.vtk") plate_id = cm.addCellElementsFromVTK( "SquareInSquare.tessellator.str.vtk", name="plate") @@ -130,9 +138,10 @@ cm.addMaterialAssociation(slot_material_id, [slot_id]) cm.exportCase("thin_slot") ``` -`addThinSlotElementsFromVTK()` accepts only `VTK_LINE` cells. Its points must -lie on grid nodes, and the resulting line cells must be associated with a -conductive or surface-impedance sheet. +`addThinSlotElementsFromVTK()` accepts `VTK_LINE` cells (legacy line mode) and +`VTK_QUAD` cells (embedded surface strips). All points must lie on grid nodes. +The tessellator validates that the slot strip is embedded in a conductive host +surface; fdtd rejects ambiguous or perimeter-running strips. ## Running cases with the fdtd Python wrapper @@ -177,13 +186,26 @@ useful for parameter sweeps and automated post-processing: build each case with - [pandas](https://pandas.pydata.org/) if you use the fdtd Python wrapper to load probe results. - [OpenSEMBA/tessellator](https://github.com/OpenSEMBA/tessellator), included as - the `tessellator/` git submodule. Clone recursively: + the `tessellator/` git submodule, for generating the input meshes. +- [OpenSEMBA/fdtd](https://github.com/OpenSEMBA/fdtd), included as the `fdtd/` + git submodule, for the solver integration test. + +Clone recursively: + +```shell +git clone --recursive +``` - ```shell - git clone --recursive - ``` +Build the solver used by the integration test with: - and build it following its README. +```shell +cmake -S fdtd -B fdtd/build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DSEMBA_FDTD_ENABLE_MPI=OFF \ + -DSEMBA_FDTD_ENABLE_MTLN=OFF \ + -DSEMBA_FDTD_ENABLE_TEST=ON +cmake --build fdtd/build -j +``` There is no packaging yet; run the code from the repository root or add `src/` to `PYTHONPATH`. @@ -194,7 +216,7 @@ to `PYTHONPATH`. | --- | --- | | `setGridFromVTK(path)` | Load grid origin, number of cells and steps from a VTK grid. | | `addCellElementsFromVTK(path)` | Add staircased cell elements from QUAD/LINE VTK cells. | -| `addThinSlotElementsFromVTK(path)` | Add line cell elements for a thin slot. | +| `addThinSlotElementsFromVTK(path)` | Add line or embedded-surface cell elements for a thin slot. | | `addConformalVolumeFromVTK(path)` | Add a conformal volume/surface from TRIANGLE VTK cells. | | `addCellElementBox(bbox)` | Add a cell element from an absolute-coordinate box. | | `addNodeElement(position)` | Add a mesh node (used by point probes, etc.). | @@ -215,6 +237,13 @@ compares the generated sphere case against `testData/outputs/sphere_rcs.fdtd.json`, and the thin-slot tests use the tessellator outputs in `testData/thin_slot/`. +The fdtd integration test is skipped when `semba-fdtd` is not available. Point +`SEMBA_EXE` at the solver to run it explicitly: + +```shell +SEMBA_EXE="$PWD/fdtd/build/bin/semba-fdtd" python3 -m pytest test +``` + ## Notes and limitations - VTK inputs may be legacy or XML files regardless of their extension; the @@ -223,8 +252,9 @@ tessellator outputs in `testData/thin_slot/`. group; multiple groups per file are not supported. - Cell elements are built from `VTK_QUAD` and `VTK_LINE` cells. Their points must lie on grid nodes. -- Thin-slot elements are built from `VTK_LINE` cells only and must be - associated with a conductive or surface-impedance sheet. +- Thin-slot elements are built from `VTK_LINE` cells (legacy) or `VTK_QUAD` + cells (embedded surface strips). They must be associated with a conductive + or surface-impedance sheet. - Conformal elements are built from `VTK_TRIANGLE` cells and use the current `cell` element type with a `volume` or `surface` subtype. - Coordinates in the exported `.fdtd.json` are relative to the grid. diff --git a/fdtd b/fdtd new file mode 160000 index 0000000..01d853b --- /dev/null +++ b/fdtd @@ -0,0 +1 @@ +Subproject commit 01d853b1d16c784e36fc45a16c3c6ad2065b628f diff --git a/src/caseMaker.py b/src/caseMaker.py index e787896..c64b13d 100644 --- a/src/caseMaker.py +++ b/src/caseMaker.py @@ -119,14 +119,16 @@ def addCellElementsFromVTK(self, path_to_vtk, name=None): return self._addCellElement(polyData, name=name) def addThinSlotElementsFromVTK(self, path_to_vtk, name=None): - '''Adds a cell element made of VTK_LINE cells for a thin slot.''' + '''Adds line or embedded-surface cell elements for a thin slot.''' polyData = self._readVTK(path_to_vtk) self._checkSingleGroup(polyData) for i in range(polyData.GetNumberOfCells()): - if polyData.GetCellType(i) != vtk.VTK_LINE: + cellType = polyData.GetCellType(i) + if cellType not in (vtk.VTK_LINE, vtk.VTK_QUAD): raise ValueError( - "Thin slot elements must be built from VTK_LINE cells only.") + "Thin slot elements must be built from VTK_LINE or " + "VTK_QUAD cells only.") return self._addCellElement(polyData, name=name) @@ -161,7 +163,7 @@ def addCellElementBox(self, boundingBox): elements = self.input['mesh']['elements'] rel = self._absoluteToRelative( - np.array([boundingBox[0], boundingBox[1]])) + np.array([boundingBox[0], boundingBox[1]]), snap=True) id = len(elements) + 1 elements.append({ @@ -182,7 +184,7 @@ def addNodeElement(self, position): pos = position.reshape((1, 3)) else: raise ValueError("Invalid type for position") - relative = self._absoluteToRelative(pos) + relative = self._absoluteToRelative(pos, snap=True) if 'mesh' not in self.input: self.input['mesh'] = {} @@ -333,42 +335,44 @@ def _relativeToAbsolute(self, relativeCoordinates): return res - def _filterIntegerCoordinates(self, absoluteCoordinates): - nInts = 0 - for c in absoluteCoordinates: - if all(v == True for v in [modf(c[x])[0] == 0 for x in range(3)]) == True: - nInts = nInts + 1 - res = np.zeros([nInts,3]) - nInts = 0 - for c in absoluteCoordinates: - if all(v == True for v in [modf(c[x])[0] == 0 for x in range(3)]) == True: - res[nInts] = c - nInts = nInts + 1 - return res - - def _absoluteToRelative(self, absoluteCoordinates, arg_type = int): + def _absoluteToRelative(self, absoluteCoordinates, arg_type = int, snap = False): gridLines = self._buildGridLines() - - if (arg_type == int): - absoluteCoordinates = self._filterIntegerCoordinates(absoluteCoordinates) - - res = np.empty_like(absoluteCoordinates, dtype=arg_type) - for x in range(3): - for i in range(absoluteCoordinates.shape[0]): - array = gridLines[x] - value = absoluteCoordinates[i, x] - idx = np.searchsorted(array, value, side="left") - if (arg_type == int): - if idx > 0 and (idx == len(array) or np.abs(value - array[idx-1]) < np.abs(value - array[idx])): - res[i, x] = idx-1 - else: - res[i,x] = idx - else: - res[i, x] = idx-1 + (value-array[idx-1])/(array[idx]-array[idx-1]) - - if np.any(absoluteCoordinates - self._relativeToAbsolute(res) > 1e-10): - raise ValueError( - "Error in conversion from absolute to relative coordinates.") + coordinates = np.asarray(absoluteCoordinates, dtype=float) + if coordinates.ndim == 1: + coordinates = coordinates.reshape((1, 3)) + + res = np.empty_like(coordinates, dtype=arg_type) + for axis in range(3): + lines = gridLines[axis] + values = coordinates[:, axis] + tolerance = 1e-6 * max(1.0, float(np.max(np.abs(lines)))) + + if np.any(values < lines[0] - tolerance) or \ + np.any(values > lines[-1] + tolerance): + raise ValueError( + "Coordinate is outside the grid in axis {}.".format(axis)) + + idx = np.searchsorted(lines, values, side="right") - 1 + idx = np.clip(idx, 0, len(lines) - 2) + lower = lines[idx] + upper = lines[idx + 1] + + if (arg_type == int): + nearest = np.where( + np.abs(values - lower) < np.abs(values - upper), + idx, idx + 1) + if not snap and np.any( + np.abs(values - lines[nearest]) > tolerance): + raise ValueError( + "Coordinate is not aligned with a grid node in axis {}." + .format(axis)) + res[:, axis] = nearest + else: + span = upper - lower + with np.errstate(divide="ignore", invalid="ignore"): + fraction = np.where( + span != 0, (values - lower) / span, 0.0) + res[:, axis] = idx + fraction return res diff --git a/tessellator b/tessellator index ce8c780..be94f61 160000 --- a/tessellator +++ b/tessellator @@ -1 +1 @@ -Subproject commit ce8c780ae86632de35142ffeb72ce548d12bc97b +Subproject commit be94f618f812ae598e06c193f221aef8eb5d458a diff --git a/test/test_thin_slot.py b/test/test_thin_slot.py index 8b34554..b3b0a55 100644 --- a/test/test_thin_slot.py +++ b/test/test_thin_slot.py @@ -1,75 +1,189 @@ import json +import os +import subprocess +import numpy as np import pytest from utils import * from src.caseMaker import * -def build_thin_slot_case(): +def build_thin_slot_line_case(): cm = CaseMaker() cm.setGridFromVTK( THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') - plateId = cm.addCellElementsFromVTK( + plate_id = cm.addCellElementsFromVTK( THIN_SLOT_FOLDER + 'SquareInSquare.tessellator.str.vtk', name='plate') - slotId = cm.addThinSlotElementsFromVTK( + slot_id = cm.addThinSlotElementsFromVTK( THIN_SLOT_FOLDER + 'Discretize_Wire.tessellator.str.vtk', name='slot') - pecId = cm.addPECMaterial() - cm.addMaterialAssociation(pecId, [plateId]) + pec_id = cm.addPECMaterial() + cm.addMaterialAssociation(pec_id, [plate_id]) - slotMaterialId = cm.addThinSlotMaterial(1e-3, name='slot') - cm.addMaterialAssociation(slotMaterialId, [slotId]) + slot_material_id = cm.addThinSlotMaterial(1e-3, name='slot') + cm.addMaterialAssociation(slot_material_id, [slot_id]) - return cm, plateId, slotId, slotMaterialId + return cm, plate_id, slot_id, slot_material_id -def test_casemaker_thin_slot_from_vtk(tmp_path, monkeypatch): - cm, plateId, slotId, slotMaterialId = build_thin_slot_case() +def build_thin_slot_surface_case(): + cm = CaseMaker() + cm.setGridFromVTK( + THIN_SLOT_SURFACE_FOLDER + + 'squareInSquare.embeddedSurface.tessellator.grid.vtk') + + plate_id = cm.addCellElementsFromVTK( + THIN_SLOT_SURFACE_FOLDER + 'SquareInSquare.tessellator.str.vtk', + name='plate') + slot_id = cm.addThinSlotElementsFromVTK( + THIN_SLOT_SURFACE_FOLDER + 'Discretize_Wire.tessellator.str.vtk', + name='slot') + + pec_id = cm.addPECMaterial() + cm.addMaterialAssociation(pec_id, [plate_id]) + + slot_material_id = cm.addThinSlotMaterial(1e-3, name='slot') + cm.addMaterialAssociation(slot_material_id, [slot_id]) + + return cm, plate_id, slot_id, slot_material_id - assert cm['mesh']['grid']['numberOfCells'] == [40, 40, 23] - assert cm['mesh']['grid']['origin'] == [-20.0, -20.0, -10.0] +def assert_thin_slot_materials(cm, plate_id, slot_id, slot_material_id): assert cm['materials'] == [ {'id': 1, 'type': 'pec'}, {'id': 2, 'type': 'thinSlot', 'width': 1e-3, 'name': 'slot'} ] assert cm['materialAssociations'] == [ - {'materialId': 1, 'elementIds': [plateId]}, - {'materialId': slotMaterialId, 'elementIds': [slotId], + {'materialId': 1, 'elementIds': [plate_id]}, + {'materialId': slot_material_id, 'elementIds': [slot_id], 'type': 'thinSlot'} ] - plate = cm['mesh']['elements'][plateId - 1] + +def test_casemaker_thin_slot_line_from_vtk(tmp_path, monkeypatch): + cm, plate_id, slot_id, slot_material_id = build_thin_slot_line_case() + + assert cm['mesh']['grid']['numberOfCells'] == [40, 40, 23] + assert cm['mesh']['grid']['origin'] == [-20.0, -20.0, -10.0] + assert_thin_slot_materials(cm, plate_id, slot_id, slot_material_id) + + plate = cm['mesh']['elements'][plate_id - 1] assert plate['name'] == 'plate' assert len(plate['intervals']) == 124 for start, end in plate['intervals']: assert np.count_nonzero(np.array(start) != np.array(end)) == 2 - slot = cm['mesh']['elements'][slotId - 1] + slot = cm['mesh']['elements'][slot_id - 1] assert slot['name'] == 'slot' assert len(slot['intervals']) == 44 for start, end in slot['intervals']: assert np.count_nonzero(np.array(start) != np.array(end)) == 1 monkeypatch.chdir(tmp_path) - cm.exportCase('thin_slot') - with open('thin_slot.fdtd.json') as f: + cm.exportCase('thin_slot_line') + with open('thin_slot_line.fdtd.json') as f: exported = json.load(f) assert exported == cm.input -def test_casemaker_thin_slot_rejects_non_line_cells(): +def test_casemaker_thin_slot_surface_from_vtk(tmp_path, monkeypatch): + cm, plate_id, slot_id, slot_material_id = build_thin_slot_surface_case() + + assert cm['mesh']['grid']['numberOfCells'] == [40, 40, 23] + assert cm['mesh']['grid']['origin'] == [-20.0, -20.0, -10.0] + assert_thin_slot_materials(cm, plate_id, slot_id, slot_material_id) + + plate = cm['mesh']['elements'][plate_id - 1] + assert plate['name'] == 'plate' + assert len(plate['intervals']) == 124 + + slot = cm['mesh']['elements'][slot_id - 1] + assert slot['name'] == 'slot' + assert len(slot['intervals']) == 43 + for start, end in slot['intervals']: + assert np.count_nonzero(np.array(start) != np.array(end)) == 2 + + monkeypatch.chdir(tmp_path) + cm.exportCase('thin_slot_surface') + with open('thin_slot_surface.fdtd.json') as f: + exported = json.load(f) + assert exported == cm.input + + +def test_casemaker_thin_slot_surface_launches_fdtd(tmp_path, monkeypatch): + semba = find_fdtd_executable() + if semba is None: + pytest.skip("semba-fdtd not found; build fdtd or set SEMBA_EXE.") + + cm, plate_id, slot_id, slot_material_id = build_thin_slot_surface_case() + cm.setNumberOfTimeSteps(1) + cm.setTimeStep(1e-12) + cm.setAllBoundaries('mur') + + box_id = cm.addCellElementBox([[-19.0, -19.0, -9.0], [19.0, 19.0, 12.0]]) + t = np.arange(0.0, 3e-9, 1e-12) + excitation = np.column_stack( + (t, np.exp(-((t - 1e-9) / 0.2e-9) ** 2))) + + monkeypatch.chdir(tmp_path) + np.savetxt('gauss.exc', excitation) + cm.addPlanewaveSource( + box_id, 'gauss.exc', + {"theta": np.pi / 2, "phi": 0.0}, + {"theta": np.pi / 2, "phi": np.pi / 2}) + cm.addPointProbe(cm.addNodeElement([0.0, 0.0, 0.0]), 'center') + cm.exportCase('thin_slot_surface') + + result = subprocess.run( + [semba, '-i', 'thin_slot_surface.fdtd.json'], + cwd=tmp_path, + env={**os.environ, 'OMP_NUM_THREADS': '1'}, + capture_output=True, + text=True, + timeout=300) + output = result.stdout + result.stderr + + assert result.returncode == 0, output + assert 'ERROR' not in output, output + assert 'STOP' not in output, output + assert 'DONE :' in output or 'ENDED' in output, output + assert list(tmp_path.glob('thin_slot_surface.fdtd_center_Ex_*.dat')) + + +def test_casemaker_grid_alignment_with_non_integer_steps(): + cm = CaseMaker() + cm.input['mesh'] = { + 'grid': { + 'origin': [-20.0, -20.0, -10.0], + 'numberOfCells': [40, 40, 20], + 'steps': { + 'x': [1.0] * 40, + 'y': [1.0] * 40, + 'z': [1.15] * 20, + }, + } + } + + box_id = cm.addCellElementBox( + [[-20.0, -20.0, 0.3499999940395355], [20.0, 20.0, 13.0]]) + + assert cm['mesh']['elements'][box_id - 1]['intervals'] == [ + [[0, 0, 9], [40, 40, 20]] + ] + + +def test_casemaker_thin_slot_rejects_unsupported_cells(): cm = CaseMaker() cm.setGridFromVTK( THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') with pytest.raises(ValueError): cm.addThinSlotElementsFromVTK( - THIN_SLOT_FOLDER + 'SquareInSquare.tessellator.str.vtk') + THIN_SLOT_FOLDER + 'SquareInSquare.vtu') def test_casemaker_thin_slot_rejects_non_positive_width(): @@ -84,10 +198,10 @@ def test_casemaker_conformal_volume_from_legacy_vtu(): cm.setGridFromVTK( THIN_SLOT_FOLDER + 'squareInSquare.tessellator.grid.vtk') - elementId = cm.addConformalVolumeFromVTK( + element_id = cm.addConformalVolumeFromVTK( THIN_SLOT_FOLDER + 'SquareInSquare.vtu', name='surface') - element = cm['mesh']['elements'][elementId - 1] + element = cm['mesh']['elements'][element_id - 1] assert element['type'] == 'cell' assert element['subtype'] == 'volume' assert element['name'] == 'surface' diff --git a/test/utils.py b/test/utils.py index cdcad8f..c435bb2 100644 --- a/test/utils.py +++ b/test/utils.py @@ -6,3 +6,18 @@ OUTPUTS_FOLDER = os.path.join(TEST_DATA_FOLDER, 'outputs/') GEOMETRIES_FOLDER = os.path.join(TEST_DATA_FOLDER, 'geometries/') THIN_SLOT_FOLDER = os.path.join(TEST_DATA_FOLDER, 'thin_slot/') +THIN_SLOT_SURFACE_FOLDER = os.path.join(THIN_SLOT_FOLDER, 'surface/') + + +def find_fdtd_executable(): + repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + candidates = [ + os.environ.get('SEMBA_EXE'), + os.path.join(repo_root, 'fdtd/build/bin/semba-fdtd'), + os.path.join(repo_root, 'fdtd/build-rls/bin/semba-fdtd'), + os.path.join(repo_root, 'fdtd/build-dbg/bin/semba-fdtd'), + ] + for candidate in candidates: + if candidate and os.path.isfile(candidate) and os.access(candidate, os.X_OK): + return candidate + return None diff --git a/testData/thin_slot/README.md b/testData/thin_slot/README.md index 513d14c..4380c34 100644 --- a/testData/thin_slot/README.md +++ b/testData/thin_slot/README.md @@ -2,13 +2,18 @@ - `SquareInSquare.vtu`: staircased conductive plate. - `Discretize_Wire.vtu`: slot centreline. -- `squareInSquare.tessellator.json`: tessellator input. +- `squareInSquare.tessellator.json`: line-mode tessellator input. - `SquareInSquare.tessellator.str.vtk`, `Discretize_Wire.tessellator.str.vtk` and - `squareInSquare.tessellator.grid.vtk`: generated with + `squareInSquare.tessellator.grid.vtk`: line-mode outputs. +- `surface/squareInSquare.embeddedSurface.tessellator.json`: embedded-surface + tessellator input. +- `surface/*.vtk`: embedded-surface outputs used by the fdtd launch test. - ```shell - tessellator -i squareInSquare.tessellator.json - ``` +Outputs were generated with `OpenSEMBA/tessellator` branch +`112-thin-slots-meshing` (PR #113): - using the `OpenSEMBA/tessellator` dev commit `ce8c780`. +```shell +tessellator -i squareInSquare.tessellator.json +tessellator -i surface/squareInSquare.embeddedSurface.tessellator.json +``` diff --git a/testData/thin_slot/surface/Discretize_Wire.tessellator.str.vtk b/testData/thin_slot/surface/Discretize_Wire.tessellator.str.vtk new file mode 100644 index 0000000..0d9af82 --- /dev/null +++ b/testData/thin_slot/surface/Discretize_Wire.tessellator.str.vtk @@ -0,0 +1,160 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 86 float +-5 2 0 -5 3 0 -5 4 0 +-4 2 0 -4 3 0 -4 4 0 +4 2 0 4 3 0 4 4 0 +5 2 0 5 3 0 5 4 0 +-5 5 0 -4 5 0 -3 5 0 +-2 5 0 -1 5 0 0 5 0 +1 5 0 2 5 0 3 5 0 +-5 6 0 -4 6 0 -3 6 0 +-2 6 0 -1 6 0 0 6 0 +1 6 0 2 6 0 3 6 0 +-5 1 0 -4 1 0 4 1 0 +5 1 0 -5 0 0 -4 0 0 +4 0 0 5 0 0 -5 -1 0 +-4 -1 0 4 -1 0 5 -1 0 +-5 -2 0 -4 -2 0 4 -2 0 +5 -2 0 -5 -3 0 -4 -3 0 +4 -3 0 5 -3 0 -3 -4 0 +-2 -4 0 -1 -4 0 0 -4 0 +1 -4 0 2 -4 0 3 -4 0 +4 -4 0 5 -4 0 -3 -5 0 +-2 -5 0 -1 -5 0 0 -5 0 +1 -5 0 2 -5 0 3 -5 0 +4 -5 0 5 -5 0 -5 -5 1 +-5 -4 1 -5 -3 1 -4 -5 1 +-4 -4 1 -4 -3 1 -3 -5 1 +-3 -4 1 3 6 1 4 6 1 +5 6 1 3 5 1 4 5 1 +5 5 1 4 4 1 5 4 1 +5 2 1 5 3 1 +CELLS 44 172 +OFFSETS vtktypeint64 +0 4 8 12 16 20 24 28 32 +36 40 44 48 52 56 60 64 68 +72 76 80 84 88 92 96 100 104 +108 112 116 120 124 128 132 136 140 +144 148 152 156 160 164 168 172 +CONNECTIVITY vtktypeint64 +0 3 4 1 1 4 5 2 6 +9 10 7 2 5 13 12 12 13 +22 21 13 14 23 22 14 15 24 +23 15 16 25 24 16 17 26 25 +17 18 27 26 18 19 28 27 19 +20 29 28 30 31 3 0 32 33 +9 6 34 35 31 30 36 37 33 +32 38 39 35 34 40 41 37 36 +42 43 39 38 44 45 41 40 46 +47 43 42 48 49 45 44 57 58 +49 48 59 60 51 50 60 61 52 +51 61 62 53 52 62 63 54 53 +63 64 55 54 64 65 56 55 65 +66 57 56 66 67 58 57 68 71 +72 69 69 72 73 70 71 74 75 +72 79 80 77 76 80 81 78 77 +82 83 81 80 59 50 75 74 46 +70 73 47 20 79 76 29 8 11 +83 82 9 84 85 10 10 85 83 +11 +CELL_TYPES 43 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 + +CELL_DATA 43 +FIELD FieldData 2 +group 1 43 int +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 +groupNames 1 43 string +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire +Discretize_Wire + diff --git a/testData/thin_slot/surface/Discretize_Wire.vtu b/testData/thin_slot/surface/Discretize_Wire.vtu new file mode 100644 index 0000000..05677d3 --- /dev/null +++ b/testData/thin_slot/surface/Discretize_Wire.vtu @@ -0,0 +1,46 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 21 double +-5 5 0 -5 2.7981 0.0364 -5 0.5955 0.1455 +-5 -1.6088 0.3276 -5 -3.8161 0.5829 -5 -5 0.75 +-2.7858 -5 0.4546 -0.5764 -5 0.2332 1.6294 -5 0.0852 +3.8327 -5 0.0102 5 -5 0 5 -2.7981 0.0364 +5 -0.5955 0.1455 5 1.6088 0.3276 5 3.8161 0.5829 +5 5 0.75 2.7858 5 0.4546 0.5764 5 0.2332 +-1.6294 5 0.0852 -3.8327 5 0.0102 -5 5 0 + +CELLS 21 40 +OFFSETS vtktypeint64 +0 2 4 6 8 10 12 14 16 +18 20 22 24 26 28 30 32 34 +36 38 40 +CONNECTIVITY vtktypeint64 +0 1 1 2 2 3 3 4 4 +5 5 6 6 7 7 8 8 9 +9 10 10 11 11 12 12 13 13 +14 14 15 15 16 16 17 17 18 +18 19 19 20 +CELL_TYPES 20 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 + diff --git a/testData/thin_slot/surface/SquareInSquare.tessellator.str.vtk b/testData/thin_slot/surface/SquareInSquare.tessellator.str.vtk new file mode 100644 index 0000000..56ca758 --- /dev/null +++ b/testData/thin_slot/surface/SquareInSquare.tessellator.str.vtk @@ -0,0 +1,410 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 186 float +-10 -10 3 -9 -10 3 -9 -9 3 +-9 -9 2 -10 -9 3 -10 -9 2 +-10 -8 2 -10 -8 3 -9 -7 2 +-9 -6 2 -9 -10 2 -8 -10 2 +-8 -10 3 -6 -9 2 -9 -4 2 +-9 -4 1 -10 -4 1 -10 -4 2 +-4 -10 2 -4 -9 2 -4 -9 1 +-4 -10 1 -4 -8 1 -4 -7 1 +-4 -6 1 -9 -6 1 -7 -7 2 +-7 -6 2 -7 -6 1 -7 -7 1 +-6 -7 2 -6 -7 1 -6 -9 1 +-4 -5 1 -3 -5 1 -2 -6 1 +-2 -5 1 -2 -5 0 -3 -5 0 +-2 -6 0 -1 -7 1 -1 -6 1 +-1 -6 0 -1 -7 0 -7 -1 1 +-7 -1 0 -6 -3 1 -6 -2 1 +-6 -1 1 -6 -1 0 -6 -2 0 +-5 -3 1 -5 -2 1 -5 -2 0 +-5 -3 0 -10 4 0 -10 5 0 +-10 6 0 -10 7 0 10 -5 0 +10 -4 0 0 7 0 0 8 0 +0 8 1 1 6 0 1 7 0 +1 7 1 0 7 1 1 6 1 +-2 9 0 -2 10 0 -2 10 1 +-1 8 0 -1 9 0 -1 9 1 +-2 9 1 -1 8 1 6 1 0 +5 2 0 6 2 0 7 0 0 +7 1 0 7 1 1 6 2 1 +6 1 1 8 0 0 8 0 1 +7 0 1 9 0 1 8 -1 0 +9 -2 0 9 -1 0 9 -1 1 +8 -1 1 10 -3 0 10 -2 0 +10 -2 1 9 -2 1 5 5 1 +5 6 1 5 7 1 6 7 1 +5 8 1 6 9 2 5 9 2 +5 9 1 6 9 1 5 10 2 +7 6 1 7 7 1 7 7 2 +6 7 2 7 6 2 9 6 2 +9 5 1 9 5 2 9 6 1 +9 7 2 10 5 2 8 10 2 +9 9 2 9 10 2 9 10 3 +8 10 3 9 9 3 10 8 2 +10 9 2 10 9 3 10 8 3 +10 10 3 -9 0 1 -9 1 1 +-9 2 1 -9 2 0 -10 2 0 +-10 2 1 -9 1 0 -8 1 1 +-8 1 0 -8 0 1 -8 0 0 +-7 0 0 -7 0 1 1 -9 1 +1 -8 1 1 -8 0 0 -8 0 +0 -8 1 1 -9 0 2 -10 1 +2 -9 1 2 -9 0 2 -10 0 +0 -7 0 0 -7 1 10 -10 0 +10 -9 0 10 -8 0 10 -7 0 +10 -6 0 -10 8 0 -10 9 0 +-10 10 0 4 10 1 4 10 2 +5 10 1 3 5 0 3 5 1 +3 6 1 4 5 1 3 6 0 +10 4 1 10 4 2 10 5 1 +5 4 1 5 2 1 -4 -4 1 +-4 -3 1 -4 -3 0 -4 -4 0 +-3 -4 1 -3 -4 0 4 4 0 +4 4 1 4 5 0 5 4 0 + +CELLS 125 496 +OFFSETS vtktypeint64 +0 4 8 12 16 20 24 28 32 +36 40 44 48 52 56 60 64 68 +72 76 80 84 88 92 96 100 104 +108 112 116 120 124 128 132 136 140 +144 148 152 156 160 164 168 172 176 +180 184 188 192 196 200 204 208 212 +216 220 224 228 232 236 240 244 248 +252 256 260 264 268 272 276 280 284 +288 292 296 300 304 308 312 316 320 +324 328 332 336 340 344 348 352 356 +360 364 368 372 376 380 384 388 392 +396 400 404 408 412 416 420 424 428 +432 436 440 444 448 452 456 460 464 +468 472 476 480 484 488 492 496 +CONNECTIVITY vtktypeint64 +5 6 7 4 10 1 12 11 134 +78 185 55 55 182 184 56 56 166 +170 57 57 64 65 58 58 61 62 +160 160 72 73 161 161 69 70 162 +136 77 79 133 140 80 81 138 45 +89 85 141 50 90 91 49 54 94 +95 53 179 60 94 178 38 59 60 +181 39 159 59 37 43 158 159 42 +146 157 158 153 148 156 157 145 152 +155 156 151 10 3 2 1 25 15 +14 9 136 133 132 131 5 4 2 +3 32 13 19 20 148 143 150 151 +16 15 132 135 25 28 142 130 130 +139 137 131 29 31 48 44 32 20 +177 46 46 51 52 47 21 149 150 +20 20 143 144 22 22 147 154 23 +23 40 41 24 24 35 36 33 33 +34 180 176 75 105 165 71 76 102 +105 74 67 100 102 63 68 99 100 +66 167 98 99 168 183 174 98 169 +175 83 106 105 84 82 109 101 87 +88 116 108 93 92 88 86 97 96 +173 114 140 138 137 139 146 147 144 +145 5 3 14 17 10 18 19 3 +3 13 30 8 8 26 27 9 104 +120 121 107 111 117 120 103 112 113 +117 110 115 118 126 120 29 28 27 +26 45 141 142 44 29 26 30 31 +43 40 154 153 0 1 2 4 124 +127 129 122 32 31 30 13 50 49 +48 47 25 9 27 28 39 35 41 +42 54 53 52 51 38 34 36 37 +21 20 19 18 179 178 177 176 16 +17 14 15 179 176 180 181 38 181 +180 34 54 51 177 178 69 75 71 +70 90 95 96 97 39 37 36 35 +50 47 52 53 72 76 74 73 89 +91 92 93 43 42 41 40 45 44 +48 49 61 67 63 62 80 85 86 +87 146 153 154 147 140 139 142 141 +64 68 66 65 77 81 82 84 148 +145 144 143 136 131 137 138 78 79 +83 175 152 151 150 149 134 135 132 +133 166 167 168 170 182 183 169 184 +182 185 174 183 105 104 107 165 78 +175 174 185 114 173 118 115 166 184 +169 167 77 84 83 79 101 111 103 +106 64 170 168 68 108 116 113 112 +80 87 82 81 108 112 110 109 61 +65 66 67 101 109 110 111 89 93 +86 85 72 62 63 76 90 97 92 +91 114 115 113 116 120 124 122 121 +69 73 74 75 105 106 103 104 120 +126 127 124 125 128 127 126 171 172 +118 173 119 121 122 123 163 165 107 +164 +CELL_TYPES 124 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 + +CELL_DATA 124 +FIELD FieldData 2 +group 1 124 int +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 +groupNames 1 124 string +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare +SquareInSquare + diff --git a/testData/thin_slot/surface/SquareInSquare.vtu b/testData/thin_slot/surface/SquareInSquare.vtu new file mode 100644 index 0000000..2010774 --- /dev/null +++ b/testData/thin_slot/surface/SquareInSquare.vtu @@ -0,0 +1,103 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 37 double +-10 -5.2512040138 1.7444941998 -10 -10 3 -5.2512040138 -10 1.7444941998 +-5 -5 0.75 -10 -0.50240826607 0.82725435495 -0.50240826607 -10 0.82725435495 +-0.55555558205 -5 0.23148147762 -5 -0.55555558205 0.23148147762 5 -5 0 +4.1737427711 -10 0.25458955765 7.0868711472 -10 0.063647389412 2.2222223282 -5 0.057870369405 +-5 5 0 -10 7.0868711472 0.063647389412 -10 4.1737427711 0.25458955765 +-5 2.2222223282 0.057870369405 -4.836022377 10 0.20000000298 -0.55555558205 5 0.14814814925 +10 -4.836022377 0.20000000298 5 -0.55555558205 0.14814814925 0.3279556036 10 0.80000001192 +2.2222223282 5 0.3912037015 10 0.3279556036 0.80000001192 5 2.2222223282 0.3912037015 +10 5.163977623 1.7245966196 5.163977623 10 1.7245966196 5 5 0.75 +10 10 3 -7.5 0.85990697145 0.3306812644 0.85990697145 -7.5 0.3306812644 +8.5434360504 -7.4180111885 0.0094993533567 10 -10 0 -7.4180111885 8.5434360504 0.0094993533567 +-10 10 0 3.6930999756 7.5 0.93964117765 7.5 3.6930999756 0.93964117765 +0 0 0 +CELLS 55 162 +OFFSETS vtktypeint64 +0 3 6 9 12 15 18 21 24 +27 30 33 36 39 42 45 48 51 +54 57 60 63 66 69 72 75 78 +81 84 87 90 93 96 99 102 105 +108 111 114 117 120 123 126 129 132 +135 138 141 144 147 150 153 156 159 +162 +CONNECTIVITY vtktypeint64 +0 1 2 3 4 0 3 2 5 +3 0 2 6 3 5 7 4 3 +8 9 10 8 11 9 12 13 14 +12 14 15 16 12 17 18 19 8 +20 17 21 20 16 17 22 23 19 +22 19 18 24 25 26 27 25 24 +28 14 4 28 7 15 28 4 7 +28 15 14 29 5 9 29 11 6 +29 6 5 29 9 11 30 10 31 +30 31 18 30 18 8 30 8 10 +32 33 13 32 16 33 32 13 12 +32 12 16 34 25 20 34 21 26 +34 20 21 34 26 25 35 22 24 +35 26 23 35 23 22 35 24 26 +6 7 3 19 11 8 17 12 15 +26 21 23 36 15 7 36 6 11 +36 19 23 36 21 17 36 7 6 +36 11 19 36 17 15 36 23 21 + +CELL_TYPES 54 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 + diff --git a/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.grid.vtk b/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.grid.vtk new file mode 100644 index 0000000..8909d7d --- /dev/null +++ b/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.grid.vtk @@ -0,0 +1,318 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 424 float +-20 -20 -10 -20 20 -10 -20 20 13 +-20 -20 13 -19 -20 -10 -19 20 -10 +-19 20 13 -19 -20 13 -18 -20 -10 +-18 20 -10 -18 20 13 -18 -20 13 +-17 -20 -10 -17 20 -10 -17 20 13 +-17 -20 13 -16 -20 -10 -16 20 -10 +-16 20 13 -16 -20 13 -15 -20 -10 +-15 20 -10 -15 20 13 -15 -20 13 +-14 -20 -10 -14 20 -10 -14 20 13 +-14 -20 13 -13 -20 -10 -13 20 -10 +-13 20 13 -13 -20 13 -12 -20 -10 +-12 20 -10 -12 20 13 -12 -20 13 +-11 -20 -10 -11 20 -10 -11 20 13 +-11 -20 13 -10 -20 -10 -10 20 -10 +-10 20 13 -10 -20 13 -9 -20 -10 +-9 20 -10 -9 20 13 -9 -20 13 +-8 -20 -10 -8 20 -10 -8 20 13 +-8 -20 13 -7 -20 -10 -7 20 -10 +-7 20 13 -7 -20 13 -6 -20 -10 +-6 20 -10 -6 20 13 -6 -20 13 +-5 -20 -10 -5 20 -10 -5 20 13 +-5 -20 13 -4 -20 -10 -4 20 -10 +-4 20 13 -4 -20 13 -3 -20 -10 +-3 20 -10 -3 20 13 -3 -20 13 +-2 -20 -10 -2 20 -10 -2 20 13 +-2 -20 13 -1 -20 -10 -1 20 -10 +-1 20 13 -1 -20 13 0 -20 -10 +0 20 -10 0 20 13 0 -20 13 +1 -20 -10 1 20 -10 1 20 13 +1 -20 13 2 -20 -10 2 20 -10 +2 20 13 2 -20 13 3 -20 -10 +3 20 -10 3 20 13 3 -20 13 +4 -20 -10 4 20 -10 4 20 13 +4 -20 13 5 -20 -10 5 20 -10 +5 20 13 5 -20 13 6 -20 -10 +6 20 -10 6 20 13 6 -20 13 +7 -20 -10 7 20 -10 7 20 13 +7 -20 13 8 -20 -10 8 20 -10 +8 20 13 8 -20 13 9 -20 -10 +9 20 -10 9 20 13 9 -20 13 +10 -20 -10 10 20 -10 10 20 13 +10 -20 13 11 -20 -10 11 20 -10 +11 20 13 11 -20 13 12 -20 -10 +12 20 -10 12 20 13 12 -20 13 +13 -20 -10 13 20 -10 13 20 13 +13 -20 13 14 -20 -10 14 20 -10 +14 20 13 14 -20 13 15 -20 -10 +15 20 -10 15 20 13 15 -20 13 +16 -20 -10 16 20 -10 16 20 13 +16 -20 13 17 -20 -10 17 20 -10 +17 20 13 17 -20 13 18 -20 -10 +18 20 -10 18 20 13 18 -20 13 +19 -20 -10 19 20 -10 19 20 13 +19 -20 13 20 -20 -10 20 20 -10 +20 20 13 20 -20 13 -20 -20 -10 +-20 -20 13 20 -20 13 20 -20 -10 +-20 -19 -10 -20 -19 13 20 -19 13 +20 -19 -10 -20 -18 -10 -20 -18 13 +20 -18 13 20 -18 -10 -20 -17 -10 +-20 -17 13 20 -17 13 20 -17 -10 +-20 -16 -10 -20 -16 13 20 -16 13 +20 -16 -10 -20 -15 -10 -20 -15 13 +20 -15 13 20 -15 -10 -20 -14 -10 +-20 -14 13 20 -14 13 20 -14 -10 +-20 -13 -10 -20 -13 13 20 -13 13 +20 -13 -10 -20 -12 -10 -20 -12 13 +20 -12 13 20 -12 -10 -20 -11 -10 +-20 -11 13 20 -11 13 20 -11 -10 +-20 -10 -10 -20 -10 13 20 -10 13 +20 -10 -10 -20 -9 -10 -20 -9 13 +20 -9 13 20 -9 -10 -20 -8 -10 +-20 -8 13 20 -8 13 20 -8 -10 +-20 -7 -10 -20 -7 13 20 -7 13 +20 -7 -10 -20 -6 -10 -20 -6 13 +20 -6 13 20 -6 -10 -20 -5 -10 +-20 -5 13 20 -5 13 20 -5 -10 +-20 -4 -10 -20 -4 13 20 -4 13 +20 -4 -10 -20 -3 -10 -20 -3 13 +20 -3 13 20 -3 -10 -20 -2 -10 +-20 -2 13 20 -2 13 20 -2 -10 +-20 -1 -10 -20 -1 13 20 -1 13 +20 -1 -10 -20 0 -10 -20 0 13 +20 0 13 20 0 -10 -20 1 -10 +-20 1 13 20 1 13 20 1 -10 +-20 2 -10 -20 2 13 20 2 13 +20 2 -10 -20 3 -10 -20 3 13 +20 3 13 20 3 -10 -20 4 -10 +-20 4 13 20 4 13 20 4 -10 +-20 5 -10 -20 5 13 20 5 13 +20 5 -10 -20 6 -10 -20 6 13 +20 6 13 20 6 -10 -20 7 -10 +-20 7 13 20 7 13 20 7 -10 +-20 8 -10 -20 8 13 20 8 13 +20 8 -10 -20 9 -10 -20 9 13 +20 9 13 20 9 -10 -20 10 -10 +-20 10 13 20 10 13 20 10 -10 +-20 11 -10 -20 11 13 20 11 13 +20 11 -10 -20 12 -10 -20 12 13 +20 12 13 20 12 -10 -20 13 -10 +-20 13 13 20 13 13 20 13 -10 +-20 14 -10 -20 14 13 20 14 13 +20 14 -10 -20 15 -10 -20 15 13 +20 15 13 20 15 -10 -20 16 -10 +-20 16 13 20 16 13 20 16 -10 +-20 17 -10 -20 17 13 20 17 13 +20 17 -10 -20 18 -10 -20 18 13 +20 18 13 20 18 -10 -20 19 -10 +-20 19 13 20 19 13 20 19 -10 +-20 20 -10 -20 20 13 20 20 13 +20 20 -10 -20 -20 -10 20 -20 -10 +20 20 -10 -20 20 -10 -20 -20 -9 +20 -20 -9 20 20 -9 -20 20 -9 +-20 -20 -8 20 -20 -8 20 20 -8 +-20 20 -8 -20 -20 -7 20 -20 -7 +20 20 -7 -20 20 -7 -20 -20 -6 +20 -20 -6 20 20 -6 -20 20 -6 +-20 -20 -5 20 -20 -5 20 20 -5 +-20 20 -5 -20 -20 -4 20 -20 -4 +20 20 -4 -20 20 -4 -20 -20 -3 +20 -20 -3 20 20 -3 -20 20 -3 +-20 -20 -2 20 -20 -2 20 20 -2 +-20 20 -2 -20 -20 -1 20 -20 -1 +20 20 -1 -20 20 -1 -20 -20 0 +20 -20 0 20 20 0 -20 20 0 +-20 -20 1 20 -20 1 20 20 1 +-20 20 1 -20 -20 2 20 -20 2 +20 20 2 -20 20 2 -20 -20 3 +20 -20 3 20 20 3 -20 20 3 +-20 -20 4 20 -20 4 20 20 4 +-20 20 4 -20 -20 5 20 -20 5 +20 20 5 -20 20 5 -20 -20 6 +20 -20 6 20 20 6 -20 20 6 +-20 -20 7 20 -20 7 20 20 7 +-20 20 7 -20 -20 8 20 -20 8 +20 20 8 -20 20 8 -20 -20 9 +20 -20 9 20 20 9 -20 20 9 +-20 -20 10 20 -20 10 20 20 10 +-20 20 10 -20 -20 11 20 -20 11 +20 20 11 -20 20 11 -20 -20 12 +20 -20 12 20 20 12 -20 20 12 +-20 -20 13 20 -20 13 20 20 13 +-20 20 13 +CELLS 107 424 +OFFSETS vtktypeint64 +0 4 8 12 16 20 24 28 32 +36 40 44 48 52 56 60 64 68 +72 76 80 84 88 92 96 100 104 +108 112 116 120 124 128 132 136 140 +144 148 152 156 160 164 168 172 176 +180 184 188 192 196 200 204 208 212 +216 220 224 228 232 236 240 244 248 +252 256 260 264 268 272 276 280 284 +288 292 296 300 304 308 312 316 320 +324 328 332 336 340 344 348 352 356 +360 364 368 372 376 380 384 388 392 +396 400 404 408 412 416 420 424 +CONNECTIVITY vtktypeint64 +0 1 2 3 4 5 6 7 8 +9 10 11 12 13 14 15 16 17 +18 19 20 21 22 23 24 25 26 +27 28 29 30 31 32 33 34 35 +36 37 38 39 40 41 42 43 44 +45 46 47 48 49 50 51 52 53 +54 55 56 57 58 59 60 61 62 +63 64 65 66 67 68 69 70 71 +72 73 74 75 76 77 78 79 80 +81 82 83 84 85 86 87 88 89 +90 91 92 93 94 95 96 97 98 +99 100 101 102 103 104 105 106 107 +108 109 110 111 112 113 114 115 116 +117 118 119 120 121 122 123 124 125 +126 127 128 129 130 131 132 133 134 +135 136 137 138 139 140 141 142 143 +144 145 146 147 148 149 150 151 152 +153 154 155 156 157 158 159 160 161 +162 163 164 165 166 167 168 169 170 +171 172 173 174 175 176 177 178 179 +180 181 182 183 184 185 186 187 188 +189 190 191 192 193 194 195 196 197 +198 199 200 201 202 203 204 205 206 +207 208 209 210 211 212 213 214 215 +216 217 218 219 220 221 222 223 224 +225 226 227 228 229 230 231 232 233 +234 235 236 237 238 239 240 241 242 +243 244 245 246 247 248 249 250 251 +252 253 254 255 256 257 258 259 260 +261 262 263 264 265 266 267 268 269 +270 271 272 273 274 275 276 277 278 +279 280 281 282 283 284 285 286 287 +288 289 290 291 292 293 294 295 296 +297 298 299 300 301 302 303 304 305 +306 307 308 309 310 311 312 313 314 +315 316 317 318 319 320 321 322 323 +324 325 326 327 328 329 330 331 332 +333 334 335 336 337 338 339 340 341 +342 343 344 345 346 347 348 349 350 +351 352 353 354 355 356 357 358 359 +360 361 362 363 364 365 366 367 368 +369 370 371 372 373 374 375 376 377 +378 379 380 381 382 383 384 385 386 +387 388 389 390 391 392 393 394 395 +396 397 398 399 400 401 402 403 404 +405 406 407 408 409 410 411 412 413 +414 415 416 417 418 419 420 421 422 +423 +CELL_TYPES 106 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 +9 + diff --git a/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.json b/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.json new file mode 100644 index 0000000..a15b31a --- /dev/null +++ b/testData/thin_slot/surface/squareInSquare.embeddedSurface.tessellator.json @@ -0,0 +1,25 @@ +{ + "grid": { + "numberOfCells": [40, 40, 23], + "boundingBox": [[-20.0, -20.0, -10.0], [20.0, 20.0, 13.0]] + }, + "objects": [ + { + "filename": "SquareInSquare.vtu", + "group": "SquareInSquare" + }, + { + "filename": "Discretize_Wire.vtu", + "group": "Discretize_Wire", + "mesher": { + "type": "staircase", + "options": { + "embedded": "surface" + } + } + } + ], + "output": { + "singleFile": false + } +} diff --git a/tmp_cases/Discretize_Wire.vtu b/tmp_cases/Discretize_Wire.vtu new file mode 100644 index 0000000..05677d3 --- /dev/null +++ b/tmp_cases/Discretize_Wire.vtu @@ -0,0 +1,46 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 21 double +-5 5 0 -5 2.7981 0.0364 -5 0.5955 0.1455 +-5 -1.6088 0.3276 -5 -3.8161 0.5829 -5 -5 0.75 +-2.7858 -5 0.4546 -0.5764 -5 0.2332 1.6294 -5 0.0852 +3.8327 -5 0.0102 5 -5 0 5 -2.7981 0.0364 +5 -0.5955 0.1455 5 1.6088 0.3276 5 3.8161 0.5829 +5 5 0.75 2.7858 5 0.4546 0.5764 5 0.2332 +-1.6294 5 0.0852 -3.8327 5 0.0102 -5 5 0 + +CELLS 21 40 +OFFSETS vtktypeint64 +0 2 4 6 8 10 12 14 16 +18 20 22 24 26 28 30 32 34 +36 38 40 +CONNECTIVITY vtktypeint64 +0 1 1 2 2 3 3 4 4 +5 5 6 6 7 7 8 8 9 +9 10 10 11 11 12 12 13 13 +14 14 15 15 16 16 17 17 18 +18 19 19 20 +CELL_TYPES 20 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 + diff --git a/tmp_cases/SquareInSquare.vtu b/tmp_cases/SquareInSquare.vtu new file mode 100644 index 0000000..2010774 --- /dev/null +++ b/tmp_cases/SquareInSquare.vtu @@ -0,0 +1,103 @@ +# vtk DataFile Version 5.1 +vtk output +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 37 double +-10 -5.2512040138 1.7444941998 -10 -10 3 -5.2512040138 -10 1.7444941998 +-5 -5 0.75 -10 -0.50240826607 0.82725435495 -0.50240826607 -10 0.82725435495 +-0.55555558205 -5 0.23148147762 -5 -0.55555558205 0.23148147762 5 -5 0 +4.1737427711 -10 0.25458955765 7.0868711472 -10 0.063647389412 2.2222223282 -5 0.057870369405 +-5 5 0 -10 7.0868711472 0.063647389412 -10 4.1737427711 0.25458955765 +-5 2.2222223282 0.057870369405 -4.836022377 10 0.20000000298 -0.55555558205 5 0.14814814925 +10 -4.836022377 0.20000000298 5 -0.55555558205 0.14814814925 0.3279556036 10 0.80000001192 +2.2222223282 5 0.3912037015 10 0.3279556036 0.80000001192 5 2.2222223282 0.3912037015 +10 5.163977623 1.7245966196 5.163977623 10 1.7245966196 5 5 0.75 +10 10 3 -7.5 0.85990697145 0.3306812644 0.85990697145 -7.5 0.3306812644 +8.5434360504 -7.4180111885 0.0094993533567 10 -10 0 -7.4180111885 8.5434360504 0.0094993533567 +-10 10 0 3.6930999756 7.5 0.93964117765 7.5 3.6930999756 0.93964117765 +0 0 0 +CELLS 55 162 +OFFSETS vtktypeint64 +0 3 6 9 12 15 18 21 24 +27 30 33 36 39 42 45 48 51 +54 57 60 63 66 69 72 75 78 +81 84 87 90 93 96 99 102 105 +108 111 114 117 120 123 126 129 132 +135 138 141 144 147 150 153 156 159 +162 +CONNECTIVITY vtktypeint64 +0 1 2 3 4 0 3 2 5 +3 0 2 6 3 5 7 4 3 +8 9 10 8 11 9 12 13 14 +12 14 15 16 12 17 18 19 8 +20 17 21 20 16 17 22 23 19 +22 19 18 24 25 26 27 25 24 +28 14 4 28 7 15 28 4 7 +28 15 14 29 5 9 29 11 6 +29 6 5 29 9 11 30 10 31 +30 31 18 30 18 8 30 8 10 +32 33 13 32 16 33 32 13 12 +32 12 16 34 25 20 34 21 26 +34 20 21 34 26 25 35 22 24 +35 26 23 35 23 22 35 24 26 +6 7 3 19 11 8 17 12 15 +26 21 23 36 15 7 36 6 11 +36 19 23 36 21 17 36 7 6 +36 11 19 36 17 15 36 23 21 + +CELL_TYPES 54 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 + diff --git a/tmp_cases/squareInSquare.tessellator.json b/tmp_cases/squareInSquare.tessellator.json new file mode 100644 index 0000000..a218727 --- /dev/null +++ b/tmp_cases/squareInSquare.tessellator.json @@ -0,0 +1,44 @@ +{ + "_version": "0.1", + "_format": "Tessellator Data File in JSON format", + "grid": { + "numberOfCells": [ + 40, + 40, + 23 + ], + "boundingBox": [ + [ + -20.0, + -20.0, + -10.0 + ], + [ + 20.0, + 20.0, + 13.0 + ] + ] + }, + "mesher": { + "type": "staircase", + "options": { + "compress": true + } + }, + "objects": [ + { + "filename": "SquareInSquare.vtu", + "group": "SquareInSquare", + "ghost": false + }, + { + "filename": "Discretize_Wire.vtu", + "group": "Discretize_Wire", + "ghost": false + } + ], + "output": { + "singleFile": false + } +} \ No newline at end of file From 038b25fabb16b7f52703cdacf6946572ff02c528 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Tue, 27 Oct 2026 15:24:30 +0100 Subject: [PATCH 5/6] Minor --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0589af2..579c0d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vscode/settings.json __pycache__/ *.py[cod] + +tmp_cases/ \ No newline at end of file From 2f1625e1cc831687fec60528d9f9c8e271af6bf5 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Tue, 27 Oct 2026 15:44:19 +0100 Subject: [PATCH 6/6] Updates fdtd submodule --- fdtd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdtd b/fdtd index 01d853b..5b2f31d 160000 --- a/fdtd +++ b/fdtd @@ -1 +1 @@ -Subproject commit 01d853b1d16c784e36fc45a16c3c6ad2065b628f +Subproject commit 5b2f31df7696d29704233c3b18a72fc93fc04735