Commit 47183212 authored by Praetorius, Simon's avatar Praetorius, Simon

merge of branch solver-preconditioner with trunk

parent 54f26135
......@@ -68,6 +68,8 @@ set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_OPENMP @ENABLE_OPENMP@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
set(AMDIS_NEED_PETSC @ENABLE_PETSC@)
set(AMDIS_NEED_PNG @ENABLE_PNG@)
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
set(AMDIS_NEED_MKL @ENABLE_MKL@)
......
......@@ -32,7 +32,42 @@ if(AMDIS_HAS_PARALLEL_DOMAIN)
message(FATAL_ERROR "could not find the metis libraries needed by amdis")
endif(METIS_LIB)
endif()
endif(AMDIS_HAS_PARALLEL_DOMAIN)
elseif(AMDIS_NEED_PETSC)
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
endif(MPI_FOUND)
set(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})
else()
message(FATAL_ERROR "Could not find PETSc!")
endif(PETSC_FOUND)
endif()
if(AMDIS_NEED_HYPRE)
find_package(HYPRE REQUIRED)
if(HAVE_HYPRE)
if(NOT MPI_FOUND)
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
endif()
endif()
list(APPEND AMDIS_INCLUDE_DIRS ${HYPRE_INCLUDE_DIRECTORIES})
list(APPEND AMDIS_COMPILEFLAGS "-DMTL_HAS_HYPRE")
list(APPEND AMDIS_LIBRARIES ${HYPRE_LIBRARIES} )
endif()
endif(AMDIS_NEED_HYPRE)
#thats bad because it affects each target
add_definitions(${AMDIS_COMPILEFLAGS})
......
......@@ -40,12 +40,14 @@ endif()
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(ENABLE_ZOLTAN false)
option(ENABLE_PETSC "Use sequential PETSc solvers" false)
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
option(ENABLE_PNG "use png reader/writer" false)
option(ENABLE_BDDCML "Use of BDDCML library" false)
option(ENABLE_EXTENSIONS "Use extensions" false)
option(ENABLE_OPENMP "Use OpenMP" false)
option(ENABLE_OUTPUT "AMDiS output priniting, disable only for debugging!" true)
option(ENABLE_OUTPUT "AMDiS output printing, disable only for debugging!" true)
mark_as_advanced(ENABLE_OUTPUT)
......@@ -80,7 +82,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/CoarseningManager2d.cc
${SOURCE_DIR}/CoarseningManager3d.cc
${SOURCE_DIR}/ComponentTraverseInfo.cc
${SOURCE_DIR}/CouplingIterationInterface.cc
${SOURCE_DIR}/CouplingIterationInterface.cc
${SOURCE_DIR}/CreatorMap.cc
${SOURCE_DIR}/DOFAdmin.cc
${SOURCE_DIR}/DOFIndexed.cc
......@@ -105,7 +107,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/Global.cc
${SOURCE_DIR}/GlobalDOFNumbering.cc
${SOURCE_DIR}/GlobalElementNumbering.cc
${SOURCE_DIR}/Initfile.cc
${SOURCE_DIR}/Initfile.cc
${SOURCE_DIR}/Lagrange.cc
${SOURCE_DIR}/LeafData.cc
${SOURCE_DIR}/Line.cc
......@@ -139,7 +141,6 @@ 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
......@@ -175,6 +176,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/io/VtkWriter.cc
${SOURCE_DIR}/io/VtkVectorWriter.cc
${SOURCE_DIR}/nonlin/ProblemNonLin.cc
${SOURCE_DIR}/solver/SolverMatrix.cc
${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
${SOURCE_DIR}/time/RosenbrockMethod.cc
${SOURCE_DIR}/time/RosenbrockStationary.cc
......@@ -230,11 +232,11 @@ if(ENABLE_PARALLEL_DOMAIN)
list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
SET(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/BddcMlSolver.cc
${SOURCE_DIR}/parallel/DofComm.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
${SOURCE_DIR}/parallel/InteriorBoundary.cc
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
......@@ -242,9 +244,10 @@ if(ENABLE_PARALLEL_DOMAIN)
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStatBase.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
......@@ -253,13 +256,13 @@ if(ENABLE_PARALLEL_DOMAIN)
set(PETSC_EXECUTABLE_RUNS ON)
find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_PETSC")
list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/BddcMlSolver.cc
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
${SOURCE_DIR}/parallel/PetscHelper.cc
${SOURCE_DIR}/parallel/PetscSolver.cc
${SOURCE_DIR}/parallel/PetscProblemStat.cc
${SOURCE_DIR}/parallel/PetscSolverFeti.cc
${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
......@@ -269,14 +272,17 @@ if(ENABLE_PARALLEL_DOMAIN)
${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc
${SOURCE_DIR}/parallel/PetscSolverSchur.cc)
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc
${SOURCE_DIR}/parallel/PetscSolverSchur.cc
${SOURCE_DIR}/solver/PetscTypes.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 PARALLEL_DOMAIN_AMDIS_SRC
# ${SOURCE_DIR}/parallel/PMTL_ProblemStat.cc
# )
list(APPEND AMDIS_LIBS ${MTL_LIBRARIES})
else()
message(SEND_ERROR "Set the domain-decomposition version correctly.")
......@@ -290,6 +296,24 @@ if(ENABLE_PARALLEL_DOMAIN)
endif(ENABLE_PARALLEL_DOMAIN)
if(ENABLE_PETSC)
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
endif(MPI_FOUND)
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 COMPILEFLAGS "-DHAVE_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND AMDIS_SRC
${SOURCE_DIR}/solver/PetscSolver.cc
${SOURCE_DIR}/solver/PetscTypes.cc)
endif(ENABLE_PETSC)
if(ENABLE_UMFPACK)
find_file(UMFPACK_H umfpack.h
......@@ -306,6 +330,24 @@ if(ENABLE_UMFPACK)
endif(ENABLE_UMFPACK)
if(ENABLE_HYPRE)
include(FindHYPRE.cmake)
message("have hypre: ${HAVE_HYPRE}")
if(HAVE_HYPRE)
if(NOT MPI_FOUND)
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
endif()
endif()
include_directories(${HYPRE_INCLUDE_DIRECTORIES})
list(APPEND COMPILEFLAGS "-DMTL_HAS_HYPRE")
list(APPEND MYLIBS ${HYPRE_LIBRARIES} )
endif()
endif(ENABLE_HYPRE)
if(ENABLE_PNG)
find_file(PNG_H png.h
HINTS ENV CPATH /usr/include
......@@ -374,6 +416,13 @@ if(ENABLE_EXTENSIONS)
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
if(ENABLE_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif(ENABLE_PETSC)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR})
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time)
......@@ -401,6 +450,13 @@ if(ENABLE_EXTENSIONS)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/preconditioner/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/preconditioner/)
list(APPEND deb_add_dirs "include/amdis/extensions/time")
......@@ -438,7 +494,7 @@ if(ENABLE_EXTENSIONS)
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Base.cc
# ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
# ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc)
list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
......@@ -562,10 +618,20 @@ INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/time/)
list(APPEND deb_add_dirs "include/amdis/time")
FILE(GLOB HEADERS "${SOURCE_DIR}/itl/*.hpp")
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/solver)
list(APPEND deb_add_dirs "include/amdis/solver")
FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/itl)
list(APPEND deb_add_dirs "include/amdis/itl")
DESTINATION include/amdis/solver/itl)
list(APPEND deb_add_dirs "include/amdis/solver/itl")
FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h")
INSTALL(FILES ${HEADERS}
......@@ -604,7 +670,10 @@ INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake
DESTINATION share/amdis/)
list(APPEND deb_add_dirs "share/amdis/")
INSTALL(FILES ${AMDIS_SOURCE_DIR}/AMDISUse.cmake
# INSTALL(FILES ${AMDIS_SOURCE_DIR}/AMDISUse.cmake
# DESTINATION share/amdis/)
FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/*.cmake")
INSTALL(FILES ${CMAKE_FILES}
DESTINATION share/amdis/)
#install mtl
......
find_file(HYPRE_H HYPRE.h)
find_library(HYPRE_LIB HYPRE)
if(HYPRE_H AND HYPRE_LIB)
set(HAVE_HYPRE ON)
find_package(MPI REQUIRED)
#append each library in the hypre_lib directory beginning with HYPRE to the list of hypre libraries
get_filename_component(HLIB_PATH ${HYPRE_LIB} PATH)
file(GLOB HYPRE_OTHER ${HLIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}HYPRE*${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LAPACK_LIB lapack)
set(HYPRE_LIBRARIES ${MPI_LIBRARIES} ${HYPRE_LIB} ${HYPRE_OTHER} ${LAPACK_LIB})
message("hypre libraries: ${HYPRE_LIBRARIES}")
get_filename_component(HYPRE_INCLUDE_DIRECTORIES ${HYPRE_H} PATH)
list(APPEND HYPRE_INCLUDE_DIRECTORIES ${MPI_CXX_INCLUDE_PATH})
else()
if(HAVE_HYPRE)
message("could not find hypre:")
message("library: ${HYPRE_LIB}")
message("header: ${HYPRE_H}")
endif()
set(HAVE_HYPRE FALSE)
endif()
......@@ -281,7 +281,7 @@ SUBGROUPING = YES
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
TYPEDEF_HIDES_STRUCT = YES
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
......@@ -591,12 +591,15 @@ WARN_LOGFILE =
# with spaces.
INPUT = ../src/ \
../src/io \
../src/compositeFEM \
../src/est \
../src/io \
../src/nonlin \
../src/parallel \
../src/reinit \
../src/solver \
../src/solver/itl \
../src/time \
../src/nonlin
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......@@ -613,7 +616,7 @@ INPUT_ENCODING = UTF-8
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.h
FILE_PATTERNS = *.h *.hpp
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
......@@ -1374,7 +1377,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED =
PREDEFINED = HAVE_PARALLEL_DOMAIN_AMDIS HAVE_PARALLEL_MTL4 HAVE_UMFPACK MTL_HAS_UMFPACK HAVE_PETSC
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
......
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
/******************************************************************************
*
* AMDiS - Adaptive multidimensional simulations
*
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
******************************************************************************/
#include "AMDiS.h"
......@@ -21,24 +30,28 @@ namespace AMDiS {
using namespace std;
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(HAVE_PARALLEL_MTL4)
#if defined(HAVE_PARALLEL_MTL4)
mtl::par::environment* mtl_environment = NULL;
#endif
void init(int argc, char **argv, std::string initFileName)
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_MTL4
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_PETSC)
#ifdef HAVE_PARALLEL_MTL4
mtl_environment = new mtl::par::environment(argc, argv);
#else
#else
PetscInitialize(&argc, &argv, NULL, NULL);
mpi::startRand();
#endif
#ifdef HAVE_ZOLTAN
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS)
Parallel::mpi::startRand();
#else
srand(time(NULL));
#endif
#endif