From f9096420c577bde4e65ce3e1b80830b59d18c36b Mon Sep 17 00:00:00 2001 From: jhdark Date: Wed, 8 Oct 2025 13:48:39 -0400 Subject: [PATCH 1/3] make data attribute hidden --- src/openmc2dolfinx/core.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openmc2dolfinx/core.py b/src/openmc2dolfinx/core.py index 74aa24f..7d2bae8 100644 --- a/src/openmc2dolfinx/core.py +++ b/src/openmc2dolfinx/core.py @@ -21,12 +21,12 @@ class OpenMC2dolfinx(pyvista.VTKDataSetReader): path: the path to the OpenMC .vtk file Attributes: - data: the mesh and results from the OpenMC .vtk file + _data: the mesh and results from the OpenMC .vtk file connectivity: The OpenMC mesh cell connectivity dolfinx_mesh: the dolfinx mesh """ - data: pyvista.core.pointset.UnstructuredGrid | pyvista.core.pointset.StructuredGrid + _data: pyvista.core.pointset.UnstructuredGrid | pyvista.core.pointset.StructuredGrid connectivity: np.ndarray dolfinx_mesh: dolfinx.mesh.Mesh = None @@ -41,7 +41,7 @@ def create_dolfinx_mesh(self): if not hasattr(self, "cell_type"): raise AttributeError("cell_type must be defined in the child class") - self.data = self.read() + self._data = self.read() if not hasattr(self, "cell_connectivity"): raise AttributeError("cell_connectivity must be defined in the child class") @@ -55,7 +55,7 @@ def create_dolfinx_mesh(self): # Create dolfinx Mesh mesh_ufl = ufl.Mesh(mesh_element) self.dolfinx_mesh = create_mesh( - MPI.COMM_WORLD, self.cell_connectivity, self.data.points, mesh_ufl + MPI.COMM_WORLD, self.cell_connectivity, self._data.points, mesh_ufl ) def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function: @@ -74,7 +74,7 @@ def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function: function_space = dolfinx.fem.functionspace(self.dolfinx_mesh, ("DG", 0)) u = dolfinx.fem.Function(function_space) - u.x.array[:] = self.data.cell_data[f"{data}"][ + u.x.array[:] = self._data.cell_data[f"{data}"][ self.dolfinx_mesh.topology.original_cell_index ] @@ -101,7 +101,7 @@ class UnstructuredMeshReader(OpenMC2dolfinx): @property def cell_connectivity(self): - return self.data.cells_dict[10] + return self._data.cells_dict[10] class StructuredGridReader(OpenMC2dolfinx): @@ -124,8 +124,8 @@ class StructuredGridReader(OpenMC2dolfinx): _cell_connectivity = None def get_connectivity(self): - num_cells = self.data.GetNumberOfCells() - assert self.data.GetCellType(0) == 12, "Only hexahedron cells are supported" + num_cells = self._data.GetNumberOfCells() + assert self._data.GetCellType(0) == 12, "Only hexahedron cells are supported" # Extract connectivity information ordering = [0, 1, 3, 2, 4, 5, 7, 6] @@ -135,7 +135,7 @@ def get_connectivity(self): # TODO numpify this # Extract all cell connectivity data at once for i in range(num_cells): - cell = self.data.GetCell(i) # Get the i-th cell + cell = self._data.GetCell(i) # Get the i-th cell point_ids = [cell.GetPointId(j) for j in ordering] # Extract connectivity self._cell_connectivity.append(point_ids) From 29c513b6614f446413454a21ea9d114d4df5c0db Mon Sep 17 00:00:00 2001 From: jhdark Date: Wed, 8 Oct 2025 13:50:42 -0400 Subject: [PATCH 2/3] add args to create_mesh --- src/openmc2dolfinx/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openmc2dolfinx/core.py b/src/openmc2dolfinx/core.py index 7d2bae8..6faa5bb 100644 --- a/src/openmc2dolfinx/core.py +++ b/src/openmc2dolfinx/core.py @@ -55,7 +55,10 @@ def create_dolfinx_mesh(self): # Create dolfinx Mesh mesh_ufl = ufl.Mesh(mesh_element) self.dolfinx_mesh = create_mesh( - MPI.COMM_WORLD, self.cell_connectivity, self._data.points, mesh_ufl + comm=MPI.COMM_WORLD, + cells=self.cell_connectivity, + x=self._data.points, + e=mesh_ufl, ) def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function: From 4e443898c2a72eb2bd2b3df48acf8f24ad9268f9 Mon Sep 17 00:00:00 2001 From: jhdark Date: Wed, 8 Oct 2025 13:51:21 -0400 Subject: [PATCH 3/3] install curl for codecov --- .github/workflows/ci_docker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_docker.yml b/.github/workflows/ci_docker.yml index 70513c8..ae90c28 100644 --- a/.github/workflows/ci_docker.yml +++ b/.github/workflows/ci_docker.yml @@ -20,6 +20,10 @@ jobs: - name: Run tests run: | python3 -m pytest test/ --cov openmc2dolfinx --cov-report xml --cov-report term + + - name: Install curl for codecov + run: | + apt-get update && apt-get install -y curl - name: Upload to codecov uses: codecov/codecov-action@v5