Skip to content

Commit

Permalink
Merge branch 'cmake_split_LIE' into 'master'
Browse files Browse the repository at this point in the history
[CMake] Split LIE to LIE_M and LIE_HM for optional compilation

See merge request ogs/ogs!5146
  • Loading branch information
bilke committed Oct 29, 2024
2 parents 5ee8abc + 9be2fe4 commit f924b75
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 48 deletions.
10 changes: 6 additions & 4 deletions Applications/ApplicationsLib/ProjectData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@
#ifdef OGS_BUILD_PROCESS_LARGEDEFORMATION
#include "ProcessLib/LargeDeformation/CreateLargeDeformationProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_LIE
#include "ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h"
#ifdef OGS_BUILD_PROCESS_LIE_M
#include "ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_LIE_HM
#include "ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_LIQUIDFLOW
#include "ProcessLib/LiquidFlow/CreateLiquidFlowProcess.h"
#endif
Expand Down Expand Up @@ -897,7 +899,7 @@ void ProjectData::parseProcesses(
}
else
#endif
#ifdef OGS_BUILD_PROCESS_LIE
#ifdef OGS_BUILD_PROCESS_LIE_HM
if (type == "HYDRO_MECHANICS_WITH_LIE")
{
if ( //! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS_WITH_LIE__dimension}
Expand Down Expand Up @@ -1058,7 +1060,7 @@ void ProjectData::parseProcesses(
}
else
#endif
#ifdef OGS_BUILD_PROCESS_LIE
#ifdef OGS_BUILD_PROCESS_LIE_M
if (type == "SMALL_DEFORMATION_WITH_LIE")
{
if ( //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__dimension}
Expand Down
2 changes: 1 addition & 1 deletion Applications/Utils/PostProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(OGS_BUILD_PROCESS_LIE)
if(OGS_BUILD_PROCESS_LIE_M OR OGS_BUILD_PROCESS_LIE_HM)
ogs_add_executable(postLIE postLIE.cpp)
target_link_libraries(postLIE GitInfoLib LIECommon MeshToolsLib tclap)
install(TARGETS postLIE RUNTIME DESTINATION bin)
Expand Down
4 changes: 2 additions & 2 deletions Applications/Utils/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ AddTest(
WORKING_DIRECTORY ${Data_SOURCE_DIR}/LIE/PostProcessing
EXECUTABLE postLIE
EXECUTABLE_ARGS -i single_joint.pvd -o ${Data_BINARY_DIR}/LIE/PostProcessing/post_single_joint.pvd
REQUIREMENTS OGS_BUILD_PROCESS_LIE
REQUIREMENTS OGS_BUILD_PROCESS_LIE_M OR OGS_BUILD_PROCESS_LIE_HM
TESTER vtkdiff
DIFF_DATA
expected_post_single_joint_ts_1_t_1.000000.vtu post_single_joint_ts_1_t_1.000000.vtu u u 1e-14 1e-14
Expand All @@ -69,7 +69,7 @@ AddTest(
WORKING_DIRECTORY ${Data_SOURCE_DIR}/LIE/PostProcessing
EXECUTABLE postLIE
EXECUTABLE_ARGS -i single_joint_3D.pvd -o ${Data_BINARY_DIR}/LIE/PostProcessing/post_single_joint_3D.pvd
REQUIREMENTS OGS_BUILD_PROCESS_LIE
REQUIREMENTS OGS_BUILD_PROCESS_LIE_M OR OGS_BUILD_PROCESS_LIE_HM
TESTER vtkdiff
DIFF_DATA
post_single_joint_3D_ts_1_t_1.000000.vtu post_single_joint_3D_ts_1_t_1.000000.vtu u u 1e-14 1e-14
Expand Down
49 changes: 27 additions & 22 deletions ProcessLib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# Collect the process libraries in interface library
add_library(Processes INTERFACE)

# Check whether LIE processes are enabled
foreach(process ${_enabled_processes})
add_subdirectory(${process})
if(process STREQUAL "LIE_M" OR process STREQUAL "LIE_HM")
add_subdirectory(LIE/Common)
break()
endif()
endforeach()

foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_HM")
add_subdirectory(LIE/HydroMechanics)
elseif(process STREQUAL "LIE_M")
add_subdirectory(LIE/SmallDeformation)
else()
add_subdirectory(${process})
endif()
target_link_libraries(Processes INTERFACE ${process})
set_target_properties(${process} PROPERTIES JOB_POOL_COMPILE heavy_tasks)
endforeach()
Expand All @@ -19,27 +33,18 @@ append_source_files(SOURCES Utils)
append_source_files(SOURCES Reflection)
append_source_files(SOURCES Graph)
# For processes that contains both hydraulical process and mechanical process
# Define a function to check if enabled_processes contains LIE, HydroMechanics,
# ThermoHydroMechanics, RichardsMechanics, or ThermoRichardsMechanics
function(check_enabled_processes contains_hm_process)
set(${contains_hm_process} FALSE PARENT_SCOPE)
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE"
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics"
)
set(${contains_hm_process} TRUE PARENT_SCOPE)
return()
endif()
endforeach()
endfunction()
check_enabled_processes(contains_hm_process)
if(contains_hm_process)
append_source_files(SOURCES Common/HydroMechanics)
endif()
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_HM"
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics"
)
append_source_files(SOURCES Common/HydroMechanics)
break()
endif()
endforeach()

ogs_add_library(ProcessLib GENERATE_EXPORT_HEADER ${SOURCES})

Expand Down
18 changes: 0 additions & 18 deletions ProcessLib/LIE/CMakeLists.txt

This file was deleted.

14 changes: 14 additions & 0 deletions ProcessLib/LIE/HydroMechanics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
get_source_files(SOURCES)
append_source_files(SOURCES LocalAssembler)

ogs_add_library(LIE_HM ${SOURCES})
target_link_libraries(LIE_HM PUBLIC ProcessLib LIECommon PRIVATE ParameterLib)

target_precompile_headers(LIE_HM PRIVATE [["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]]
[["ProcessLib/Process.h"]] [["MaterialLib/MPL/Medium.h"]]
[["MaterialLib/MPL/Property.h"]] <Eigen/Core>)

if(OGS_BUILD_TESTING)
include(Tests.cmake)
endif()
14 changes: 14 additions & 0 deletions ProcessLib/LIE/SmallDeformation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
get_source_files(SOURCES)
append_source_files(SOURCES LocalAssembler)

ogs_add_library(LIE_M ${SOURCES})
target_link_libraries(LIE_M PUBLIC ProcessLib LIECommon PRIVATE ParameterLib)

target_precompile_headers(LIE_M PRIVATE [["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]]
[["ProcessLib/Process.h"]] [["MaterialLib/MPL/Medium.h"]]
[["MaterialLib/MPL/Property.h"]] <Eigen/Core>)

if(OGS_BUILD_TESTING)
include(Tests.cmake)
endif()
3 changes: 2 additions & 1 deletion scripts/cmake/ProcessesSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ set(_processes_list
HeatTransportBHE
HydroMechanics
LiquidFlow
LIE
LIE_M
LIE_HM
ThermoRichardsMechanics
RichardsComponentTransport
RichardsFlow
Expand Down

0 comments on commit f924b75

Please sign in to comment.