Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
iwr
amdis
Commits
35be3393
Commit
35be3393
authored
May 15, 2011
by
Naumann, Andreas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pmtl implemententation. test works
parent
fc0aac05
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1351 additions
and
318 deletions
+1351
-318
AMDiS/AMDiSConfig.cmake.in
AMDiS/AMDiSConfig.cmake.in
+3
-0
AMDiS/AMDiSUse.cmake
AMDiS/AMDiSUse.cmake
+11
-5
AMDiS/CMakeLists.txt
AMDiS/CMakeLists.txt
+67
-42
AMDiS/src/AMDiS.h
AMDiS/src/AMDiS.h
+2
-0
AMDiS/src/AMDiS_fwd.h
AMDiS/src/AMDiS_fwd.h
+1
-2
AMDiS/src/BasePreconditioner.h
AMDiS/src/BasePreconditioner.h
+46
-0
AMDiS/src/Collection.h
AMDiS/src/Collection.h
+41
-0
AMDiS/src/CreatorMap.cc
AMDiS/src/CreatorMap.cc
+3
-2
AMDiS/src/Global.h
AMDiS/src/Global.h
+3
-1
AMDiS/src/ITL_OEMSolver.h
AMDiS/src/ITL_OEMSolver.h
+16
-55
AMDiS/src/ITL_OEMSolver.hh
AMDiS/src/ITL_OEMSolver.hh
+107
-0
AMDiS/src/ITL_Preconditioner.h
AMDiS/src/ITL_Preconditioner.h
+34
-39
AMDiS/src/ITL_Solver.h
AMDiS/src/ITL_Solver.h
+1
-3
AMDiS/src/MTL4Solver.h
AMDiS/src/MTL4Solver.h
+79
-0
AMDiS/src/MTL4Types.h
AMDiS/src/MTL4Types.h
+12
-0
AMDiS/src/Mapper.h
AMDiS/src/Mapper.h
+78
-0
AMDiS/src/MatrixStreams.h
AMDiS/src/MatrixStreams.h
+141
-0
AMDiS/src/OEMSolver.h
AMDiS/src/OEMSolver.h
+94
-76
AMDiS/src/ProblemStat.cc
AMDiS/src/ProblemStat.cc
+2
-2
AMDiS/src/SolverMatrix.cc
AMDiS/src/SolverMatrix.cc
+15
-0
AMDiS/src/SolverMatrix.h
AMDiS/src/SolverMatrix.h
+17
-29
AMDiS/src/UmfPackSolver.h
AMDiS/src/UmfPackSolver.h
+64
-48
AMDiS/src/parallel/Mtl4Solver.cc
AMDiS/src/parallel/Mtl4Solver.cc
+133
-0
AMDiS/src/parallel/Mtl4Solver.h
AMDiS/src/parallel/Mtl4Solver.h
+21
-14
AMDiS/src/parallel/PITL_Solver.h
AMDiS/src/parallel/PITL_Solver.h
+318
-0
AMDiS/src/parallel/ParallelMapper.h
AMDiS/src/parallel/ParallelMapper.h
+42
-0
No files found.
AMDiS/AMDiSConfig.cmake.in
View file @
35be3393
...
...
@@ -61,6 +61,9 @@ set(AMDiS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDiS_NEED_MKL @ENABLE_MKL@)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDiSUse.cmake)
set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@")
set(AMDIS_VERSION @CurrentRevision@)
set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
if(AMDiS_NEED_UMFPACK)
#look for umfpack, we need the headers only
...
...
AMDiS/AMDiSUse.cmake
View file @
35be3393
...
...
@@ -12,13 +12,19 @@ if(AMDiS_HAS_PARALLEL_DOMAIN)
list
(
APPEND AMDiS_COMPILEFLAGS
${
MPI_COMPILE_FLAGS
}
)
list
(
APPEND AMDIS_INCLUDE_DIRS
${
MPI_INCLUDE_PATH
}
)
endif
(
MPI_FOUND
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
AMDIS_DIR
}
)
set
(
PETSC_EXECUTABLE_RUNS ON
)
find_package
(
PETSc REQUIRED
)
if
(
PETSC_FOUND
)
if
(
AMDiS_HAS_PARALLEL_DOMAIN STREQUAL
"PETSC"
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
AMDIS_DIR
}
)
set
(
PETSC_EXECUTABLE_RUNS ON
)
find_package
(
PETSc REQUIRED
)
if
(
PETSC_FOUND
)
list
(
APPEND AMDIS_LIBRARIES
${
PETSC_LIBRARY_SYS
}
${
PETSC_LIBRARIES
}
)
list
(
APPEND AMDIS_INCLUDE_DIRS
${
PETSC_INCLUDES
}
)
endif
(
PETSC_FOUND
)
endif
(
PETSc_FOUND
)
elseif
(
AMDiS_HAS_PARALLEL_DOMAIN STREQUAL
"PMTL"
)
find_package
(
MTL REQUIRED
)
list
(
APPEND AMDIS_LIBRARIES
${
MTL_LIBRARIES
}
)
# set(AMDiS_COMPILEFLAGS "${AMDIS_COMPILEFLAGS} -DMTL_HAS_MPI -DHAVE_PARALLEL_MTL4")
endif
()
endif
(
NOT AMDiS_NEED_PARMETIS
)
endif
(
AMDiS_HAS_PARALLEL_DOMAIN
)
#thats bad because it affects each target
...
...
AMDiS/CMakeLists.txt
View file @
35be3393
project
(
AMDiS
)
cmake_minimum_required
(
VERSION 2.6
)
#needs: --enable-debug, enable-intel --enable-openmp --enable-parmetis --enable-parallel-domain --enable-umfpack --enable-mkl --enable-boost --enable-marmot
#if revision is not set, let cmake look for the svn-version
if
(
NOT CurrentRevision
)
find_package
(
Subversion
)
if
(
Subversion_FOUND
)
Subversion_WC_INFO
(
${
AMDiS_SOURCE_DIR
}
mtlSubinfo
)
set
(
CurrentRevision
"0.9
${
mtlSubinfo_WC_REVISION
}
"
)
# message("current revision: ${mtlSubinfo_WC_REVISION}")
endif
(
Subversion_FOUND
)
endif
(
NOT CurrentRevision
)
#split the current revision in MAJOR.MINOR
string
(
REGEX MATCH
"([0-9]+).([0-9]+)"
AMDIS_MAJOR
"
${
CurrentRevision
}
"
)
set
(
AMDIS_MINOR
${
CMAKE_MATCH_2
}
)
set
(
AMDIS_MAJOR
${
CMAKE_MATCH_1
}
)
message
(
"major:
${
AMDIS_MAJOR
}
"
)
message
(
"minor:
${
AMDIS_MINOR
}
"
)
SET
(
LIB_DIR
${
AMDiS_SOURCE_DIR
}
/lib
)
SET
(
SOURCE_DIR
${
AMDiS_SOURCE_DIR
}
/src
)
#TODO: use the cmake build type
SET
(
MTL_DIR
${
LIB_DIR
}
/mtl4/ CACHE PATH
"mtl4 directory"
)
SET
(
MTL_
INCLUDE_
DIR
${
LIB_DIR
}
/mtl4/ CACHE PATH
"mtl4 directory"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
-g -Wall -DDEBUG=0"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
-Wall -DDEBUG=1 -O0"
)
set
(
COMPILEFLAGS
"-DAMDIS_VERSION=
${
CurrentRevision
}
"
)
#define the build type, empty can be everything and nothing
if
(
CMAKE_BUILD_TYPE STREQUAL
""
)
...
...
@@ -19,13 +33,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
endif
()
#option(ENABLE_INTEL "use intel compiler" false)
option
(
ENABLE_PARALLEL_DOMAIN
"use parallel domain decomposition"
false
)
SET
(
ENABLE_PARALLEL_DOMAIN
"OFF"
CACHE STRING
"use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF"
)
option
(
USE_PETSC_DEV false
)
#parmetis is not optional
set
(
ENABLE_PARMETIS false
)
option
(
ENABLE_ZOLTAN false
)
option
(
ENABLE_UMFPACK
"use umfpack solver"
false
)
option
(
ENABLE_TESTS
"compile the tests"
false
)
if
(
ENABLE_INTEL
)
Message
(
"please set the icc manually"
)
...
...
@@ -37,14 +50,16 @@ endif(ENABLE_INTEL)
find_package
(
Boost 1.42 REQUIRED
)
if
(
Boost_FOUND
)
include_directories
(
${
Boost_INCLUDE_DIR
}
)
# include_directories(${Boost_INCLUDE_DIR})
list
(
APPEND AMDiS_INCLUDE_DIRS
${
Boost_INCLUDE_DIR
}
)
message
(
"boost lib-dirs:
${
Boost_LIBRARY_DIRS
}
"
)
message
(
"use the boost dir:
${
Boost_INCLUDE_DIR
}
"
)
if
(
WIN32
)
message
(
"the windows find_boost does not set the boost library paths, please set it"
)
SET
(
Boost_LIBRARY_DIRS CACHE PATH
"The directory containing the boost libraries"
)
endif
(
WIN32
)
link_directories
(
${
Boost_LIBRARY_DIRS
}
)
endif
(
WIN32
)
list
(
APPEND AMDiS_LINK_DIRS
${
Boost_LIBRARY_DIRS
}
)
# link_directories(${Boost_LIBRARY_DIRS})
endif
(
Boost_FOUND
)
SET
(
AMDIS_SRC
${
SOURCE_DIR
}
/AdaptBase.cc
...
...
@@ -120,6 +135,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${
SOURCE_DIR
}
/SecondOrderTerm.cc
${
SOURCE_DIR
}
/Serializer.cc
${
SOURCE_DIR
}
/StandardProblemIteration.cc
${
SOURCE_DIR
}
/SolverMatrix.cc
${
SOURCE_DIR
}
/SubAssembler.cc
${
SOURCE_DIR
}
/SubElInfo.cc
${
SOURCE_DIR
}
/SubQuadrature.cc
...
...
@@ -154,10 +170,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
if
(
ENABLE_PARALLEL_DOMAIN
)
find_package
(
MPI REQUIRED
)
if
(
MPI_FOUND
)
#INCLUDE (CMakeForceCompiler)
#CMAKE_FORCE_C_COMPILER(mpicc "MPI C compiler")
#CMAKE_FORCE_CXX_COMPILER(mpiCC "MPI C++ compiler")
list
(
APPEND AMDiS_COMPILEFLAGS
${
MPI_COMPILE_FLAGS
}
)
list
(
APPEND COMPILEFLAGS
"
${
MPI_COMPILE_FLAGS
}
"
)
include_directories
(
${
MPI_INCLUDE_PATH
}
)
endif
(
MPI_FOUND
)
...
...
@@ -165,7 +178,10 @@ if(ENABLE_PARALLEL_DOMAIN)
make
WORKING_DIRECTORY
${
LIB_DIR
}
/ParMetis-3.1
)
include_directories
(
${
LIB_DIR
}
/ParMetis-3.1
)
#include_directories( ${LIB_DIR}/ParMetis-3.1)
list
(
APPEND AMDiS_INCLUDE_DIRS
${
LIB_DIR
}
/ParMetis-3.1
)
list
(
APPEND AMDiS_LIBS
${
LIB_DIR
}
/ParMetis-3.1/libparmetis.a
${
LIB_DIR
}
/ParMetis-3.1/libmetis.a
)
# list(APPEND AMDiS_LINK_DIRS ${LIB_DIR}/ParMetis-3.1/)
INSTALL
(
FILES
${
LIB_DIR
}
/ParMetis-3.1/parmetis.h
${
LIB_DIR
}
/ParMetis-3.1/libparmetis.a
${
LIB_DIR
}
/ParMetis-3.1/libmetis.a
...
...
@@ -180,14 +196,12 @@ if(ENABLE_PARALLEL_DOMAIN)
else
()
message
(
FATAL_ERROR
"could not find zoltan."
)
endif
(
ZOLTAN_HEADER_FILE
)
set
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_ZOLTAN"
)
list
(
APPEND COMPILEFLAGS
"
-DHAVE_ZOLTAN"
)
endif
(
ENABLE_ZOLTAN
)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_MODULE_PATH
}
;/usr/share/cmake-2.8/Modules/;
${
CMAKE_SOURCE_DIR
}
/"
)
set
(
PETSC_EXECUTABLE_RUNS ON
)
find_package
(
PETSc REQUIRED
)
include_directories
(
${
PETSC_DIR
}
/include
${
PETSC_DIR
}
/
${
PETSC_ARCH
}
/include
)
list
(
APPEND COMPILEFLAGS
"-DHAVE_PARALLEL_DOMAIN_AMDIS=1"
)
SET
(
PARALLEL_DOMAIN_AMDIS_SRC
${
SOURCE_DIR
}
/parallel/ParMetisPartitioner.cc
${
SOURCE_DIR
}
/parallel/CheckerPartitioner.cc
${
SOURCE_DIR
}
/parallel/ElementObjectData.cc
${
SOURCE_DIR
}
/parallel/MeshDistributor.cc
...
...
@@ -197,22 +211,41 @@ if(ENABLE_PARALLEL_DOMAIN)
${
SOURCE_DIR
}
/parallel/ParallelDebug.cc
${
SOURCE_DIR
}
/parallel/ParallelProblemStatBase.cc
${
SOURCE_DIR
}
/parallel/ParMetisPartitioner.cc
${
SOURCE_DIR
}
/parallel/PetscProblemStat.cc
${
SOURCE_DIR
}
/parallel/PetscSolver.cc
${
SOURCE_DIR
}
/parallel/PetscSolverFeti.cc
${
SOURCE_DIR
}
/parallel/PetscSolverGlobalMatrix.cc
${
SOURCE_DIR
}
/parallel/PetscSolverSchur.cc
${
SOURCE_DIR
}
/parallel/StdMpi.cc
${
SOURCE_DIR
}
/parallel/ZoltanPartitioner.cc
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_PARALLEL_DOMAIN_AMDIS=1"
)
if
(
ENABLE_PARALLEL_DOMAIN STREQUAL
"PETSC"
)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_MODULE_PATH
}
;/usr/share/cmake-2.8/Modules/;
${
CMAKE_SOURCE_DIR
}
/"
)
set
(
PETSC_EXECUTABLE_RUNS ON
)
find_package
(
PETSc REQUIRED
)
include_directories
(
${
PETSC_DIR
}
/include
${
PETSC_DIR
}
/
${
PETSC_ARCH
}
/include
)
list
(
APPEND AMDiS_INCLUDE_DIRS
${
PETSC_DIR
}
/include
${
PETSC_DIR
}
/
${
PETSC_ARCH
}
/include
)
list
(
APPEND PARALLEL_DOMAIN_AMDIS_SRC
${
SOURCE_DIR
}
/parallel/PetscSolver.cc
${
SOURCE_DIR
}
/parallel/PetscProblemStat.cc
${
SOURCE_DIR
}
/parallel/PetscSolverFeti.cc
${
SOURCE_DIR
}
/parallel/PetscSolverGlobalMatrix.cc
${
SOURCE_DIR
}
/parallel/PetscSolverSchur.cc
)
elseif
(
ENABLE_PARALLEL_DOMAIN STREQUAL
"PMTL"
)
set
(
MTL_INCLUDE_DIR
""
)
find_package
(
MTL REQUIRED
)
list
(
APPEND COMPILEFLAGS
"-DMTL_HAS_MPI"
"-DHAVE_PARALLEL_MTL4"
)
list
(
APPEND PARALLEL_DOMAIN_AMDIS_SRC
${
SOURCE_DIR
}
/parallel/Mtl4Solver.cc
)
list
(
APPEND AMDiS_LIBS
${
MTL_LIBRARIES
}
)
#message("using the parallel mtl4 version")
else
()
message
(
SEND_ERROR
"please set the domain-decomposition version correctly"
)
endif
()
INSTALL
(
FILES ResolveCompilerPaths.cmake FindPackageMultipass.cmake FindPETSc.cmake
DESTINATION share/amdis/
)
if
(
USE_PETSC_DEV
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_PETSC_DEV"
)
list
(
APPEND COMPILEFLAGS
"
-DHAVE_PETSC_DEV"
)
endif
(
USE_PETSC_DEV
)
endif
(
ENABLE_PARALLEL_DOMAIN
)
if
(
ENABLE_UMFPACK
)
# include_directories(${LIB_DIR}/UFconfig ${LIB_DIR}/AMD/Include ${LIB_DIR}/UMFPACK/Include)
# FILE(GLOB UMFPACK_HEADERS "${LIB_DIR}/UMFPACK/Include/*.h")
# INSTALL(FILES ${UMFPACK_HEADERS}
...
...
@@ -281,7 +314,7 @@ if(ENABLE_UMFPACK)
#add the compileflags and directories
include_directories
(
${
UMFPACK_PATH
}
${
UFCONFIG_PATH
}
${
AMD_PATH
}
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-DHAVE_UMFPACK=1
-DMTL_HAS_UMFPACK"
)
list
(
APPEND COMPILEFLAGS
"-DHAVE_UMFPACK=1"
"
-DMTL_HAS_UMFPACK"
)
else
()
message
(
FATAL_ERROR
"Could not find the umfpack-headers. Please install umfpack"
)
endif
()
...
...
@@ -304,20 +337,25 @@ file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
include_directories
(
${
REINIT_SOURCE_DIR
}
)
#mtl4 includes
include_directories
(
${
MTL_DIR
}
)
include_directories
(
${
SOURCE_DIR
}
)
list
(
APPEND AMDiS_INCLUDE_DIRS
${
MTL_INCLUDE_DIR
}
)
#include_directories(${MTL_INCLUDE_DIR})
list
(
APPEND AMDiS_INCLUDE_DIRS
${
SOURCE_DIR
}
)
#include_directories(${SOURCE_DIR})
include_directories
(
${
AMDiS_INCLUDE_DIRS
}
)
add_library
(
amdis SHARED
${
AMDIS_SRC
}
${
PARALLEL_DOMAIN_AMDIS_SRC
}
)
add_library
(
compositeFEM SHARED
${
COMPOSITE_FEM_SRC
}
)
add_library
(
reinit STATIC
${
REINIT_SRC
}
)
target_link_libraries
(
compositeFEM amdis
)
list
(
APPEND AMDiS_LIBS amdis
${
Boost_LIBRARIES
}
)
if
(
WIN32
)
SET
(
COMPILEFLAGS
"
${
COMPILEFLAGS
}
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS"
)
list
(
APPEND COMPILEFLAGS
"-D_SCL_SECURE_NO_WARNINGS"
"
-D_CRT_SECURE_NO_WARNINGS"
)
endif
(
WIN32
)
message
(
"compileflags:
${
COMPILEFLAGS
}
"
)
#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}")
add_definitions
(
${
COMPILEFLAGS
}
)
if
(
ENABLE_MARMOT
)
Message
(
"please set marmotcc manually"
)
endif
(
ENABLE_MARMOT
)
...
...
@@ -391,15 +429,6 @@ endforeach(mtl4_file)
list
(
REMOVE_DUPLICATES deb_add_dirs
)
#PACKAGES
#let cmake look for the svn-version
if
(
NOT CurrentRevision
)
find_package
(
Subversion
)
if
(
Subversion_FOUND
)
Subversion_WC_INFO
(
${
AMDiS_SOURCE_DIR
}
mtlSubinfo
)
set
(
CurrentRevision
"0.9.
${
mtlSubinfo_WC_REVISION
}
"
)
# message("current revision: ${mtlSubinfo_WC_REVISION}")
endif
(
Subversion_FOUND
)
endif
(
NOT CurrentRevision
)
set
(
CPACK_PACKAGE_NAME
"AMDiS"
)
set
(
CPACK_PACKAGE_CONTACT
"Andreas.Naumann@tu-dresden.de"
)
set
(
CPACK_PACKAGE_VERSION
"
${
CurrentRevision
}
"
)
...
...
@@ -418,7 +447,3 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.42), libboost-iostreams-dev
set
(
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"
${
AMDiS_BINARY_DIR
}
/preinst"
"
${
AMDiS_BINARY_DIR
}
/postrm"
)
include
(
CPack
)
if
(
ENABLE_TESTS
)
ENABLE_TESTING
()
add_subdirectory
(
test
)
endif
(
ENABLE_TESTS
)
AMDiS/src/AMDiS.h
View file @
35be3393
...
...
@@ -23,6 +23,8 @@
#ifndef AMDIS_H
#define AMDIS_H
#include "stdint.h"
#include "MTL4Types.h"
#include "AbstractFunction.h"
#include "AdaptInfo.h"
#include "AdaptInstationary.h"
...
...
AMDiS/src/AMDiS_fwd.h
View file @
35be3393
...
...
@@ -53,7 +53,6 @@ namespace AMDiS {
class
Flag
;
class
IdentityPreconditioner
;
class
InteriorBoundary
;
class
ITL_BasePreconditioner
;
class
LeafDataPeriodic
;
class
LevelAdmin
;
class
Line
;
...
...
@@ -120,7 +119,7 @@ namespace AMDiS {
template
<
typename
T
>
class
DimVec
;
template
<
typename
T
>
class
DimMat
;
template
<
typename
ITLSolver
>
class
ITL_OEMSolver
;
template
<
typename
T
>
class
ITL_Preconditioner
;
template
<
typename
T
,
typename
Vec
,
typename
Mat
>
class
ITL_Preconditioner
;
template
<
typename
T
>
class
Matrix
;
template
<
typename
T
>
class
MatrixOfFixVecs
;
template
<
typename
T
>
class
MatVecMultiplier
;
...
...
AMDiS/src/BasePreconditioner.h
0 → 100644
View file @
35be3393
#ifndef BASEPRECONDITIONER_H
#define BASEPRECONDITIONER_H
#include <stdexcept>
#include "CreatorInterface.h"
#include "ITL_Preconditioner.h"
#include "Collection.h"
namespace
AMDiS
{
template
<
typename
Vector
>
struct
CreatorInterface
<
ITL_BasePreconditioner
<
Vector
>
>
{
typedef
typename
AMDiS
::
Collection
<
Vector
>::
PreconditionMatrix
PreconditionMatrix
;
virtual
ITL_BasePreconditioner
<
Vector
>*
create
(
const
PreconditionMatrix
&
)
=
0
/*{ return NULL; }*/
;
};
template
<
typename
Vector
>
class
NullCreator
<
ITL_BasePreconditioner
<
Vector
>
>
:
public
CreatorInterface
<
ITL_BasePreconditioner
<
Vector
>
>
{
typedef
typename
AMDiS
::
Collection
<
Vector
>::
PreconditionMatrix
PreconditionMatrix
;
typedef
ITL_BasePreconditioner
<
Vector
>
BaseClass
;
/// Creates no object.
BaseClass
*
create
()
{
TEST_EXIT
(
false
)(
"should never class this function"
);
return
NULL
;
}
BaseClass
*
create
(
const
PreconditionMatrix
&
)
{
TEST_EXIT
(
false
)(
"this is the wrong null creator
\n
"
);
return
NULL
;
}
///
virtual
bool
isNullCreator
()
{
return
true
;
}
};
typedef
CreatorInterface
<
ITL_BasePreconditioner
<
MTLTypes
::
MTLVector
>
>
PreconditionCreator
;
typedef
ITL_BasePreconditioner
<
MTLTypes
::
MTLVector
>
BasePreconditioner
;
}
#endif
AMDiS/src/Collection.h
0 → 100644
View file @
35be3393
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut für Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
#ifndef AMDIS_COLLECTION_H
#define AMDIS_COLLECTION_H
#include "MTL4Types.h"
namespace
AMDiS
{
template
<
typename
T
>
struct
Collection
{};
using
namespace
MTLTypes
;
template
<
>
struct
Collection
<
MTLMatrix
>
{
typedef
mtl
::
matrix
::
inserter
<
MTLMatrix
>
Inserter
;
};
template
<
>
struct
Collection
<
MTLVector
>
{
typedef
mtl
::
vector
::
inserter
<
MTLVector
>
Inserter
;
typedef
MTLMatrix
PreconditionMatrix
;
};
}
#endif
AMDiS/src/CreatorMap.cc
View file @
35be3393
...
...
@@ -11,6 +11,7 @@
#include "CreatorMap.h"
#include "MTL4Types.h"
#include "OEMSolver.h"
#include "ITL_Solver.h"
#include "ITL_Preconditioner.h"
...
...
@@ -74,9 +75,9 @@ namespace AMDiS {
template
<
>
void
CreatorMap
<
ITL_
BasePreconditioner
>::
addDefaultCreators
()
void
CreatorMap
<
BasePreconditioner
>::
addDefaultCreators
()
{
CreatorInterface
<
ITL_BasePreconditioner
>
*
creator
;
PreconditionCreator
*
creator
;
creator
=
new
DiagonalPreconditioner
::
Creator
;
addCreator
(
"diag"
,
creator
);
...
...
AMDiS/src/Global.h
View file @
35be3393
...
...
@@ -37,7 +37,9 @@
#endif
/** \brief current AMDiS version */
#define AMDIS_VERSION "AMDiS: Version 0.100"
#ifndef AMDIS_VERSION
#define AMDIS_VERSION "AMDiS: Version 0.9.1"
#endif
#include <string>
#include <vector>
...
...
AMDiS/src/ITL_OEMSolver.h
View file @
35be3393
...
...
@@ -24,55 +24,36 @@
#ifndef AMDIS_ITL_OEM_SOLVER_H
#define AMDIS_ITL_OEM_SOLVER_H
#include <iostream>
#include "OEMSolver.h"
#include "ITL_Preconditioner.h"
#include "SolverMatrix.h"
#include "DOFVector.h"
#include "SystemVector.h"
#include "DOFMatrix.h"
#include "Parameters.h"
#include "MTL4Solver.h"
#include "ITL_OEMSolver.hh"
#include "MTL4Types.h"
#include <boost/numeric/itl/itl.hpp>
#include <boost/numeric/mtl/mtl.hpp>
namespace
AMDiS
{
/**
* \ingroup Solver
*
*\brief
* Template for using solvers from ITL in AMDiS.
* Template for using solvers from ITL in AMDiS.
* Uses a previous definition of MTLMatrix and MTLVector.
* Additional template generalization of ITL_OEMSolver destroys class hierarchy
*/
template
<
typename
ITLSolver
>
class
ITL_OEMSolver
:
public
OEMSolver
{
typedef
ITL_Preconditioner
<
itl
::
pc
::
identity
<
DOFMatrix
>
>
id_t
;
class
ITL_OEMSolver
:
public
MTL4Solver
<
MTLTypes
::
MTLMatrix
,
MTLTypes
::
MTLVector
,
ITL_OEMSolver_runner
<
ITLSolver
>
>
{
public:
protected:
public:
/// The constructor reads needed parameters and sets solvers \ref name.
ITL_OEMSolver
(
std
::
string
name
)
:
OEMSolver
(
name
)
{}
ITL_OEMSolver
(
std
::
string
name
)
:
MTL4Solver
<
MTLTypes
::
MTLMatrix
,
MTLTypes
::
MTLVector
,
ITL_OEMSolver_runner
<
ITLSolver
>
>
(
name
)
{}
~
ITL_OEMSolver
()
{}
/// Solves the system iteratively
// This function is virtual because derived class calls solver with parameter
virtual
int
solveSystem
(
const
DOFMatrix
::
base_matrix_type
&
A
,
mtl
::
dense_vector
<
value_type
>&
x
,
const
mtl
::
dense_vector
<
value_type
>&
b
)
{
itl
::
cyclic_iteration
<
value_type
>
iter
(
b
,
this
->
max_iter
,
this
->
relative
,
this
->
tolerance
,
this
->
print_cycle
);
error
=
ITLSolver
()(
A
,
x
,
b
,
*
this
->
leftPrecon
,
*
this
->
rightPrecon
,
iter
);
iterations
=
iter
.
iterations
();
residual
=
iter
.
resid
();
return
error
;
}
/// Creator class used in the OEMSolverMap.
class
Creator
:
public
OEMSolverCreator
{
...
...
@@ -88,7 +69,6 @@ namespace AMDiS {
};
/**
* \ingroup Solver
*
...
...
@@ -97,34 +77,19 @@ namespace AMDiS {
*/
template
<
typename
ITLSolver
>
class
ITL_OEMSolver_para
:
public
OEMSolver
// ITL_OEMSolver<ITLSolver>
:
public
MTL4Solver
<
MTLMatrix
,
MTLVector
,
ITL_OEMSolver_para_runner
<
ITLSolver
>
>
// ITL_OEMSolver<ITLSolver>
{
typedef
DOFMatrix
::
value_type
value_type
;
public:
/// The constructor reads needed parameters and sets solvers \ref name.
ITL_OEMSolver_para
(
std
::
string
name
)
:
OEMSolver
(
name
),
ell
(
OEMSolver
::
max_iter
)
:
MTL4Solver
<
MTLMatrix
,
MTLVector
,
ITL_OEMSolver_para_runner
<
ITLSolver
>
>
(
name
)
{
Parameters
::
get
(
name
+
"->ell"
,
ell
);
}
~
ITL_OEMSolver_para
()
{}
/// Set parameter of iterative solver
void
setEll
(
int
p
)
{
ell
=
p
;
}
/// Solves the system iteratively
int
solveSystem
(
const
DOFMatrix
::
base_matrix_type
&
A
,
mtl
::
dense_vector
<
value_type
>&
x
,
const
mtl
::
dense_vector
<
value_type
>&
b
)
{
itl
::
cyclic_iteration
<
value_type
>
iter
(
b
,
this
->
max_iter
,
this
->
relative
,
this
->
tolerance
,
this
->
print_cycle
);
error
=
ITLSolver
()(
A
,
x
,
b
,
*
this
->
leftPrecon
,
*
this
->
rightPrecon
,
iter
,
ell
);
iterations
=
iter
.
iterations
();
residual
=
iter
.
resid
();
return
error
;
}
class
Creator
:
public
OEMSolverCreator
{
...
...
@@ -139,11 +104,7 @@ namespace AMDiS {
};
private:
/// parameter for bicgstab_ell iterative solver
int
ell
;
};
}
// namespace AMDiS
#endif // AMDIS_ITL_OEM_SOLVER_H
AMDiS/src/ITL_OEMSolver.hh
0 → 100644
View file @
35be3393
#include "ITL_Preconditioner.h"
namespace
AMDiS
{
template
<
typename
Vector
>
struct
PreconPair
{
/// Pointer to the left preconditioner
ITL_BasePreconditioner
<
Vector
>*
l
;
/// Pointer to the right preconditioner
ITL_BasePreconditioner
<
Vector
>*
r
;
PreconPair
()
:
l
(
NULL
),
r
(
NULL
)
{}
};
struct
BaseITL_runner
{
OEMSolver
&
oem
;
BaseITL_runner
(
OEMSolver
*
oemPtr
)
:
oem
(
*
oemPtr
)
{
TEST_EXIT
(
oemPtr
!=
NULL
)(
"need a real oemsolver
\n
"
);
}
template
<
typename
Vector
,
typename
Matrix
>
void
setPrecon
(
PreconPair
<
Vector
>&
pair
,
const
Matrix
&
matrix
)
{
/// Creator for the left preconditioner
CreatorInterface
<
ITL_BasePreconditioner
<
Vector
>
>*
leftCreator
(
NULL
);
/// Creator for the right preconditioner
CreatorInterface
<
ITL_BasePreconditioner
<
Vector
>
>*
rightCreator
(
NULL
);
std
::
string
preconType
(
"no"
);
Parameters
::
get
(
oem
.
getName
()
+
"->left precon"
,
preconType
);
leftCreator
=
CreatorMap
<
ITL_BasePreconditioner
<
Vector
>
>::
getCreator
(
preconType
);
TEST_EXIT
(
leftCreator
!=
NULL
)
(
"there is no creator for the given left preconditioner"
);
preconType
=
"no"
;
Parameters
::
get
(
oem
.
getName
()
+
"->right precon"
,
preconType
);
rightCreator
=
CreatorMap
<
ITL_BasePreconditioner
<
Vector
>
>::
getCreator
(
preconType
);
TEST_EXIT
(
rightCreator
!=
NULL
)
(
"there is no creator for the given right preconditioner"
);
pair
.
l
=
leftCreator
->
create
(
matrix
);
pair
.
r
=
rightCreator
->
create
(
matrix
);
}
};
template
<
typename
ITLSolver
>
struct
ITL_OEMSolver_para_runner
:
BaseITL_runner
{
ITL_OEMSolver_para_runner
(
OEMSolver
*
oem_
)
:
BaseITL_runner
(
oem_
),
ell
(
1
)
{
ell
=
oem
.
getMaxIterations
();
Parameters
::
get
(
oem
.
getName
()
+
"->ell"
,
ell
);
}
template
<
typename
Matrix
,
typename
Vector
>
int
solve
(
const
Matrix
&
A
,
Vector
&
x
,
Vector
&
b
)
{
itl
::
cyclic_iteration
<
typename
Matrix
::
value_type
>
iter
(
b
,
oem
.
getMaxIterations
(),
oem
.
getRelative
(),
oem
.
getTolerance
(),
oem
.
getPrint_cycle
());
static
PreconPair
<
Vector
>
preconPair
;
if
(
preconPair
.
l
==
NULL
||
preconPair
.
r
==
NULL
||
!
oem
.
getMultipleRhs
())
BaseITL_runner
::
setPrecon
(
preconPair
,
A
);
int
error
=
ITLSolver
()(
A
,
x
,
b
,
*
(
preconPair
.
l
),
*
(
preconPair
.
r
),
iter
,
ell
);
oem
.
setIterations
(
iter
.
iterations
());
oem
.
setResidual
(
iter
.
resid
());
oem
.
setErrorCode
(
error
);
return
error
;
}
private:
int
ell
;
};
template
<
typename
ITLSolver
>
struct
ITL_OEMSolver_runner
:
BaseITL_runner
{
ITL_OEMSolver_runner
(
OEMSolver
*
oem
)
:
BaseITL_runner
(
oem
)
{}
template
<
typename
Matrix
,
typename
Vector
>
int
solve
(
const
Matrix
&
A
,
Vector
&
x
,
Vector
&
b
)
{
itl
::
cyclic_iteration
<
typename
Matrix
::
value_type
>
iter
(
b
,
oem
.
getMaxIterations
(),
oem
.
getRelative
(),
oem
.
getTolerance
(),
oem
.
getPrint_cycle
());
static
PreconPair
<
Vector
>
preconPair
;
if
(
preconPair
.
l
==
NULL
||
preconPair
.
r
==
NULL
||
!
oem
.
getMultipleRhs
())
BaseITL_runner
::
setPrecon
(
preconPair
,
A
);
int
error
=
ITLSolver
()(
A
,
x
,
b
,
*
(
preconPair
.
l
),
*
(
preconPair
.
r
),
iter
);
oem
.
setErrorCode
(
error
);
oem
.
setIterations
(
iter
.
iterations
());
oem
.
setResidual
(
iter
.
resid
());