From dfeed3aa265e9e7688a43bcb32e43fff15e51cb1 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 23 Jul 2024 16:12:13 +0200 Subject: [PATCH] [T] Added test_partmesh_mixed_elements. --- Applications/Utils/Tests.cmake | 11 ------ .../GMSH2OGS/test_partmesh_mixed_elements.py | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 Tests/Data/Utils/GMSH2OGS/test_partmesh_mixed_elements.py diff --git a/Applications/Utils/Tests.cmake b/Applications/Utils/Tests.cmake index e4509187dbf..2113161ab35 100644 --- a/Applications/Utils/Tests.cmake +++ b/Applications/Utils/Tests.cmake @@ -531,17 +531,6 @@ AddTest( ################################################ -if(SNAKEMAKE AND TEE_TOOL_PATH AND BASH_TOOL_PATH) - add_test(NAME snakemake_partmesh_mixed_elements - COMMAND bash -c "export PATH=$<TARGET_FILE_DIR:partmesh>:$PATH && ${SNAKEMAKE} -j 4 \ - --config input_dir=${Data_SOURCE_DIR}/Utils/GMSH2OGS \ - -s ${PROJECT_SOURCE_DIR}/scripts/snakemake/workflows/partmesh.smk \ - ${Data_BINARY_DIR}/Utils/GMSH2OGS/{linear,quadratic}_mesh/{2,4,8,12}" - ) - set_tests_properties(snakemake_partmesh_mixed_elements - PROPERTIES LABELS "default") -endif() - if(SNAKEMAKE AND TEE_TOOL_PATH AND BASH_TOOL_PATH AND OGS_USE_MPI) add_test(NAME snakemake_reorder_mesh COMMAND bash -c "${SNAKEMAKE} -j 4 \ diff --git a/Tests/Data/Utils/GMSH2OGS/test_partmesh_mixed_elements.py b/Tests/Data/Utils/GMSH2OGS/test_partmesh_mixed_elements.py new file mode 100644 index 00000000000..c6b8e4dfee0 --- /dev/null +++ b/Tests/Data/Utils/GMSH2OGS/test_partmesh_mixed_elements.py @@ -0,0 +1,37 @@ +import itertools +import os +import tempfile +from pathlib import Path + +from ogs import cli + + +def test_partmesh_mixed_elements(): + os.chdir(Path(__file__).resolve().parent) + + meshes = ["linear", "quadratic"] + partitions = [2, 4, 8, 12] + + for mesh, partition in itertools.product(meshes, partitions): + with tempfile.TemporaryDirectory() as tmpdirname: + cli.partmesh(ogs2metis=None, i=f"{mesh}_mesh.vtu", o=tmpdirname) + assert Path(f"{tmpdirname}/{mesh}_mesh.mesh").exists() + + cli.partmesh( + exe_metis=None, + i=f"{mesh}_mesh.vtu", + x=f"{tmpdirname}/{mesh}_mesh", + o=tmpdirname, + np=partition, + ) + for filetype in [ + "cell_properties_cfg", + "cell_properties_val", + "msh_cfg", + "msh_ele_g", + "msh_ele", + "msh_nod", + ]: + assert Path( + f"{tmpdirname}/{mesh}_mesh_partitioned_{filetype}{partition}.bin" + ).exists() -- GitLab