cubitpy 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cubitpy-0.2.1/src/cubitpy.egg-info → cubitpy-0.2.2}/PKG-INFO +1 -1
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_to_fourc_input.py +1 -35
- cubitpy-0.2.2/src/cubitpy/exodus_utility.py +97 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/version.py +3 -3
- {cubitpy-0.2.1 → cubitpy-0.2.2/src/cubitpy.egg-info}/PKG-INFO +1 -1
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy.egg-info/SOURCES.txt +7 -1
- cubitpy-0.2.2/tests/input-files-ref/test_create_block_unaltered_element_dict_exo.exo +0 -0
- cubitpy-0.2.2/tests/input-files-ref/test_element_types_tet_single_element_with_exo.exo +0 -0
- cubitpy-0.2.2/tests/input-files-ref/test_node_sets_without_boundary_condition_with_exo.exo +0 -0
- cubitpy-0.2.2/tests/input-files-ref/test_user_defined_node_set_and_block_ids_with_exo.exo +0 -0
- cubitpy-0.2.2/tests/input-files-ref/test_yaml_with_exo_export_fsi.exo +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/test_cubitpy.py +68 -10
- {cubitpy-0.2.1 → cubitpy-0.2.2}/.coveragerc +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/.github/workflows/code_checks.yml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/.github/workflows/cubitpy_test_suite_with_secrets.yml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/.gitignore +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/.pre-commit-config.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/CONTRIBUTORS +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/LICENSE +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/README.md +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/pyproject.toml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/setup.cfg +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/__init__.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/conf.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_group.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_utility.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_wrapper/__init__.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_wrapper/cubit_wrapper_client.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_wrapper/cubit_wrapper_file_transfer.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_wrapper/cubit_wrapper_host.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubit_wrapper/cubit_wrapper_utility.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubitpy.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/cubitpy_types.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/geometry_creation_functions.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy/mesh_creation_functions.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy.egg-info/dependency_links.txt +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy.egg-info/requires.txt +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/cubitpy.egg-info/top_level.txt +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/tutorial/__init__.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/src/tutorial/tutorial.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/coverage.config +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/external-geometry/fluent_aneurysm.msh +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_block_function.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_contact_condition_beam_to_surface.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_contact_condition_curve_to_curve.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_contact_condition_surface_to_surface.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_block.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_block_unaltered_element_dict.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_block_unaltered_element_dict_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_brick_by_corner_points.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_wedge6.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_cubit_tutorial_coreform.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_cubit_tutorial_cubit15.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_dump_numpy_array.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_hex.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_quad_yplane.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_quad_zplane.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_coreform.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_cubit15.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_single_element_with_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_single_element_without_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_extrude_mesh_function.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_extrude_mesh_function_average_normals_block.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_extrude_mesh_function_average_normals_for_cylinder_and_sphere.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_fluid_functionality_coreform.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_fluid_functionality_cubit15.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_fsi_functionality.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_group_of_surfaces.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_groups.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_groups_multiple_sets.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_mesh_import.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_node_set_geometry_type.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_node_sets_without_boundary_condition_with_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_node_sets_without_boundary_condition_without_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_point_coupling.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_reset_block_1.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_reset_block_2.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_scatra_functionality.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_serialize_nested_lists.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_thermo_functionality.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_user_defined_node_set_and_block_ids_with_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_user_defined_node_set_and_block_ids_without_exo.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_yaml_with_exo_export_fsi.4C.yaml +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/run_delete_test.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/test_configurations.sh +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/test_cubitpy_performance.py +0 -0
- {cubitpy-0.2.1 → cubitpy-0.2.2}/tests/test_tutorial.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cubitpy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: CubitPy: Utility functions and 4C related functionality for the Cubit and Coreform python interface
|
|
5
5
|
Author-email: Ivo Steinbrecher <ivo.steinbrecher@unibw.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,46 +33,12 @@ import numpy as np
|
|
|
33
33
|
from fourcipp.fourc_input import FourCInput
|
|
34
34
|
|
|
35
35
|
from cubitpy.conf import GeometryType, cupy
|
|
36
|
+
from cubitpy.exodus_utility import get_exo_info
|
|
36
37
|
|
|
37
38
|
if TYPE_CHECKING:
|
|
38
39
|
from cubitpy.cubitpy import CubitPy
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
def get_exo_info(exo, entry_type) -> tuple[dict, dict]:
|
|
42
|
-
"""Build mappings between Exodus IDs and Cubit IDs for blocks or
|
|
43
|
-
nodesets."""
|
|
44
|
-
|
|
45
|
-
if entry_type == "block":
|
|
46
|
-
exo_identifier = "eb"
|
|
47
|
-
elif entry_type == "nodeset":
|
|
48
|
-
exo_identifier = "ns"
|
|
49
|
-
else:
|
|
50
|
-
raise ValueError(f"Invalid entry type: {entry_type}")
|
|
51
|
-
|
|
52
|
-
if exo_identifier + "_names" not in exo.variables.keys():
|
|
53
|
-
return {}, {}
|
|
54
|
-
|
|
55
|
-
# List of explicitly given names
|
|
56
|
-
names = []
|
|
57
|
-
for line in exo.variables[exo_identifier + "_names"]:
|
|
58
|
-
name: str | None = str(netCDF4.chartostring(line))
|
|
59
|
-
if name == "":
|
|
60
|
-
name = None
|
|
61
|
-
names.append(name)
|
|
62
|
-
|
|
63
|
-
# Get information of all entries of the given type
|
|
64
|
-
cubit_id_to_info = {}
|
|
65
|
-
exo_id_to_info = {}
|
|
66
|
-
for exo_id, cubit_id in enumerate(
|
|
67
|
-
exo.variables[exo_identifier + "_prop1"][:].tolist()
|
|
68
|
-
):
|
|
69
|
-
info = {"cubit_id": cubit_id, "exo_id": exo_id, "name": names[exo_id]}
|
|
70
|
-
cubit_id_to_info[cubit_id] = info.copy()
|
|
71
|
-
exo_id_to_info[exo_id] = info.copy()
|
|
72
|
-
|
|
73
|
-
return cubit_id_to_info, exo_id_to_info
|
|
74
|
-
|
|
75
|
-
|
|
76
42
|
def add_node_sets_external_geometry(cubit: CubitPy, input_file: FourCInput) -> None:
|
|
77
43
|
"""Add a reference to the node sets contained in the cubit session/exo file
|
|
78
44
|
to the yaml file."""
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2018-2026 CubitPy Authors
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
|
13
|
+
# all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
# THE SOFTWARE.
|
|
22
|
+
"""Utility functions interacting with the exodus file format."""
|
|
23
|
+
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
import netCDF4
|
|
27
|
+
import numpy as np
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_exo_info(exo, entry_type) -> tuple[dict, dict]:
|
|
31
|
+
"""Build mappings between Exodus IDs and Cubit IDs for blocks or
|
|
32
|
+
nodesets."""
|
|
33
|
+
|
|
34
|
+
if entry_type == "block":
|
|
35
|
+
exo_identifier = "eb"
|
|
36
|
+
elif entry_type == "nodeset":
|
|
37
|
+
exo_identifier = "ns"
|
|
38
|
+
else:
|
|
39
|
+
raise ValueError(f"Invalid entry type: {entry_type}")
|
|
40
|
+
|
|
41
|
+
if exo_identifier + "_names" not in exo.variables.keys():
|
|
42
|
+
return {}, {}
|
|
43
|
+
|
|
44
|
+
# List of explicitly given names
|
|
45
|
+
names = []
|
|
46
|
+
for line in exo.variables[exo_identifier + "_names"]:
|
|
47
|
+
name: str | None = str(netCDF4.chartostring(line))
|
|
48
|
+
if name == "":
|
|
49
|
+
name = None
|
|
50
|
+
names.append(name)
|
|
51
|
+
|
|
52
|
+
# Get information of all entries of the given type
|
|
53
|
+
cubit_id_to_info = {}
|
|
54
|
+
exo_id_to_info = {}
|
|
55
|
+
for exo_id, cubit_id in enumerate(
|
|
56
|
+
exo.variables[exo_identifier + "_prop1"][:].tolist()
|
|
57
|
+
):
|
|
58
|
+
info = {"cubit_id": cubit_id, "exo_id": exo_id, "name": names[exo_id]}
|
|
59
|
+
cubit_id_to_info[cubit_id] = info.copy()
|
|
60
|
+
exo_id_to_info[exo_id] = info.copy()
|
|
61
|
+
|
|
62
|
+
return cubit_id_to_info, exo_id_to_info
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def convert_exodus_to_dict(exo_path: Path) -> dict:
|
|
66
|
+
"""Load an exodus file from disk and convert it to a dictionary containing
|
|
67
|
+
all the relevant information.
|
|
68
|
+
|
|
69
|
+
This function can be used in testing to compare exodus files with
|
|
70
|
+
each other.
|
|
71
|
+
"""
|
|
72
|
+
exo_data = {}
|
|
73
|
+
with netCDF4.Dataset(exo_path) as exo:
|
|
74
|
+
exo_data["coordinates"] = (
|
|
75
|
+
np.array(
|
|
76
|
+
[exo.variables["coord" + dim][:] for dim in ["x", "y", "z"]],
|
|
77
|
+
)
|
|
78
|
+
.transpose()
|
|
79
|
+
.tolist()
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
_, exo_block_id_to_info = get_exo_info(exo, "block")
|
|
83
|
+
exo_data["exo_block_id_to_info"] = exo_block_id_to_info
|
|
84
|
+
for exo_id in exo_block_id_to_info.keys():
|
|
85
|
+
connectivity_name = f"connect{exo_id + 1}"
|
|
86
|
+
connectivity = np.array(exo.variables[connectivity_name][:]).tolist()
|
|
87
|
+
exo_data[connectivity_name] = connectivity
|
|
88
|
+
|
|
89
|
+
_, exo_node_set_id_to_info = get_exo_info(exo, "nodeset")
|
|
90
|
+
exo_data["exo_node_set_id_to_info"] = exo_node_set_id_to_info
|
|
91
|
+
for exo_id in exo_node_set_id_to_info.keys():
|
|
92
|
+
node_set_name = f"node_ns{exo_id + 1}"
|
|
93
|
+
unique_node_set_ids = np.unique(np.array(exo.variables[node_set_name][:]))
|
|
94
|
+
# The correct data type here would be `set`. However, this can not be
|
|
95
|
+
# serialized by FourCIPP, so we return an ordered list of the unique IDs here.
|
|
96
|
+
exo_data[node_set_name] = unique_node_set_ids.tolist()
|
|
97
|
+
return exo_data
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 2)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g4d0bd8df5'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cubitpy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: CubitPy: Utility functions and 4C related functionality for the Cubit and Coreform python interface
|
|
5
5
|
Author-email: Ivo Steinbrecher <ivo.steinbrecher@unibw.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,6 +14,7 @@ src/cubitpy/cubit_to_fourc_input.py
|
|
|
14
14
|
src/cubitpy/cubit_utility.py
|
|
15
15
|
src/cubitpy/cubitpy.py
|
|
16
16
|
src/cubitpy/cubitpy_types.py
|
|
17
|
+
src/cubitpy/exodus_utility.py
|
|
17
18
|
src/cubitpy/geometry_creation_functions.py
|
|
18
19
|
src/cubitpy/mesh_creation_functions.py
|
|
19
20
|
src/cubitpy/version.py
|
|
@@ -43,6 +44,7 @@ tests/input-files-ref/test_contact_condition_surface_to_surface.4C.yaml
|
|
|
43
44
|
tests/input-files-ref/test_create_block.4C.yaml
|
|
44
45
|
tests/input-files-ref/test_create_block_unaltered_element_dict.4C.yaml
|
|
45
46
|
tests/input-files-ref/test_create_block_unaltered_element_dict_exo.4C.yaml
|
|
47
|
+
tests/input-files-ref/test_create_block_unaltered_element_dict_exo.exo
|
|
46
48
|
tests/input-files-ref/test_create_brick_by_corner_points.4C.yaml
|
|
47
49
|
tests/input-files-ref/test_create_wedge6.4C.yaml
|
|
48
50
|
tests/input-files-ref/test_cubit_tutorial_coreform.4C.yaml
|
|
@@ -54,6 +56,7 @@ tests/input-files-ref/test_element_types_quad_zplane.4C.yaml
|
|
|
54
56
|
tests/input-files-ref/test_element_types_tet_coreform.4C.yaml
|
|
55
57
|
tests/input-files-ref/test_element_types_tet_cubit15.4C.yaml
|
|
56
58
|
tests/input-files-ref/test_element_types_tet_single_element_with_exo.4C.yaml
|
|
59
|
+
tests/input-files-ref/test_element_types_tet_single_element_with_exo.exo
|
|
57
60
|
tests/input-files-ref/test_element_types_tet_single_element_without_exo.4C.yaml
|
|
58
61
|
tests/input-files-ref/test_extrude_mesh_function.4C.yaml
|
|
59
62
|
tests/input-files-ref/test_extrude_mesh_function_average_normals_block.4C.yaml
|
|
@@ -67,6 +70,7 @@ tests/input-files-ref/test_groups_multiple_sets.4C.yaml
|
|
|
67
70
|
tests/input-files-ref/test_mesh_import.4C.yaml
|
|
68
71
|
tests/input-files-ref/test_node_set_geometry_type.4C.yaml
|
|
69
72
|
tests/input-files-ref/test_node_sets_without_boundary_condition_with_exo.4C.yaml
|
|
73
|
+
tests/input-files-ref/test_node_sets_without_boundary_condition_with_exo.exo
|
|
70
74
|
tests/input-files-ref/test_node_sets_without_boundary_condition_without_exo.4C.yaml
|
|
71
75
|
tests/input-files-ref/test_point_coupling.4C.yaml
|
|
72
76
|
tests/input-files-ref/test_reset_block_1.4C.yaml
|
|
@@ -75,5 +79,7 @@ tests/input-files-ref/test_scatra_functionality.4C.yaml
|
|
|
75
79
|
tests/input-files-ref/test_serialize_nested_lists.4C.yaml
|
|
76
80
|
tests/input-files-ref/test_thermo_functionality.4C.yaml
|
|
77
81
|
tests/input-files-ref/test_user_defined_node_set_and_block_ids_with_exo.4C.yaml
|
|
82
|
+
tests/input-files-ref/test_user_defined_node_set_and_block_ids_with_exo.exo
|
|
78
83
|
tests/input-files-ref/test_user_defined_node_set_and_block_ids_without_exo.4C.yaml
|
|
79
|
-
tests/input-files-ref/test_yaml_with_exo_export_fsi.4C.yaml
|
|
84
|
+
tests/input-files-ref/test_yaml_with_exo_export_fsi.4C.yaml
|
|
85
|
+
tests/input-files-ref/test_yaml_with_exo_export_fsi.exo
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -42,6 +42,7 @@ from cubitpy.cubit_utility import (
|
|
|
42
42
|
string_to_node_set_info,
|
|
43
43
|
)
|
|
44
44
|
from cubitpy.cubitpy import CubitPy
|
|
45
|
+
from cubitpy.exodus_utility import convert_exodus_to_dict
|
|
45
46
|
from cubitpy.geometry_creation_functions import (
|
|
46
47
|
create_brick_by_corner_points,
|
|
47
48
|
create_parametric_surface,
|
|
@@ -126,17 +127,23 @@ def compare_yaml(
|
|
|
126
127
|
ref_file = Path(testing_input) / (compare_name + ".4C.yaml")
|
|
127
128
|
out_file = Path(testing_temp) / (compare_name + ".4C.yaml")
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
cubit.dump(out_file, mesh_in_exo=mesh_in_exo)
|
|
131
|
+
|
|
132
|
+
def get_input_file_with_data(input_file_path):
|
|
133
|
+
"""Load the input file into a FourCIPP object and if the mesh is given
|
|
134
|
+
in exodus format, add this as a data structure for comparison."""
|
|
135
|
+
input_file = FourCInput.from_4C_yaml(input_file_path)
|
|
136
|
+
if mesh_in_exo:
|
|
137
|
+
exo_path = input_file_path.parent / (compare_name + ".exo")
|
|
138
|
+
exo_data = convert_exodus_to_dict(exo_path)
|
|
139
|
+
section_name = "STRUCTURE GEOMETRY"
|
|
140
|
+
structure_section = input_file.pop(section_name)
|
|
141
|
+
structure_section["FILE"] = exo_data
|
|
142
|
+
input_file.combine_sections({section_name: structure_section})
|
|
143
|
+
return input_file
|
|
137
144
|
|
|
138
|
-
ref_input_file =
|
|
139
|
-
out_input_file =
|
|
145
|
+
ref_input_file = get_input_file_with_data(ref_file)
|
|
146
|
+
out_input_file = get_input_file_with_data(out_file)
|
|
140
147
|
|
|
141
148
|
try:
|
|
142
149
|
files_are_equal = ref_input_file.compare(
|
|
@@ -2503,3 +2510,54 @@ def test_cubit_warnings_and_errors():
|
|
|
2503
2510
|
match="ERROR: All dimensions must be nonzero and positive. Entered values are:",
|
|
2504
2511
|
):
|
|
2505
2512
|
cubit.cmd("brick x -10")
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
def test_exodus_to_dict():
|
|
2516
|
+
"""Create a simple model and check the convert exodus to dict
|
|
2517
|
+
functionality."""
|
|
2518
|
+
|
|
2519
|
+
# Create the brick with a single solid element
|
|
2520
|
+
cubit = CubitPy()
|
|
2521
|
+
create_brick(
|
|
2522
|
+
cubit,
|
|
2523
|
+
1,
|
|
2524
|
+
2,
|
|
2525
|
+
3,
|
|
2526
|
+
mesh_interval=[1, 1, 1],
|
|
2527
|
+
element_type=cupy.element_type.hex8,
|
|
2528
|
+
name="cube",
|
|
2529
|
+
)
|
|
2530
|
+
|
|
2531
|
+
# Add node sets to the top surface and to the whole volume of the brick, to make
|
|
2532
|
+
# the exodus file more general.
|
|
2533
|
+
cubit.add_node_set(cubit.group(add_value="add surface 2"), name="top")
|
|
2534
|
+
cubit.add_node_set(cubit.group(add_value="add volume 1"), name="all")
|
|
2535
|
+
|
|
2536
|
+
input_file_path = Path(testing_temp) / "exo_to_dict.4C.yaml"
|
|
2537
|
+
exo_path = Path(testing_temp) / "exo_to_dict.exo"
|
|
2538
|
+
cubit.dump(input_file_path, mesh_in_exo=True)
|
|
2539
|
+
|
|
2540
|
+
exo_dict = convert_exodus_to_dict(exo_path)
|
|
2541
|
+
|
|
2542
|
+
reference_exo_dict = {
|
|
2543
|
+
"coordinates": [
|
|
2544
|
+
[-0.5, -1.0, 1.5],
|
|
2545
|
+
[-0.5, -1.0, -1.5],
|
|
2546
|
+
[-0.5, 1.0, -1.5],
|
|
2547
|
+
[-0.5, 1.0, 1.5],
|
|
2548
|
+
[0.5, -1.0, 1.5],
|
|
2549
|
+
[0.5, -1.0, -1.5],
|
|
2550
|
+
[0.5, 1.0, -1.5],
|
|
2551
|
+
[0.5, 1.0, 1.5],
|
|
2552
|
+
],
|
|
2553
|
+
"exo_block_id_to_info": {0: {"cubit_id": 1, "exo_id": 0, "name": "cube"}},
|
|
2554
|
+
"connect1": [[1, 2, 3, 4, 5, 6, 7, 8]],
|
|
2555
|
+
"exo_node_set_id_to_info": {
|
|
2556
|
+
0: {"cubit_id": 1, "exo_id": 0, "name": "cpy_1_s_top"},
|
|
2557
|
+
1: {"cubit_id": 2, "exo_id": 1, "name": "cpy_2_v_all"},
|
|
2558
|
+
},
|
|
2559
|
+
"node_ns1": [2, 3, 6, 7],
|
|
2560
|
+
"node_ns2": [1, 2, 3, 4, 5, 6, 7, 8],
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
compare_nested_dicts_or_lists(exo_dict, reference_exo_dict)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_contact_condition_beam_to_surface.4C.yaml
RENAMED
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_contact_condition_curve_to_curve.4C.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_create_brick_by_corner_points.4C.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_quad_yplane.4C.yaml
RENAMED
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_quad_zplane.4C.yaml
RENAMED
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_coreform.4C.yaml
RENAMED
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_element_types_tet_cubit15.4C.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_fluid_functionality_coreform.4C.yaml
RENAMED
|
File without changes
|
{cubitpy-0.2.1 → cubitpy-0.2.2}/tests/input-files-ref/test_fluid_functionality_cubit15.4C.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|