Commit 35be3393 authored by Naumann, Andreas's avatar Naumann, Andreas
Browse files

pmtl implemententation. test works

parent fc0aac05
...@@ -61,6 +61,9 @@ set(AMDiS_NEED_UMFPACK @ENABLE_UMFPACK@) ...@@ -61,6 +61,9 @@ set(AMDiS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDiS_NEED_MKL @ENABLE_MKL@) set(AMDiS_NEED_MKL @ENABLE_MKL@)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDiSUse.cmake) set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDiSUse.cmake)
set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@") set(AMDiS_COMPILEFLAGS "@COMPILEFLAGS@")
set(AMDIS_VERSION @CurrentRevision@)
set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
if(AMDiS_NEED_UMFPACK) if(AMDiS_NEED_UMFPACK)
#look for umfpack, we need the headers only #look for umfpack, we need the headers only
......
...@@ -12,13 +12,19 @@ if(AMDiS_HAS_PARALLEL_DOMAIN) ...@@ -12,13 +12,19 @@ if(AMDiS_HAS_PARALLEL_DOMAIN)
list(APPEND AMDiS_COMPILEFLAGS ${MPI_COMPILE_FLAGS}) list(APPEND AMDiS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
endif(MPI_FOUND) endif(MPI_FOUND)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR}) if(AMDiS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC")
set(PETSC_EXECUTABLE_RUNS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR})
find_package(PETSc REQUIRED) set(PETSC_EXECUTABLE_RUNS ON)
if(PETSC_FOUND) find_package(PETSc REQUIRED)
if(PETSC_FOUND)
list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES}) list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES})
list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES}) 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(NOT AMDiS_NEED_PARMETIS)
endif(AMDiS_HAS_PARALLEL_DOMAIN) endif(AMDiS_HAS_PARALLEL_DOMAIN)
#thats bad because it affects each target #thats bad because it affects each target
......
project(AMDiS) project(AMDiS)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
#if revision is not set, let cmake look for the svn-version
#needs: --enable-debug, enable-intel --enable-openmp --enable-parmetis --enable-parallel-domain --enable-umfpack --enable-mkl --enable-boost --enable-marmot 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(LIB_DIR ${AMDiS_SOURCE_DIR}/lib)
SET(SOURCE_DIR ${AMDiS_SOURCE_DIR}/src) SET(SOURCE_DIR ${AMDiS_SOURCE_DIR}/src)
#TODO: use the cmake build type #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_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -Wall -DDEBUG=0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG=1 -O0") 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 #define the build type, empty can be everything and nothing
if(CMAKE_BUILD_TYPE STREQUAL "") if(CMAKE_BUILD_TYPE STREQUAL "")
...@@ -19,13 +33,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "") ...@@ -19,13 +33,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
endif() endif()
#option(ENABLE_INTEL "use intel compiler" false) #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) option(USE_PETSC_DEV false)
#parmetis is not optional #parmetis is not optional
set(ENABLE_PARMETIS false) set(ENABLE_PARMETIS false)
option(ENABLE_ZOLTAN false) option(ENABLE_ZOLTAN false)
option(ENABLE_UMFPACK "use umfpack solver" false) option(ENABLE_UMFPACK "use umfpack solver" false)
option(ENABLE_TESTS "compile the tests" false)
if(ENABLE_INTEL) if(ENABLE_INTEL)
Message("please set the icc manually") Message("please set the icc manually")
...@@ -37,14 +50,16 @@ endif(ENABLE_INTEL) ...@@ -37,14 +50,16 @@ endif(ENABLE_INTEL)
find_package(Boost 1.42 REQUIRED) find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND) 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("boost lib-dirs: ${Boost_LIBRARY_DIRS}")
message("use the boost dir: ${Boost_INCLUDE_DIR}") message("use the boost dir: ${Boost_INCLUDE_DIR}")
if(WIN32) if(WIN32)
message("the windows find_boost does not set the boost library paths, please set it") 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") SET(Boost_LIBRARY_DIRS CACHE PATH "The directory containing the boost libraries")
endif(WIN32) endif(WIN32)
link_directories(${Boost_LIBRARY_DIRS}) list(APPEND AMDiS_LINK_DIRS ${Boost_LIBRARY_DIRS})
# link_directories(${Boost_LIBRARY_DIRS})
endif(Boost_FOUND) endif(Boost_FOUND)
SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
...@@ -120,6 +135,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc ...@@ -120,6 +135,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/SecondOrderTerm.cc ${SOURCE_DIR}/SecondOrderTerm.cc
${SOURCE_DIR}/Serializer.cc ${SOURCE_DIR}/Serializer.cc
${SOURCE_DIR}/StandardProblemIteration.cc ${SOURCE_DIR}/StandardProblemIteration.cc
${SOURCE_DIR}/SolverMatrix.cc
${SOURCE_DIR}/SubAssembler.cc ${SOURCE_DIR}/SubAssembler.cc
${SOURCE_DIR}/SubElInfo.cc ${SOURCE_DIR}/SubElInfo.cc
${SOURCE_DIR}/SubQuadrature.cc ${SOURCE_DIR}/SubQuadrature.cc
...@@ -154,10 +170,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc ...@@ -154,10 +170,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
if(ENABLE_PARALLEL_DOMAIN) if(ENABLE_PARALLEL_DOMAIN)
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
if(MPI_FOUND) if(MPI_FOUND)
#INCLUDE (CMakeForceCompiler) list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
#CMAKE_FORCE_C_COMPILER(mpicc "MPI C compiler")
#CMAKE_FORCE_CXX_COMPILER(mpiCC "MPI C++ compiler")
list(APPEND AMDiS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
include_directories(${MPI_INCLUDE_PATH}) include_directories(${MPI_INCLUDE_PATH})
endif(MPI_FOUND) endif(MPI_FOUND)
...@@ -165,7 +178,10 @@ if(ENABLE_PARALLEL_DOMAIN) ...@@ -165,7 +178,10 @@ if(ENABLE_PARALLEL_DOMAIN)
make make
WORKING_DIRECTORY ${LIB_DIR}/ParMetis-3.1 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 INSTALL(FILES ${LIB_DIR}/ParMetis-3.1/parmetis.h
${LIB_DIR}/ParMetis-3.1/libparmetis.a ${LIB_DIR}/ParMetis-3.1/libparmetis.a
${LIB_DIR}/ParMetis-3.1/libmetis.a ${LIB_DIR}/ParMetis-3.1/libmetis.a
...@@ -180,14 +196,12 @@ if(ENABLE_PARALLEL_DOMAIN) ...@@ -180,14 +196,12 @@ if(ENABLE_PARALLEL_DOMAIN)
else() else()
message( FATAL_ERROR "could not find zoltan.") message( FATAL_ERROR "could not find zoltan.")
endif( ZOLTAN_HEADER_FILE ) endif( ZOLTAN_HEADER_FILE )
set(COMPILEFLAGS "${COMPILEFLAGS} -DHAVE_ZOLTAN") list(APPEND COMPILEFLAGS "-DHAVE_ZOLTAN")
endif(ENABLE_ZOLTAN) endif(ENABLE_ZOLTAN)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};/usr/share/cmake-2.8/Modules/;${CMAKE_SOURCE_DIR}/") list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
set(PETSC_EXECUTABLE_RUNS ON)
find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
SET(PARALLEL_DOMAIN_AMDIS_SRC SET(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc ${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectData.cc ${SOURCE_DIR}/parallel/ElementObjectData.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc ${SOURCE_DIR}/parallel/MeshDistributor.cc
...@@ -197,22 +211,41 @@ if(ENABLE_PARALLEL_DOMAIN) ...@@ -197,22 +211,41 @@ if(ENABLE_PARALLEL_DOMAIN)
${SOURCE_DIR}/parallel/ParallelDebug.cc ${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelProblemStatBase.cc ${SOURCE_DIR}/parallel/ParallelProblemStatBase.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.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/StdMpi.cc
${SOURCE_DIR}/parallel/ZoltanPartitioner.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 INSTALL(FILES ResolveCompilerPaths.cmake FindPackageMultipass.cmake FindPETSc.cmake
DESTINATION share/amdis/) DESTINATION share/amdis/)
if( USE_PETSC_DEV ) if( USE_PETSC_DEV )
SET(COMPILEFLAGS "${COMPILEFLAGS} -DHAVE_PETSC_DEV") list(APPEND COMPILEFLAGS "-DHAVE_PETSC_DEV")
endif( USE_PETSC_DEV) endif( USE_PETSC_DEV)
endif(ENABLE_PARALLEL_DOMAIN) endif(ENABLE_PARALLEL_DOMAIN)
if(ENABLE_UMFPACK) if(ENABLE_UMFPACK)
# include_directories(${LIB_DIR}/UFconfig ${LIB_DIR}/AMD/Include ${LIB_DIR}/UMFPACK/Include) # include_directories(${LIB_DIR}/UFconfig ${LIB_DIR}/AMD/Include ${LIB_DIR}/UMFPACK/Include)
# FILE(GLOB UMFPACK_HEADERS "${LIB_DIR}/UMFPACK/Include/*.h") # FILE(GLOB UMFPACK_HEADERS "${LIB_DIR}/UMFPACK/Include/*.h")
# INSTALL(FILES ${UMFPACK_HEADERS} # INSTALL(FILES ${UMFPACK_HEADERS}
...@@ -281,7 +314,7 @@ if(ENABLE_UMFPACK) ...@@ -281,7 +314,7 @@ if(ENABLE_UMFPACK)
#add the compileflags and directories #add the compileflags and directories
include_directories(${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH}) 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() else()
message(FATAL_ERROR "Could not find the umfpack-headers. Please install umfpack") message(FATAL_ERROR "Could not find the umfpack-headers. Please install umfpack")
endif() endif()
...@@ -304,20 +337,25 @@ file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc) ...@@ -304,20 +337,25 @@ file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
include_directories(${REINIT_SOURCE_DIR}) include_directories(${REINIT_SOURCE_DIR})
#mtl4 includes #mtl4 includes
include_directories(${MTL_DIR}) list(APPEND AMDiS_INCLUDE_DIRS ${MTL_INCLUDE_DIR})
include_directories(${SOURCE_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(amdis SHARED ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC})
add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC}) add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC})
add_library(reinit STATIC ${REINIT_SRC}) add_library(reinit STATIC ${REINIT_SRC})
target_link_libraries(compositeFEM amdis) target_link_libraries(compositeFEM amdis)
list(APPEND AMDiS_LIBS amdis ${Boost_LIBRARIES})
if(WIN32) 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) endif(WIN32)
message("compileflags: ${COMPILEFLAGS}") message("compileflags: ${COMPILEFLAGS}")
#SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}") #SET_TARGET_PROPERTIES(amdis PROPERTIES COMPILE_FLAGS "${COMPILEFLAGS}")
add_definitions(${COMPILEFLAGS}) add_definitions(${COMPILEFLAGS})
if(ENABLE_MARMOT) if(ENABLE_MARMOT)
Message("please set marmotcc manually") Message("please set marmotcc manually")
endif(ENABLE_MARMOT) endif(ENABLE_MARMOT)
...@@ -391,15 +429,6 @@ endforeach(mtl4_file) ...@@ -391,15 +429,6 @@ endforeach(mtl4_file)
list(REMOVE_DUPLICATES deb_add_dirs) list(REMOVE_DUPLICATES deb_add_dirs)
#PACKAGES #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_NAME "AMDiS")
set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de") set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de")
set(CPACK_PACKAGE_VERSION "${CurrentRevision}") set(CPACK_PACKAGE_VERSION "${CurrentRevision}")
...@@ -418,7 +447,3 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.42), libboost-iostreams-dev ...@@ -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") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${AMDiS_BINARY_DIR}/preinst" "${AMDiS_BINARY_DIR}/postrm")
include(CPack) include(CPack)
if(ENABLE_TESTS)
ENABLE_TESTING()
add_subdirectory(test)
endif(ENABLE_TESTS)
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#ifndef AMDIS_H #ifndef AMDIS_H
#define AMDIS_H #define AMDIS_H
#include "stdint.h"
#include "MTL4Types.h"
#include "AbstractFunction.h" #include "AbstractFunction.h"
#include "AdaptInfo.h" #include "AdaptInfo.h"
#include "AdaptInstationary.h" #include "AdaptInstationary.h"
......
...@@ -53,7 +53,6 @@ namespace AMDiS { ...@@ -53,7 +53,6 @@ namespace AMDiS {
class Flag; class Flag;
class IdentityPreconditioner; class IdentityPreconditioner;
class InteriorBoundary; class InteriorBoundary;
class ITL_BasePreconditioner;
class LeafDataPeriodic; class LeafDataPeriodic;
class LevelAdmin; class LevelAdmin;
class Line; class Line;
...@@ -120,7 +119,7 @@ namespace AMDiS { ...@@ -120,7 +119,7 @@ namespace AMDiS {
template<typename T> class DimVec; template<typename T> class DimVec;
template<typename T> class DimMat; template<typename T> class DimMat;
template<typename ITLSolver> class ITL_OEMSolver; 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 Matrix;
template<typename T> class MatrixOfFixVecs; template<typename T> class MatrixOfFixVecs;
template<typename T> class MatVecMultiplier; template<typename T> class MatVecMultiplier;
......
#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 - 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
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "CreatorMap.h" #include "CreatorMap.h"
#include "MTL4Types.h"
#include "OEMSolver.h" #include "OEMSolver.h"
#include "ITL_Solver.h" #include "ITL_Solver.h"
#include "ITL_Preconditioner.h" #include "ITL_Preconditioner.h"
...@@ -74,9 +75,9 @@ namespace AMDiS { ...@@ -74,9 +75,9 @@ namespace AMDiS {
template<> template<>
void CreatorMap<ITL_BasePreconditioner>::addDefaultCreators() void CreatorMap<BasePreconditioner>::addDefaultCreators()
{ {
CreatorInterface<ITL_BasePreconditioner> *creator; PreconditionCreator *creator;
creator = new DiagonalPreconditioner::Creator; creator = new DiagonalPreconditioner::Creator;
addCreator("diag", creator); addCreator("diag", creator);
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
#endif #endif
/** \brief current AMDiS version */ /** \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 <string>
#include <vector> #include <vector>
......
...@@ -24,55 +24,36 @@ ...@@ -24,55 +24,36 @@
#ifndef AMDIS_ITL_OEM_SOLVER_H #ifndef AMDIS_ITL_OEM_SOLVER_H
#define AMDIS_ITL_OEM_SOLVER_H #define AMDIS_ITL_OEM_SOLVER_H
#include <iostream> #include "MTL4Solver.h"
#include "OEMSolver.h" #include "ITL_OEMSolver.hh"
#include "ITL_Preconditioner.h" #include "MTL4Types.h"
#include "SolverMatrix.h"
#include "DOFVector.h"
#include "SystemVector.h"
#include "DOFMatrix.h"
#include "Parameters.h"
#include <boost/numeric/itl/itl.hpp> #include <boost/numeric/itl/itl.hpp>
#include <boost/numeric/mtl/mtl.hpp> #include <boost/numeric/mtl/mtl.hpp>
namespace AMDiS { namespace AMDiS {
/** /**
* \ingroup Solver * \ingroup Solver
* *
*\brief *\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> template <typename ITLSolver>
class ITL_OEMSolver : public OEMSolver class ITL_OEMSolver : public MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_OEMSolver_runner< ITLSolver > > {
{
typedef ITL_Preconditioner<itl::pc::identity<DOFMatrix> > id_t;
public: protected:
public:
/// The constructor reads needed parameters and sets solvers \ref name. /// 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() {} ~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. /// Creator class used in the OEMSolverMap.
class Creator : public OEMSolverCreator class Creator : public OEMSolverCreator
{ {
...@@ -88,7 +69,6 @@ namespace AMDiS { ...@@ -88,7 +69,6 @@ namespace AMDiS {
}; };