@@ -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+ pyvista . set_new_attribute ( self , "data" , self .read () )
4545 if not hasattr (self , "cell_connectivity" ):
4646 raise AttributeError ("cell_connectivity must be defined in the child class" )
4747
@@ -57,7 +57,7 @@ def create_dolfinx_mesh(self):
5757 self .dolfinx_mesh = create_mesh (
5858 comm = MPI .COMM_WORLD ,
5959 cells = self .cell_connectivity ,
60- x = self ._data .points ,
60+ x = self .data .points ,
6161 e = mesh_ufl ,
6262 )
6363
@@ -77,7 +77,7 @@ def create_dolfinx_function(self, data: str = "mean") -> dolfinx.fem.Function:
7777 function_space = dolfinx .fem .functionspace (self .dolfinx_mesh , ("DG" , 0 ))
7878 u = dolfinx .fem .Function (function_space )
7979
80- u .x .array [:] = self ._data .cell_data [f"{ data } " ][
80+ u .x .array [:] = self .data .cell_data [f"{ data } " ][
8181 self .dolfinx_mesh .topology .original_cell_index
8282 ]
8383
@@ -104,7 +104,7 @@ class UnstructuredMeshReader(OpenMC2dolfinx):
104104
105105 @property
106106 def cell_connectivity (self ):
107- return self ._data .cells_dict [10 ]
107+ return self .data .cells_dict [10 ]
108108
109109
110110class StructuredGridReader (OpenMC2dolfinx ):
@@ -127,8 +127,8 @@ class StructuredGridReader(OpenMC2dolfinx):
127127 _cell_connectivity = None
128128
129129 def get_connectivity (self ):
130- num_cells = self ._data .GetNumberOfCells ()
131- 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"
132132
133133 # Extract connectivity information
134134 ordering = [0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 ]
@@ -138,7 +138,7 @@ def get_connectivity(self):
138138 # TODO numpify this
139139 # Extract all cell connectivity data at once
140140 for i in range (num_cells ):
141- cell = self ._data .GetCell (i ) # Get the i-th cell
141+ cell = self .data .GetCell (i ) # Get the i-th cell
142142 point_ids = [cell .GetPointId (j ) for j in ordering ] # Extract connectivity
143143 self ._cell_connectivity .append (point_ids )
144144
0 commit comments