Skip to content

Commit

Permalink
Copy mesh tpo demo dir with cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
garth-wells committed Jun 8, 2024
1 parent ad6c248 commit 84fd8e1
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
ninja
#
./meshtie/demo_meshtie
mpirun -np 2 .meshtie/demo_meshtie
mpirun -np 2 ./meshtie/demo_meshtie
#
./meshtieHeatEquation/demo_meshtie_heat
mpirun -np 2 ./meshtieHeatEquation/demo_meshtie_heat
Expand Down
14 changes: 13 additions & 1 deletion cpp/demos/meshtie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,17 @@ add_custom_command(

add_executable(${PROJECT_NAME} main.cpp ${ufl_file}.c)

# Copy mesh files into binary directory
function(copy_meshes_to_target_dir target)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_PROPERTY:${target},SOURCE_DIR>/../meshes"
"$<TARGET_PROPERTY:${target},BINARY_DIR>"
)
endfunction()
copy_meshes_to_target_dir(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx)
target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx_contact)
target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx_contact)

2 changes: 1 addition & 1 deletion cpp/demos/meshtie/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char* argv[])
spdlog::set_pattern(fmt);
{
auto [mesh_init, domain1_init, facet1_init] = dolfinx_contact::read_mesh(
"../meshes/box_3D.xdmf", "mesh", "mesh", "cell_marker", "facet_marker");
"box_3D.xdmf", "mesh", "mesh", "cell_marker", "facet_marker");

const std::int32_t contact_bdry_1 = 6; // top contact interface
const std::int32_t contact_bdry_2 = 13; // bottom contact interface
Expand Down
11 changes: 11 additions & 0 deletions cpp/demos/meshtieHeatEquation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,16 @@ add_custom_command(

add_executable(${PROJECT_NAME} main.cpp ${ufl_file}.c)

# Copy mesh files into binary directory
function(copy_meshes_to_target_dir target)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_PROPERTY:${target},SOURCE_DIR>/../meshes"
"$<TARGET_PROPERTY:${target},BINARY_DIR>"
)
endfunction()
copy_meshes_to_target_dir(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx)
target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx_contact)
2 changes: 1 addition & 1 deletion cpp/demos/meshtieHeatEquation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char* argv[])

{
auto [mesh_init, domain1_init, facet1_init]
= dolfinx_contact::read_mesh("../meshes/cont-blocks_sk24_fnx.xdmf");
= dolfinx_contact::read_mesh("cont-blocks_sk24_fnx.xdmf");

const std::int32_t contact_bdry_1 = 6; // top contact interface
const std::int32_t contact_bdry_2 = 12; // bottom contact interface
Expand Down
12 changes: 11 additions & 1 deletion cpp/demos/meshtieHeatTransfer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ add_custom_command(
COMMENT "Compiling ${ufl_file}.py"
)


add_executable(${PROJECT_NAME} main.cpp ${ufl_file}.c)

# Copy mesh files into binary directory
function(copy_meshes_to_target_dir target)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_PROPERTY:${target},SOURCE_DIR>/../meshes"
"$<TARGET_PROPERTY:${target},BINARY_DIR>"
)
endfunction()
copy_meshes_to_target_dir(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx)
target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx_contact)
2 changes: 1 addition & 1 deletion cpp/demos/meshtieHeatTransfer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ int main(int argc, char* argv[])

// Read in mesh
auto [mesh_init, domain1_init, facet1_init]
= dolfinx_contact::read_mesh("../meshes/cont-blocks_sk24_fnx.xdmf");
= dolfinx_contact::read_mesh("cont-blocks_sk24_fnx.xdmf");

// Add necessary ghosts
const std::int32_t contact_bdry_1 = 12; // top contact interface
Expand Down
12 changes: 11 additions & 1 deletion cpp/demos/meshtieNewton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ add_custom_command(
COMMENT "Compiling ${ufl_file}.py"
)


add_executable(${PROJECT_NAME} main.cpp ${ufl_file}.c)

# Copy mesh files into binary directory
function(copy_meshes_to_target_dir target)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_PROPERTY:${target},SOURCE_DIR>/../meshes"
"$<TARGET_PROPERTY:${target},BINARY_DIR>"
)
endfunction()
copy_meshes_to_target_dir(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx)
target_link_libraries(${PROJECT_NAME} PRIVATE dolfinx_contact)
2 changes: 1 addition & 1 deletion cpp/demos/meshtieNewton/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ int main(int argc, char* argv[])
spdlog::set_pattern(fmt);
{
auto [mesh_init, domain1_init, facet1_init]
= dolfinx_contact::read_mesh("../meshes/cont-blocks_sk24_fnx.xdmf");
= dolfinx_contact::read_mesh("cont-blocks_sk24_fnx.xdmf");

const std::int32_t contact_bdry_1 = 12; // top contact interface
const std::int32_t contact_bdry_2 = 6; // bottom contact interface
Expand Down

0 comments on commit 84fd8e1

Please sign in to comment.