Commit d01698cc authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

cmake have package rename

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