Added: A dedicated domain-decomposition helper class.

This administers the parallel finite element model.
- establishes global node numbers
- establishes global equation numbers
- establishes global DOF numbers
- generates subdomains for schwarz preconditioners
  (if using multiple subdomains for each patch)
This commit is contained in:
Arne Morten Kvarving
2016-07-01 14:03:04 +02:00
committed by Knut Morten Okstad
parent 78d7f3d818
commit cad3a7929f
262 changed files with 6003 additions and 32 deletions

View File

@@ -1,20 +1,17 @@
# Get GTest tests as CMake tests.
# Copied from FindGTest.cmake
# Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code
function(gtest_add_tests executable working_dir)
if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
endif()
function(gtest_add_tests executable working_dir source_var)
if(NOT UNIT_TEST_NUMBER)
set(UNIT_TEST_NUMBER 0 CACHE INT "" FORCE)
endif()
foreach(source ${ARGN})
foreach(source ${${source_var}})
file(READ "${source}" contents)
string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})
string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
math(EXPR UNIT_TEST_NUMBER "${UNIT_TEST_NUMBER}+1")
set(UNIT_TEST${UNIT_TEST_NUMBER} ${test_name} ${working_dir} ${executable} --gtest_filter=${test_name} CACHE STRING "" FORCE)
set(UNIT_TEST${UNIT_TEST_NUMBER} ${test_name} ${working_dir} ${ARGN} ${executable} --gtest_filter=${test_name} CACHE STRING "" FORCE)
endforeach()
# Groups parametrized tests under a single ctest entry
string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents})
@@ -24,8 +21,16 @@ function(gtest_add_tests executable working_dir)
list(GET test_name 0 filter_name)
list(GET test_name 1 test_prefix)
string(STRIP ${test_prefix} test_prefix)
math(EXPR UNIT_TEST_NUMBER "${UNIT_TEST_NUMBER}+1")
set(UNIT_TEST${UNIT_TEST_NUMBER} ${test_prefix}.${filter_name} ${working_dir} ${executable} --gtest_filter=${filter_name}* CACHE STRING "" FORCE)
string(REGEX MATCHALL "TEST_P\\(${test_prefix},([^\\)]+)\\)" found_tests3 ${contents})
foreach(ghit ${found_tests3})
string(SUBSTRING ${ghit} 8 -1 ghit_name)
string(REPLACE "," ";" ghit_name "${ghit_name}")
list(GET ghit_name 1 ghit_tname)
string(STRIP ${ghit_tname} ghit_tname)
string(REPLACE ")" "" ghit_tname "${ghit_tname}")
math(EXPR UNIT_TEST_NUMBER "${UNIT_TEST_NUMBER}+1")
set(UNIT_TEST${UNIT_TEST_NUMBER} ${test_prefix}.${ghit_tname} ${working_dir} ${ARGN} ${executable} --gtest_filter=*${filter_name}.${ghit_tname}/* CACHE STRING "" FORCE)
endforeach()
endforeach()
endforeach()
set(UNIT_TEST_NUMBER ${UNIT_TEST_NUMBER} PARENT_SCOPE)
@@ -39,7 +44,7 @@ macro(IFEM_add_test_app path workdir name)
set(TEST_SRCS ${path})
endif()
add_executable(${name}-test EXCLUDE_FROM_ALL ${IFEM_PATH}/src/IFEM-test.C ${TEST_SRCS})
gtest_add_tests($<TARGET_FILE:${name}-test> ${workdir} ${TEST_SRCS})
gtest_add_tests($<TARGET_FILE:${name}-test> ${workdir} TEST_SRCS)
list(APPEND TEST_APPS ${name}-test)
target_link_libraries(${name}-test ${ARGN} gtest pthread)
endmacro()
@@ -49,6 +54,17 @@ macro(IFEM_add_unittests IFEM_PATH)
${IFEM_PATH}
IFEM
${IFEM_LIBRARIES} ${IFEM_DEPLIBS})
# Parallel unit tests. These all run with 4 processes.
if(MPI_FOUND)
set(TEST_SRCS_MPI ${IFEM_PATH}/src/ASM/Test/MPI/TestDomainDecomposition.C)
add_executable(IFEM-MPI-test EXCLUDE_FROM_ALL
${IFEM_PATH}/src/IFEM-test.C ${TEST_SRCS_MPI})
target_link_libraries(IFEM-MPI-test ${IFEM_LIBRARIES} ${IFEM_DEPLIBS} gtest)
gtest_add_tests($<TARGET_FILE:IFEM-MPI-test> ${IFEM_PATH} TEST_SRCS_MPI
${MPIEXEC} -np 4)
list(APPEND TEST_APPS IFEM-MPI-test)
endif()
endmacro()
function(IFEM_add_test name binary)
@@ -78,11 +94,13 @@ macro(add_check_target)
foreach(test_number RANGE 1 ${UNIT_TEST_NUMBER})
list(GET UNIT_TEST${test_number} 0 name)
list(GET UNIT_TEST${test_number} 1 dir)
list(GET UNIT_TEST${test_number} 2 -1 cmd)
list(REMOVE_AT UNIT_TEST${test_number} 0 1)
if(IFEM_TEST_MEMCHECK)
set(cmd ${MEMCHECK_COMMAND} ${cmd})
endif()
add_test(NAME ${name} WORKING_DIRECTORY ${dir} COMMAND ${cmd})
add_test(NAME ${name}
COMMAND ${UNIT_TEST${test_number}}
WORKING_DIRECTORY ${dir})
endforeach()
endif()
add_dependencies(check ${TEST_APPS})