diff --git a/CMakeLists.txt b/CMakeLists.txt index e8f4271a2e929b20db54b923e86dd03e09d5d4bf..677143e3cfa9d0d93a8c5847f731dc8353202dd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,6 @@ option(OGS_USE_NETCDF "Add NetCDF support." OFF) option(OGS_USE_XDMF "Add Xdmf file IO support" OFF) # Eigen -option(OGS_USE_EIGEN "Use Eigen linear solver" ON) option(OGS_USE_EIGEN_UNSUPPORTED "Use Eigen unsupported modules" ON) option(OGS_EIGEN_INITIALIZE_MATRICES_BY_NAN "" ON) option(EIGEN_NO_DEBUG "Disables Eigen's assertions" OFF) @@ -188,7 +187,6 @@ option(OGS_USE_MFRONT # ---- Definitions ---- if(OGS_USE_LIS) include_directories(SYSTEM ${LIS_INCLUDE_DIR}) - set(OGS_USE_EIGEN ON) endif() if(OGS_USE_MKL) @@ -196,32 +194,24 @@ if(OGS_USE_MKL) endif() # Eigen -if(OGS_USE_EIGEN) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN) - endif() - - if(EIGEN_NO_DEBUG) - add_definitions(-DEIGEN_NO_DEBUG) - endif() - - if(EIGEN_DONT_VECTORIZE) - add_definitions(-DEIGEN_DONT_VECTORIZE) - endif() - - if(OGS_EIGEN_DYNAMIC_SHAPE_MATRICES_INTERNAL) - add_definitions(-DOGS_EIGEN_DYNAMIC_SHAPE_MATRICES) - endif() - - if(OGS_USE_EIGEN_UNSUPPORTED) - add_definitions(-DUSE_EIGEN_UNSUPPORTED) - endif() - - if(OGS_EIGEN_INITIALIZE_MATRICES_BY_NAN) - add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN) - endif() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN) +endif() +if(EIGEN_NO_DEBUG) + add_definitions(-DEIGEN_NO_DEBUG) +endif() +if(EIGEN_DONT_VECTORIZE) + add_definitions(-DEIGEN_DONT_VECTORIZE) +endif() +if(OGS_EIGEN_DYNAMIC_SHAPE_MATRICES_INTERNAL) + add_definitions(-DOGS_EIGEN_DYNAMIC_SHAPE_MATRICES) +endif() +if(OGS_USE_EIGEN_UNSUPPORTED) + add_definitions(-DUSE_EIGEN_UNSUPPORTED) +endif() +if(OGS_EIGEN_INITIALIZE_MATRICES_BY_NAN) + add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN) endif() -# End Eigen # Packaging include(scripts/cmake/packaging/Pack.cmake) diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index d7e6f97f1c4aabaf9b9332f20630b53e3f71bd14..2a7ee1dddadac5b932937df4e9a4f864a5d2ddd3 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -9,10 +9,7 @@ if(CVODE_FOUND) append_source_files(SOURCES ODE) endif() append_source_files(SOURCES Nonlinear) - -if(OGS_USE_EIGEN) - append_source_files(SOURCES LinAlg/Eigen) -endif() +append_source_files(SOURCES LinAlg/Eigen) if(OGS_USE_LIS) append_source_files(SOURCES LinAlg/Lis) @@ -59,7 +56,6 @@ target_compile_definitions(MathLib PUBLIC $<$<BOOL:${USE_LIS}>:USE_LIS> $<$<BOOL:${OGS_USE_PETSC}>:USE_PETSC> - $<$<BOOL:${OGS_USE_EIGEN}>:OGS_USE_EIGEN> $<$<BOOL:${CVODE_FOUND}>:CVODE_FOUND> PRIVATE $<$<BOOL:${OGS_USE_MKL}>:USE_MKL> diff --git a/MathLib/LinAlg/ApplyKnownSolution.h b/MathLib/LinAlg/ApplyKnownSolution.h index 4873ac11ce915350f852afad0d7ba092380daef6..084dbfa84e338f0e2c62721a6524fec6a6237288 100644 --- a/MathLib/LinAlg/ApplyKnownSolution.h +++ b/MathLib/LinAlg/ApplyKnownSolution.h @@ -11,10 +11,8 @@ #include <vector> -#ifdef OGS_USE_EIGEN #include "MathLib/LinAlg/Eigen/EigenTools.h" -#endif // OGS_USE_EIGEN #ifdef USE_PETSC #include "MathLib/LinAlg/PETSc/PETScTools.h" -#endif // USE_PETSC +#endif // USE_PETSC diff --git a/MathLib/LinAlg/GlobalMatrixVectorTypes.h b/MathLib/LinAlg/GlobalMatrixVectorTypes.h index dada4abe4630b30e662f7a920a6817a79929fe8c..0f73395ed6f6903ca4179a8832d48292504de0cc 100644 --- a/MathLib/LinAlg/GlobalMatrixVectorTypes.h +++ b/MathLib/LinAlg/GlobalMatrixVectorTypes.h @@ -36,7 +36,7 @@ using GlobalLinearSolver = MathLib::PETScLinearSolver; -#elif defined(OGS_USE_EIGEN) +#else #include "MathLib/LinAlg/Eigen/EigenVector.h" #include "MathLib/LinAlg/Eigen/EigenMatrix.h" #include "MathLib/LinAlg/Eigen/EigenLinearSolver.h" @@ -46,7 +46,7 @@ using GlobalLinearSolver = MathLib::EigenLinearSolver; -#endif // OGS_USE_EIGEN +#endif /// A type used for indexing of global vectors and matrices. It is equal to the diff --git a/MathLib/LinAlg/LinAlg.cpp b/MathLib/LinAlg/LinAlg.cpp index 7b9246a9dc2c490e7280f196211a1a9790f6688b..6489bff05d9a731fa65aff5abbb6415a899aab36 100644 --- a/MathLib/LinAlg/LinAlg.cpp +++ b/MathLib/LinAlg/LinAlg.cpp @@ -173,7 +173,7 @@ void finalizeAssembly(PETScVector& x) // Sparse global EigenMatrix/EigenVector ////////////////////////////////////////// -#elif defined(OGS_USE_EIGEN) +#else #include "MathLib/LinAlg/Eigen/EigenVector.h" #include "MathLib/LinAlg/Eigen/EigenMatrix.h" diff --git a/MathLib/LinAlg/LinAlg.h b/MathLib/LinAlg/LinAlg.h index 4be844712e0db0ddfc33a513d76cdf107e2d8ed6..1a56a5235f6c0d7ec4c9d95e2050f94dbff71dc6 100644 --- a/MathLib/LinAlg/LinAlg.h +++ b/MathLib/LinAlg/LinAlg.h @@ -196,7 +196,7 @@ void finalizeAssembly(PETScVector& x); // Sparse global EigenMatrix/EigenVector ////////////////////////////////////////// -#elif defined(OGS_USE_EIGEN) +#else namespace MathLib { diff --git a/MathLib/LinAlg/MatrixVectorTraits.cpp b/MathLib/LinAlg/MatrixVectorTraits.cpp index eee276d26d650b7e73f718cfbf18b29c89ece5eb..ff52b18cccd83d2a3b2fc248f082fdb1c6aee6e2 100644 --- a/MathLib/LinAlg/MatrixVectorTraits.cpp +++ b/MathLib/LinAlg/MatrixVectorTraits.cpp @@ -92,7 +92,7 @@ std::unique_ptr<PETScVector> MatrixVectorTraits<PETScVector>::newInstance( } // namespace MathLib -#elif defined(OGS_USE_EIGEN) +#else namespace MathLib { @@ -153,4 +153,4 @@ std::unique_ptr<EigenVector> MatrixVectorTraits<EigenVector>::newInstance( } } // namespace MathLib -#endif // defined(OGS_USE_EIGEN) +#endif diff --git a/MathLib/LinAlg/MatrixVectorTraits.h b/MathLib/LinAlg/MatrixVectorTraits.h index 189a0ebef9dd962b86808306da0325736bd710c0..785403ee02a9673f2922b946facdd2494089b844 100644 --- a/MathLib/LinAlg/MatrixVectorTraits.h +++ b/MathLib/LinAlg/MatrixVectorTraits.h @@ -43,7 +43,7 @@ SPECIALIZE_MATRIX_VECTOR_TRAITS(PETScVector, PETScVector::IndexType); } -#elif defined(OGS_USE_EIGEN) +#else #include "MathLib/LinAlg/Eigen/EigenMatrix.h" #include "MathLib/LinAlg/Eigen/EigenVector.h" diff --git a/MathLib/LinAlg/SetMatrixSparsity.h b/MathLib/LinAlg/SetMatrixSparsity.h index 2223f2d38c92704ce27e28015dccf7dfb9596f6e..71b607eb193c24c42e5653facab4750e986b91f0 100644 --- a/MathLib/LinAlg/SetMatrixSparsity.h +++ b/MathLib/LinAlg/SetMatrixSparsity.h @@ -40,6 +40,4 @@ void setMatrixSparsity(MATRIX& matrix, SPARSITY_PATTERN const& sparsity_pattern) #include "Lis/LisMatrix.h" #endif // USE_LIS -#ifdef OGS_USE_EIGEN #include "Eigen/EigenMatrix.h" -#endif // OGS_USE_EIGEN diff --git a/MathLib/LinAlg/UnifiedMatrixSetters.cpp b/MathLib/LinAlg/UnifiedMatrixSetters.cpp index 436f104c6962f1f6d6abf2a3b6b0f695be95d13c..18985bf423958adccafdf34d4382d6d0591aea8b 100644 --- a/MathLib/LinAlg/UnifiedMatrixSetters.cpp +++ b/MathLib/LinAlg/UnifiedMatrixSetters.cpp @@ -97,7 +97,7 @@ void addToMatrix(PETScMatrix& m, } // namespace MathLib -#elif defined(OGS_USE_EIGEN) +#else // Sparse global EigenMatrix/EigenVector ////////////////////////////////////////// @@ -171,4 +171,4 @@ void addToMatrix(EigenMatrix& m, } // namespace MathLib -#endif // OGS_USE_EIGEN +#endif diff --git a/MathLib/LinAlg/UnifiedMatrixSetters.h b/MathLib/LinAlg/UnifiedMatrixSetters.h index 0c9e17635444f65496090d52e24a56c7a32e728c..21a519f666b7c1460cab974f91ccfe5a201c70c9 100644 --- a/MathLib/LinAlg/UnifiedMatrixSetters.h +++ b/MathLib/LinAlg/UnifiedMatrixSetters.h @@ -42,7 +42,7 @@ void setMatrix(PETScMatrix& m, } // namespace MathLib -#elif defined(OGS_USE_EIGEN) +#else // Sparse global EigenMatrix/EigenVector ////////////////////////////////////////// @@ -68,4 +68,4 @@ void addToMatrix(EigenMatrix& m, } // namespace MathLib -#endif // OGS_USE_EIGEN +#endif diff --git a/Tests/MathLib/TestGlobalMatrixInterface.cpp b/Tests/MathLib/TestGlobalMatrixInterface.cpp index 1b72216955a6bc303b82da13e813762538adccdc..74375c582aa70cd39b3067291213593491c22160 100644 --- a/Tests/MathLib/TestGlobalMatrixInterface.cpp +++ b/Tests/MathLib/TestGlobalMatrixInterface.cpp @@ -21,7 +21,7 @@ #if defined(USE_PETSC) #include "MathLib/LinAlg/PETSc/PETScMatrix.h" -#elif defined(OGS_USE_EIGEN) +#else #include "MathLib/LinAlg/Eigen/EigenMatrix.h" #endif @@ -228,7 +228,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Rectangular_Matrix_Global_Size) checkGlobalRectangularMatrixInterfaceMPI(A, x); } -#elif defined(OGS_USE_EIGEN) +#else TEST(Math, CheckInterface_EigenMatrix) { MathLib::EigenMatrix m(10); diff --git a/Tests/MathLib/TestGlobalVectorInterface.cpp b/Tests/MathLib/TestGlobalVectorInterface.cpp index f61b2e94bbb5f6ca83f79e4e726e8339193dd136..e1bc1429fc3d5cccc2902933cc8c4715784602af 100644 --- a/Tests/MathLib/TestGlobalVectorInterface.cpp +++ b/Tests/MathLib/TestGlobalVectorInterface.cpp @@ -20,7 +20,7 @@ #if defined(USE_PETSC) #include "MathLib/LinAlg/PETSc/PETScVector.h" -#elif defined(OGS_USE_EIGEN) +#else #include "MathLib/LinAlg/Eigen/EigenVector.h" #endif @@ -282,7 +282,7 @@ TEST(MPITest_Math, CheckInterface_PETScVector) { checkGlobalVectorInterfacePETSc<MathLib::PETScVector >(); } -#elif defined(OGS_USE_EIGEN) +#else TEST(Math, CheckInterface_EigenVector) { checkGlobalVectorInterface<MathLib::EigenVector >(); diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp index 8677e34f0b7c28de03deaeb510d2e15e48af8842..d6c50f84e3e4312a640dd212b8d9f26b38185997 100644 --- a/Tests/MathLib/TestLinearSolver.cpp +++ b/Tests/MathLib/TestLinearSolver.cpp @@ -20,13 +20,11 @@ #include "MathLib/LinAlg/FinalizeMatrixAssembly.h" #include "MathLib/LinAlg/LinAlg.h" -#ifdef OGS_USE_EIGEN #include "MathLib/LinAlg/Eigen/EigenMatrix.h" #include "MathLib/LinAlg/Eigen/EigenVector.h" #include "MathLib/LinAlg/Eigen/EigenLinearSolver.h" -#endif -#if defined(OGS_USE_EIGEN) && defined(USE_LIS) +#if defined(USE_LIS) #include "MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h" #endif @@ -219,7 +217,6 @@ void checkLinearSolverInterface(T_MATRIX& A, T_VECTOR& b, } // end namespace -#ifdef OGS_USE_EIGEN TEST(Math, CheckInterface_Eigen) { // set solver options using Boost property tree @@ -239,9 +236,8 @@ TEST(Math, CheckInterface_Eigen) checkLinearSolverInterface<MathLib::EigenMatrix, MathLib::EigenVector, MathLib::EigenLinearSolver, IntType>(A, conf); } -#endif -#if defined(OGS_USE_EIGEN) && defined(USE_LIS) +#if defined(USE_LIS) TEST(Math, CheckInterface_EigenLis) { // set solver options using Boost property tree diff --git a/scripts/cmake/test/AddTest.cmake b/scripts/cmake/test/AddTest.cmake index f8e4a40b50f128ed95672fa055d30ac39e0cfad5..f5ad062bc82fffe15ce76c7cfe67715420a76934 100644 --- a/scripts/cmake/test/AddTest.cmake +++ b/scripts/cmake/test/AddTest.cmake @@ -14,7 +14,7 @@ # TESTER <diff|vtkdiff|gmldiff|memcheck> # optional # REQUIREMENTS # optional simple boolean expression which has to be true to # enable the test, e.g. -# OGS_USE_PETSC AND (OGS_USE_EIGEN OR OGS_USE_LIS) +# OGS_USE_PETSC AND (FOO OR BAR) # PYTHON_PACKAGES package_x=1.2.3 package_y=0.1.x # optional # VIS <vtu output file(s)> # optional for documentation # RUNTIME <in seconds> # optional for optimizing ctest duration diff --git a/scripts/cmake/test/MeshTest.cmake b/scripts/cmake/test/MeshTest.cmake index aaa6fc21cabd17c443dfdd81fbef991aa16e1bb3..0240f963dfa5026ad5944708ab419be75b31dc34 100644 --- a/scripts/cmake/test/MeshTest.cmake +++ b/scripts/cmake/test/MeshTest.cmake @@ -11,7 +11,7 @@ # WRAPPER_ARGS <arguments> # optional # REQUIREMENTS # optional simple boolean expression which has to be true to # enable the test, e.g. -# OGS_USE_PETSC AND (OGS_USE_EIGEN OR OGS_USE_LIS) +# OGS_USE_PETSC AND (FOO OR BAR) # RUNTIME <in seconds> # optional for optimizing ctest duration # values should be taken from envinf1 serial job # )