Skip to content

Commit

Permalink
Adapt all other test cases to use the get_corresponding path function
Browse files Browse the repository at this point in the history
  • Loading branch information
isteinbrecher committed Feb 14, 2025
1 parent 4843258 commit 9628d88
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 65 deletions.
21 changes: 9 additions & 12 deletions tests/test_four_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ def test_four_c_simulation_beam_potential_helix(
def test_four_c_solid_shell_direction_detection(
assert_results_equal,
get_corresponding_reference_file_path,
reference_file_directory,
tmp_path,
):
"""Test the solid shell direction detection functionality."""

# Test the plates
mpy.import_mesh_full = True
mesh_block = InputFile(
dat_file=reference_file_directory
/ "test_create_cubit_input_solid_shell_blocks.dat"
dat_file=get_corresponding_reference_file_path(
reference_file_base_name="test_create_cubit_input_solid_shell_blocks"
)
)
# Add a beam element to check the function also works with beam elements
mat = MaterialReissner()
Expand All @@ -187,8 +187,9 @@ def test_four_c_solid_shell_direction_detection(

# Test the dome
mesh_dome_original = InputFile(
dat_file=reference_file_directory
/ "test_create_cubit_input_solid_shell_dome.dat"
dat_file=get_corresponding_reference_file_path(
reference_file_base_name="test_create_cubit_input_solid_shell_dome"
)
)

# Test that the thickness version works
Expand Down Expand Up @@ -232,14 +233,10 @@ def director_function(cell_center):
)

# Also test the visualization function
ref_file = (
reference_file_directory
/ "test_four_c_solid_shell_direction_detection_dome_constant_direction.vtu"
)
test_file = (
tmp_path
/ "test_four_c_solid_shell_direction_detection_dome_constant_direction_result.vtu"
ref_file = get_corresponding_reference_file_path(
additional_identifier="dome_constant_direction", extension="vtu"
)
test_file = tmp_path / ref_file.name

grid = get_visualization_third_parameter_direction_hex8(mesh_dome)
grid.save(test_file)
Expand Down
10 changes: 6 additions & 4 deletions tests/test_four_c_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def test_four_c_simulation_honeycomb_sphere(
tmp_path,
assert_results_equal,
get_corresponding_reference_file_path,
reference_file_directory,
):
"""Create the same honeycomb mesh as defined in 4C/tests/input_files/beam3r
_herm2lin3_static_point_coupling_BTSPH_contact_stent_honeycomb_stretch_r01_
Expand All @@ -150,7 +149,7 @@ def test_four_c_simulation_honeycomb_sphere(
mpy.import_mesh_full = full_import
input_file = InputFile(
description="honeycomb beam in contact with sphere",
dat_file=reference_file_directory / "4C_input_honeycomb_sphere.dat",
dat_file=get_corresponding_reference_file_path(additional_identifier="import"),
)

# Modify the time step options.
Expand Down Expand Up @@ -257,14 +256,17 @@ def test_four_c_simulation_beam_and_solid_tube(
tmp_path,
assert_results_equal,
get_corresponding_reference_file_path,
reference_file_directory,
):
"""Merge a solid tube with a beam tube and simulate them together."""

# Create the input file and read solid mesh data.
mpy.import_mesh_full = full_import
input_file = InputFile(description="Solid tube with beam tube")
input_file.read_dat(reference_file_directory / "test_create_cubit_input_tube.dat")
input_file.read_dat(
get_corresponding_reference_file_path(
reference_file_base_name="test_create_cubit_input_tube"
)
)

# Add options for beam_output.
input_file.add(
Expand Down
Loading

0 comments on commit 9628d88

Please sign in to comment.