|
1 | 1 | from collections.abc import Mapping, Sequence |
2 | | -from ctypes import (c_int, c_int32, c_char_p, c_double, POINTER, c_void_p, |
| 2 | +from ctypes import (c_int, c_int32, c_int64, c_char_p, c_double, POINTER, c_void_p, |
3 | 3 | create_string_buffer, c_size_t) |
4 | 4 | from math import sqrt |
5 | 5 | import sys |
|
18 | 18 |
|
19 | 19 | __all__ = [ |
20 | 20 | 'Mesh', 'RegularMesh', 'RectilinearMesh', 'CylindricalMesh', |
21 | | - 'SphericalMesh', 'UnstructuredMesh', 'meshes', 'MeshMaterialVolumes' |
| 21 | + 'SphericalMesh', 'UnstructuredMesh', 'meshes', 'MeshMaterialVolumes', 'export_unstructured_mesh' |
22 | 22 | ] |
23 | 23 |
|
24 | 24 |
|
|
108 | 108 | _dll.openmc_spherical_mesh_set_grid.restype = c_int |
109 | 109 | _dll.openmc_spherical_mesh_set_grid.errcheck = _error_handler |
110 | 110 |
|
| 111 | +_dll.openmc_unstructured_mesh_export_hdf5.argtypes = [c_int32, c_int64] |
| 112 | +_dll.openmc_unstructured_mesh_export_hdf5.restype = c_int |
| 113 | +_dll.openmc_unstructured_mesh_export_hdf5.errcheck = _error_handler |
| 114 | + |
111 | 115 |
|
112 | 116 | class Mesh(_FortranObjectWithID): |
113 | 117 | """Base class to represent mesh objects |
@@ -740,6 +744,12 @@ class UnstructuredMesh(Mesh): |
740 | 744 | } |
741 | 745 |
|
742 | 746 |
|
| 747 | +def export_unstructured_mesh(mesh, group): |
| 748 | + index = c_int32() |
| 749 | + _dll.openmc_get_mesh_index(mesh.id, index) |
| 750 | + _dll.openmc_unstructured_mesh_export_hdf5(index.value, int(group.id.id)) |
| 751 | + |
| 752 | + |
743 | 753 | def _get_mesh(index): |
744 | 754 | mesh_type = create_string_buffer(20) |
745 | 755 | _dll.openmc_mesh_get_type(index, mesh_type) |
|
0 commit comments