Commit 54d43006 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/cmake_have_package_rename' into 'master'

cmake have package rename

See merge request !139
parents e71c2200 d01698cc
...@@ -23,18 +23,18 @@ endif (NOT BACKEND) ...@@ -23,18 +23,18 @@ endif (NOT BACKEND)
if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4") if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
find_package(MTL REQUIRED) find_package(MTL REQUIRED)
set(HAVE_MTL TRUE) set(AMDIS_HAS_MTL TRUE)
message(STATUS " Found MTL, version: ${MTL_VERSION}") message(STATUS " Found MTL, version: ${MTL_VERSION}")
dune_register_package_flags(LIBRARIES MTL::MTL COMPILE_DEFINITIONS "ENABLE_MTL=1") dune_register_package_flags(LIBRARIES MTL::MTL COMPILE_DEFINITIONS "ENABLE_MTL=1")
find_package(HYPRE) find_package(HYPRE)
if (HYPRE_FOUND) if (HYPRE_FOUND)
set(HAVE_HYPRE TRUE) set(AMDIS_HAS_HYPRE TRUE)
dune_register_package_flags(LIBRARIES HYPRE::HYPRE COMPILE_DEFINITIONS "ENABLE_HYPRE=1") dune_register_package_flags(LIBRARIES HYPRE::HYPRE COMPILE_DEFINITIONS "ENABLE_HYPRE=1")
endif(HYPRE_FOUND) endif(HYPRE_FOUND)
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3") elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
find_package(Eigen3 REQUIRED 3.3.5) find_package(Eigen3 REQUIRED 3.3.5)
set(HAVE_EIGEN TRUE) set(AMDIS_HAS_EIGEN TRUE)
if (EIGEN3_FOUND) if (EIGEN3_FOUND)
message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}") message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}")
dune_register_package_flags(LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS "ENABLE_EIGEN=1") dune_register_package_flags(LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS "ENABLE_EIGEN=1")
...@@ -42,7 +42,7 @@ elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3") ...@@ -42,7 +42,7 @@ elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
elseif (BACKEND STREQUAL "PETSC") elseif (BACKEND STREQUAL "PETSC")
find_package(PETSc REQUIRED) find_package(PETSc REQUIRED)
if (PETSc_FOUND) if (PETSc_FOUND)
set(HAVE_PETSC TRUE) set(AMDIS_HAS_PETSC TRUE)
dune_register_package_flags(LIBRARIES PETSc::PETSc COMPILE_DEFINITIONS "ENABLE_PETSC=1") dune_register_package_flags(LIBRARIES PETSc::PETSc COMPILE_DEFINITIONS "ENABLE_PETSC=1")
endif (PETSc_FOUND) endif (PETSc_FOUND)
elseif (BACKEND STREQUAL "ISTL") elseif (BACKEND STREQUAL "ISTL")
......
...@@ -45,19 +45,20 @@ if (HYPRE_LIBRARY) ...@@ -45,19 +45,20 @@ if (HYPRE_LIBRARY)
set(HYPRE_LIBRARIES ${HYPRE_LIBRARY}) set(HYPRE_LIBRARIES ${HYPRE_LIBRARY})
get_filename_component(HYPRE_LIBRARY_DIR ${HYPRE_LIBRARY} DIRECTORY) get_filename_component(HYPRE_LIBRARY_DIR ${HYPRE_LIBRARY} DIRECTORY)
foreach(_lib_name "HYPRE_FEI" "HYPRE_core") file(GLOB HYPRE_LIB_NAMES LIST_DIRECTORIES false RELATIVE ${HYPRE_LIBRARY_DIR} "${HYPRE_LIBRARY_DIR}/*HYPRE_*.*")
find_library(_lib ${_lib_name} HINTS ${HYPRE_LIBRARY_DIR} NO_DEFAULT_PATH) foreach(_lib_name_long ${HYPRE_LIB_NAMES})
if (_lib) string(REGEX REPLACE "^(lib)?HYPRE_([a-zA-Z_]+)([0-9.-]*)[.][a-zA-Z]+$" "\\2" _lib_name "${_lib_name_long}")
list(APPEND HYPRE_LIBRARIES ${_lib}) set(LIB_VAR "_lib_${_lib_name}")
endif (_lib) find_library(${LIB_VAR} "HYPRE_${_lib_name}" HINTS ${HYPRE_LIBRARY_DIR} NO_DEFAULT_PATH)
unset(_lib) if (${LIB_VAR})
list(APPEND HYPRE_LIBRARIES ${${LIB_VAR}})
endif ()
endforeach() endforeach()
unset(_lib_name)
endif (HYPRE_LIBRARY) endif (HYPRE_LIBRARY)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HYPRE find_package_handle_standard_args(HYPRE
REQUIRED_VARS HYPRE_INCLUDE_DIR HYPRE_LIBRARY REQUIRED_VARS HYPRE_INCLUDE_DIR HYPRE_LIBRARIES
) )
# text for feature summary # text for feature summary
......
...@@ -41,16 +41,16 @@ ...@@ -41,16 +41,16 @@
#define AMDIS_VERSION_REVISION @AMDIS_VERSION_REVISION@ #define AMDIS_VERSION_REVISION @AMDIS_VERSION_REVISION@
/* Define to true if the MTL library is available */ /* Define to true if the MTL library is available */
#cmakedefine HAVE_MTL 1 #cmakedefine AMDIS_HAS_MTL 1
/* Define to true if the HYPRE library is available */ /* Define to true if the HYPRE library is available */
#cmakedefine HAVE_HYPRE ENABLE_HYPRE #cmakedefine AMDIS_HAS_HYPRE ENABLE_HYPRE
/* Define to true if the Eigen3 library is available */ /* Define to true if the Eigen3 library is available */
#cmakedefine HAVE_EIGEN 1 #cmakedefine AMDIS_HAS_EIGEN 1
/* Define to true if the PETSc library is available */ /* Define to true if the PETSc library is available */
#cmakedefine HAVE_PETSC 1 #cmakedefine AMDIS_HAS_PETSC 1
/* some detected compiler features may be used in AMDiS */ /* some detected compiler features may be used in AMDiS */
#cmakedefine AMDIS_HAS_CXX_FOLD_EXPRESSIONS 1 #cmakedefine AMDIS_HAS_CXX_FOLD_EXPRESSIONS 1
......
...@@ -20,7 +20,8 @@ EXCLUDE_SYMBOLS = AMDiS::Impl \ ...@@ -20,7 +20,8 @@ EXCLUDE_SYMBOLS = AMDiS::Impl \
PREDEFINED += HAVE_UMFPACK \ PREDEFINED += HAVE_UMFPACK \
HAVE_ALBERTA \ HAVE_ALBERTA \
HAVE_UG \ HAVE_UG \
HAVE_MTL AMDIS_HAS_MTL \
AMDIS_HAS_HYPRE
# The INPUT tag can be used to specify the files and/or directories that contain # The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or # documented source files. You may enter file names like "myfile.cpp" or
......
#pragma once #pragma once
#if HAVE_MTL #if AMDIS_HAS_MTL
#include <amdis/linearalgebra/mtl/Constraints.hpp> #include <amdis/linearalgebra/mtl/Constraints.hpp>
#include <amdis/linearalgebra/mtl/ITL_Solver.hpp> #include <amdis/linearalgebra/mtl/ITL_Solver.hpp>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <amdis/linearalgebra/mtl/MatrixBackend.hpp> #include <amdis/linearalgebra/mtl/MatrixBackend.hpp>
#include <amdis/linearalgebra/mtl/VectorBackend.hpp> #include <amdis/linearalgebra/mtl/VectorBackend.hpp>
#elif HAVE_EIGEN #elif AMDIS_HAS_EIGEN
#include <amdis/linearalgebra/eigen/Constraints.hpp> #include <amdis/linearalgebra/eigen/Constraints.hpp>
#include <amdis/linearalgebra/eigen/SolverCreator.hpp> #include <amdis/linearalgebra/eigen/SolverCreator.hpp>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <amdis/linearalgebra/eigen/MatrixBackend.hpp> #include <amdis/linearalgebra/eigen/MatrixBackend.hpp>
#include <amdis/linearalgebra/eigen/VectorBackend.hpp> #include <amdis/linearalgebra/eigen/VectorBackend.hpp>
#elif HAVE_PETSC #elif AMDIS_HAS_PETSC
#include <amdis/linearalgebra/petsc/Constraints.hpp> #include <amdis/linearalgebra/petsc/Constraints.hpp>
#include <amdis/linearalgebra/petsc/SolverCreator.hpp> #include <amdis/linearalgebra/petsc/SolverCreator.hpp>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <dune/common/typeutilities.hh> #include <dune/common/typeutilities.hh>
#include <amdis/common/TypeTraits.hpp> #include <amdis/common/TypeTraits.hpp>
#if HAVE_MTL #if AMDIS_HAS_MTL
#include <boost/numeric/mtl/operation/static_size.hpp> #include <boost/numeric/mtl/operation/static_size.hpp>
#endif #endif
...@@ -18,7 +18,7 @@ namespace AMDiS ...@@ -18,7 +18,7 @@ namespace AMDiS
template <class Container> template <class Container>
struct SizeImpl struct SizeImpl
{ {
#if HAVE_MTL #if AMDIS_HAS_MTL
// MTL4: Try if a mtl::static_size is specialized for class // MTL4: Try if a mtl::static_size is specialized for class
template <class T> template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<6>) static constexpr auto eval(T const&, Dune::PriorityTag<6>)
...@@ -117,7 +117,7 @@ namespace AMDiS ...@@ -117,7 +117,7 @@ namespace AMDiS
template <class Matrix> template <class Matrix>
struct NumRowsImpl struct NumRowsImpl
{ {
#if HAVE_MTL #if AMDIS_HAS_MTL
// MTL4: Try if a mtl::static_num_rows is specialized for class // MTL4: Try if a mtl::static_num_rows is specialized for class
template <class T> template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<4>) static constexpr auto eval(T const&, Dune::PriorityTag<4>)
...@@ -199,7 +199,7 @@ namespace AMDiS ...@@ -199,7 +199,7 @@ namespace AMDiS
template <class Matrix> template <class Matrix>
struct NumColsImpl struct NumColsImpl
{ {
#if HAVE_MTL #if AMDIS_HAS_MTL
// MTL4: Try if a mtl::static_num_cols is specialized for class // MTL4: Try if a mtl::static_num_cols is specialized for class
template <class T> template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<4>) static constexpr auto eval(T const&, Dune::PriorityTag<4>)
......
#pragma once #pragma once
#if HAVE_MTL #if AMDIS_HAS_MTL
#include <amdis/linearalgebra/mtl/Traits.hpp> #include <amdis/linearalgebra/mtl/Traits.hpp>
#elif HAVE_EIGEN #elif AMDIS_HAS_EIGEN
#include <amdis/linearalgebra/eigen/Traits.hpp> #include <amdis/linearalgebra/eigen/Traits.hpp>
#elif HAVE_PETSC #elif AMDIS_HAS_PETSC
#include <amdis/linearalgebra/petsc/Traits.hpp> #include <amdis/linearalgebra/petsc/Traits.hpp>
#else // ISTL #else // ISTL
...@@ -33,6 +33,7 @@ namespace AMDiS ...@@ -33,6 +33,7 @@ namespace AMDiS
using Comm = implementation_defined; //< The communication type using Comm = implementation_defined; //< The communication type
using CoefficientType = T; //< The type of the matrix/vector entries using CoefficientType = T; //< The type of the matrix/vector entries
using SparsityPattern = implementation_defined; //< The SparsityPattern for the matrix type
using PartitionSet = Dune::Partitions::All; //< The dune partition set where to assemble operators using PartitionSet = Dune::Partitions::All; //< The dune partition set where to assemble operators
}; };
#endif #endif
......
#pragma once #pragma once
#if HAVE_HYPRE #if AMDIS_HAS_HYPRE && HAVE_MPI
#include <HYPRE.h>
#include <dune/common/unused.hh> #include <dune/common/unused.hh>
#include <amdis/linearalgebra/PreconditionerInterface.hpp>
#include <amdis/linearalgebra/mtl/itl/hypre.hpp> #include <amdis/linearalgebra/mtl/itl/hypre.hpp>
namespace AMDiS namespace AMDiS
...@@ -150,4 +153,4 @@ namespace AMDiS ...@@ -150,4 +153,4 @@ namespace AMDiS
} // end namespace AMDiS } // end namespace AMDiS
#endif // HAVE_HYPRE #endif // AMDIS_HAS_HYPRE && HAVE_MPI
...@@ -7,15 +7,12 @@ ...@@ -7,15 +7,12 @@
#include <boost/numeric/mtl/vector/assigner.hpp> #include <boost/numeric/mtl/vector/assigner.hpp>
#include <amdis/CreatorMap.hpp> #include <amdis/CreatorMap.hpp>
#include <amdis/linearalgebra/mtl/HyprePrecon.hpp>
#include <amdis/linearalgebra/mtl/Preconditioner.hpp> #include <amdis/linearalgebra/mtl/Preconditioner.hpp>
#include <amdis/linearalgebra/mtl/SolverPrecon.hpp> #include <amdis/linearalgebra/mtl/SolverPrecon.hpp>
#include <amdis/linearalgebra/mtl/Traits.hpp> #include <amdis/linearalgebra/mtl/Traits.hpp>
#include <amdis/linearalgebra/mtl/itl/masslumping.hpp> #include <amdis/linearalgebra/mtl/itl/masslumping.hpp>
#if HAVE_HYPRE
#include <amdis/linearalgebra/mtl/HyprePrecon.hpp>
#endif
namespace AMDiS namespace AMDiS
{ {
/** /**
...@@ -116,12 +113,18 @@ namespace AMDiS ...@@ -116,12 +113,18 @@ namespace AMDiS
auto pc_solver = new typename SolverPrecon<Traits>::Creator; auto pc_solver = new typename SolverPrecon<Traits>::Creator;
Map::addCreator("solver", pc_solver); Map::addCreator("solver", pc_solver);
#if HAVE_HYPRE Map::addCreator("default", pc_id);
init_hypre(std::is_same<typename Dune::FieldTraits<typename Matrix::value_type>::real_type, double>{});
}
static void init_hypre(std::false_type) {}
static void init_hypre(std::true_type)
{
#if AMDIS_HAS_HYPRE && HAVE_MPI
auto pc_hypre = new typename HyprePrecon<Traits>::Creator; auto pc_hypre = new typename HyprePrecon<Traits>::Creator;
Map::addCreator("hypre", pc_hypre); Map::addCreator("hypre", pc_hypre);
#endif #endif
Map::addCreator("default", pc_id);
} }
}; };
......
#pragma once #pragma once
#if MTL_HAS_HYPRE && HAVE_MPI #if AMDIS_HAS_HYPRE && HAVE_MPI
#include <mpi.h> #include <mpi.h>
#include <HYPRE.h> #include <HYPRE.h>
...@@ -255,4 +255,4 @@ namespace mtl ...@@ -255,4 +255,4 @@ namespace mtl
} // end namespace mtl } // end namespace mtl
#endif // MTL_HAS_HYPRE #endif // AMDIS_HAS_HYPRE && HAVE_MPI
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <amdis/linearalgebra/DOFMapping.hpp> #include <amdis/linearalgebra/DOFMapping.hpp>
#if HAVE_PETSC #if AMDIS_HAS_PETSC
#include <petscvec.h> #include <petscvec.h>
#endif #endif
...@@ -118,7 +118,7 @@ int main(int argc, char** argv) ...@@ -118,7 +118,7 @@ int main(int argc, char** argv)
} }
} }
#if HAVE_PETSC #if AMDIS_HAS_PETSC
Vec v; Vec v;
VecCreateMPI(comm, mapping.localSize(), mapping.globalSize(), &v); VecCreateMPI(comm, mapping.localSize(), mapping.globalSize(), &v);
VecSet(v,0.0); VecSet(v,0.0);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <dune/istl/multitypeblockvector.hh> #include <dune/istl/multitypeblockvector.hh>
#include <dune/istl/multitypeblockmatrix.hh> #include <dune/istl/multitypeblockmatrix.hh>
#if HAVE_EIGEN #if AMDIS_HAS_EIGEN
#include <Eigen/Dense> #include <Eigen/Dense>
#endif #endif
...@@ -47,7 +47,7 @@ int main(int argc, char** argv) ...@@ -47,7 +47,7 @@ int main(int argc, char** argv)
static_assert(static_num_rows_v<Mat2> == 2, ""); static_assert(static_num_rows_v<Mat2> == 2, "");
static_assert(static_num_cols_v<Mat2> == 2, ""); static_assert(static_num_cols_v<Mat2> == 2, "");
#if HAVE_EIGEN #if AMDIS_HAS_EIGEN
using Vec6 = Eigen::Vector2d; using Vec6 = Eigen::Vector2d;
using Vec7 = Eigen::Matrix<double,2,1>; using Vec7 = Eigen::Matrix<double,2,1>;
using Vec8 = Eigen::Matrix<double,1,2>; using Vec8 = Eigen::Matrix<double,1,2>;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment