Skip to content

Commit a7721f7

Browse files
authored
Merge pull request #13 from festim-dev/dependency_fixes
Fix dependencies
2 parents 3c92744 + 4e44389 commit a7721f7

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/ci_docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
- name: Run tests
2121
run: |
2222
python3 -m pytest test/ --cov openmc2dolfinx --cov-report xml --cov-report term
23+
24+
- name: Install curl for codecov
25+
run: |
26+
apt-get update && apt-get install -y curl
2327
2428
- name: Upload to codecov
2529
uses: codecov/codecov-action@v5

src/openmc2dolfinx/core.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class OpenMC2dolfinx(pyvista.VTKDataSetReader):
2121
path: the path to the OpenMC .vtk file
2222
2323
Attributes:
24-
data: the mesh and results from the OpenMC .vtk file
24+
_data: the mesh and results from the OpenMC .vtk file
2525
connectivity: The OpenMC mesh cell connectivity
2626
dolfinx_mesh: the dolfinx mesh
2727
"""
2828

29-
data: pyvista.core.pointset.UnstructuredGrid | pyvista.core.pointset.StructuredGrid
29+
_data: pyvista.core.pointset.UnstructuredGrid | pyvista.core.pointset.StructuredGrid
3030
connectivity: np.ndarray
3131
dolfinx_mesh: dolfinx.mesh.Mesh = None
3232

@@ -41,7 +41,7 @@ def create_dolfinx_mesh(self):
4141
if not hasattr(self, "cell_type"):
4242
raise AttributeError("cell_type must be defined in the child class")
4343

44-
self.data = self.read()
44+
self._data = self.read()
4545
if not hasattr(self, "cell_connectivity"):
4646
raise AttributeError("cell_connectivity must be defined in the child class")
4747

@@ -55,7 +55,10 @@ def create_dolfinx_mesh(self):
5555
# Create dolfinx Mesh
5656
mesh_ufl = ufl.Mesh(mesh_element)
5757
self.dolfinx_mesh = create_mesh(
58-
MPI.COMM_WORLD, self.cell_connectivity, self.data.points, mesh_ufl
58+
comm=MPI.COMM_WORLD,
59+
cells=self.cell_connectivity,
60+
x=self._data.points,
61+
e=mesh_ufl,
5962
)
6063

6164
def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function:
@@ -74,7 +77,7 @@ def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function:
7477
function_space = dolfinx.fem.functionspace(self.dolfinx_mesh, ("DG", 0))
7578
u = dolfinx.fem.Function(function_space)
7679

77-
u.x.array[:] = self.data.cell_data[f"{data}"][
80+
u.x.array[:] = self._data.cell_data[f"{data}"][
7881
self.dolfinx_mesh.topology.original_cell_index
7982
]
8083

@@ -101,7 +104,7 @@ class UnstructuredMeshReader(OpenMC2dolfinx):
101104

102105
@property
103106
def cell_connectivity(self):
104-
return self.data.cells_dict[10]
107+
return self._data.cells_dict[10]
105108

106109

107110
class StructuredGridReader(OpenMC2dolfinx):
@@ -124,8 +127,8 @@ class StructuredGridReader(OpenMC2dolfinx):
124127
_cell_connectivity = None
125128

126129
def get_connectivity(self):
127-
num_cells = self.data.GetNumberOfCells()
128-
assert self.data.GetCellType(0) == 12, "Only hexahedron cells are supported"
130+
num_cells = self._data.GetNumberOfCells()
131+
assert self._data.GetCellType(0) == 12, "Only hexahedron cells are supported"
129132

130133
# Extract connectivity information
131134
ordering = [0, 1, 3, 2, 4, 5, 7, 6]
@@ -135,7 +138,7 @@ def get_connectivity(self):
135138
# TODO numpify this
136139
# Extract all cell connectivity data at once
137140
for i in range(num_cells):
138-
cell = self.data.GetCell(i) # Get the i-th cell
141+
cell = self._data.GetCell(i) # Get the i-th cell
139142
point_ids = [cell.GetPointId(j) for j in ordering] # Extract connectivity
140143
self._cell_connectivity.append(point_ids)
141144

0 commit comments

Comments
 (0)