Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
54d43006
Commit
54d43006
authored
Dec 28, 2019
by
Praetorius, Simon
Browse files
Merge branch 'issue/cmake_have_package_rename' into 'master'
cmake have package rename See merge request
!139
parents
e71c2200
d01698cc
Changes
12
Hide whitespace changes
Inline
Side-by-side
cmake/modules/AmdisMacros.cmake
View file @
54d43006
...
...
@@ -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"
)
...
...
cmake/modules/FindHYPRE.cmake
View file @
54d43006
...
...
@@ -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_LIBRAR
Y
REQUIRED_VARS HYPRE_INCLUDE_DIR HYPRE_LIBRAR
IES
)
# text for feature summary
...
...
config.h.cmake
View file @
54d43006
...
...
@@ -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
...
...
doc/doxygen/Doxylocal
View file @
54d43006
...
...
@@ -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
...
...
src/amdis/LinearAlgebra.hpp
View file @
54d43006
#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>
...
...
src/amdis/common/StaticSize.hpp
View file @
54d43006
...
...
@@ -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
>
)
...
...
src/amdis/linearalgebra/Traits.hpp
View file @
54d43006
#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
...
...
src/amdis/linearalgebra/mtl/HyprePrecon.hpp
View file @
54d43006
#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
src/amdis/linearalgebra/mtl/ITL_Preconditioner.hpp
View file @
54d43006
...
...
@@ -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
);
}
};
...
...
src/amdis/linearalgebra/mtl/itl/hypre.hpp
View file @
54d43006
#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
test/DOFMappingTest.cpp
View file @
54d43006
...
...
@@ -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
);
...
...
test/StaticSizeTest.cpp
View file @
54d43006
...
...
@@ -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
>
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment