Skip to content

Commit

Permalink
[refactor]
Browse files Browse the repository at this point in the history
  • Loading branch information
mohd-afeef-badri committed Jan 15, 2025
1 parent f8048ca commit a80d62d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 36 deletions.
59 changes: 31 additions & 28 deletions fourier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ arcane_generate_axl(Fem)
arcane_add_arcane_libraries_to_target(Fourier)
target_include_directories(Fourier PUBLIC . ${CMAKE_CURRENT_BINARY_DIR})
configure_file(Fourier.config ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.conduction.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.conduction.heterogeneous.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.conduction.heterogeneous.10k.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.conduction.10k.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.conduction.quad4.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(Test.manufacture.solution.arc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(${MSH_DIR}/plancher.msh ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(${MSH_DIR}/multi-material.msh ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(${MSH_DIR}/plancher.quad4.msh ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file(${MSH_DIR}/square_-2pi_to_2pi.msh ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

target_link_libraries(Fourier PUBLIC FemUtils)

Expand All @@ -31,46 +21,59 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ExternalFunctions.dll"
add_custom_target(external_functions DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ExternalFunctions.dll")
add_dependencies(Fourier external_functions)

# Copy the tests files in the binary directory
# The '/' after 'tests' is needed because we want to copy the files
# inside the 'tests' directory but not the directory itself.
file(COPY "tests/" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# Copy the check files in the binary directory
file(COPY "check" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

# Copy the inputs folder containing the arc files
file(COPY "inputs" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

# Copy the mesh files into meshes directory
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/meshes)
set(MESH_FILES
plancher.msh
multi-material.msh
plancher.quad4.msh
square_-2pi_to_2pi.msh
)
foreach(MESH_FILE IN LISTS MESH_FILES)
file(COPY ${MSH_DIR}/${MESH_FILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/meshes)
endforeach()

find_program(GMSH NAMES gmsh)
if (GMSH)
message(STATUS "GMSH found: ${GMSH}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plancher.10k.msh
COMMAND ${GMSH} -2 ${MSH_DIR}/plancher.geo -format msh41 -o plancher.10k.msh -bin
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/meshes/plancher.10k.msh
COMMAND ${GMSH} -2 ${MSH_DIR}/plancher.geo -format msh41 -o meshes/plancher.10k.msh -bin
DEPENDS ${MSH_DIR}/plancher.geo
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/multi-material.10k.msh
COMMAND ${GMSH} -2 ${MSH_DIR}/multi-mat.geo -format msh41 -o multi-material.10k.msh -bin
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/meshes/multi-material.10k.msh
COMMAND ${GMSH} -2 ${MSH_DIR}/multi-mat.geo -format msh41 -o meshes/multi-material.10k.msh -bin
DEPENDS ${MSH_DIR}/multi-mat.geo
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(Fourier_gmsh_files DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/multi-material.10k.msh ${CMAKE_CURRENT_BINARY_DIR}/plancher.10k.msh)
add_custom_target(Fourier_gmsh_files DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/meshes/multi-material.10k.msh ${CMAKE_CURRENT_BINARY_DIR}/meshes/plancher.10k.msh)
add_dependencies(Fourier Fourier_gmsh_files)
set(FEMTEST_HAS_GMSH_TEST TRUE)
endif()

enable_testing()

if(FEMUTILS_HAS_SOLVER_BACKEND_PETSC)
add_test(NAME [Fourier]conduction COMMAND Fourier Test.conduction.arc)
add_test(NAME [Fourier]conduction_heterogeneous COMMAND Fourier Test.conduction.heterogeneous.arc)
add_test(NAME [Fourier]conduction_quad COMMAND Fourier Test.conduction.quad4.arc)
add_test(NAME [Fourier]manufacture_solution COMMAND Fourier -A,UsingDotNet=1 Test.manufacture.solution.arc)
add_test(NAME [Fourier]conduction COMMAND Fourier inputs/conduction.arc)
add_test(NAME [Fourier]conduction_heterogeneous COMMAND Fourier inputs/conduction.heterogeneous.arc)
add_test(NAME [Fourier]conduction_quad COMMAND Fourier inputs/conduction.quad4.arc)
add_test(NAME [Fourier]manufacture_solution COMMAND Fourier -A,UsingDotNet=1 inputs/manufacture.solution.arc)
endif()


# If parallel part is available, add some tests
if(FEMUTILS_HAS_PARALLEL_SOLVER AND MPIEXEC_EXECUTABLE)
add_test(NAME [Fourier]conduction_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier Test.conduction.arc)
add_test(NAME [Fourier]conduction_heterogeneous_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier Test.conduction.heterogeneous.arc)
add_test(NAME [Fourier]manufacture_solution_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier -A,UsingDotNet=1 Test.manufacture.solution.arc)
add_test(NAME [Fourier]conduction_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier inputs/conduction.arc)
add_test(NAME [Fourier]conduction_heterogeneous_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier inputs/conduction.heterogeneous.arc)
add_test(NAME [Fourier]manufacture_solution_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier -A,UsingDotNet=1 inputs/manufacture.solution.arc)
if(FEMTEST_HAS_GMSH_TEST)
add_test(NAME [Fourier]conduction_10k_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier Test.conduction.10k.arc)
add_test(NAME [Fourier]conduction_heterogeneous_10k_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier Test.conduction.heterogeneous.10k.arc)
add_test(NAME [Fourier]conduction_10k_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier inputs/conduction.10k.arc)
add_test(NAME [Fourier]conduction_heterogeneous_10k_4pe COMMAND ${MPIEXEC_EXECUTABLE} -n 4 ./Fourier inputs/conduction.heterogeneous.10k.arc)
endif()
endif()
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
-->
<meshes>
<mesh>
<filename>plancher.10k.msh</filename>
<filename>meshes/plancher.10k.msh</filename>
</mesh>
</meshes>

Expand Down
4 changes: 2 additions & 2 deletions fourier/Test.conduction.arc → fourier/inputs/conduction.arc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
-->
<meshes>
<mesh>
<filename>plancher.msh</filename>
<filename>meshes/plancher.msh</filename>
</mesh>
</meshes>

Expand All @@ -41,7 +41,7 @@
<fem>
<lambda>1.75</lambda>
<qdot>1e5</qdot>
<result-file>test1_results.txt</result-file>
<result-file>check/test1_results.txt</result-file>
<boundary-conditions>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
-->
<meshes>
<mesh>
<filename>multi-material.10k.msh</filename>
<filename>meshes/multi-material.10k.msh</filename>
</mesh>
</meshes>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
-->
<meshes>
<mesh>
<filename>multi-material.msh</filename>
<filename>meshes/multi-material.msh</filename>
</mesh>
</meshes>

Expand All @@ -45,7 +45,7 @@
<fem>
<lambda>0.0</lambda>
<qdot>15.</qdot>
<result-file>test2_results.txt</result-file>
<result-file>check/test2_results.txt</result-file>
<boundary-conditions>
<dirichlet>
<surface>Left</surface>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
-->
<meshes>
<mesh>
<filename>plancher.quad4.msh</filename>
<filename>meshes/plancher.quad4.msh</filename>
</mesh>
</meshes>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
-->
<meshes>
<mesh>
<filename>square_-2pi_to_2pi.msh</filename>
<filename>meshes/square_-2pi_to_2pi.msh</filename>
</mesh>
</meshes>

Expand Down

0 comments on commit a80d62d

Please sign in to comment.