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

AMDiS on Windows with VS and MinGW

parent eb7dd2a3
This diff is collapsed.
if (ENABLE_BDDCML)
SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML")
find_file(BDDCML_H bddcml_interface_c.h
HINTS ENV CPATH
DOC "Header bddcml_interface_c.h for the BDDCML library.")
if(BDDCML_H)
get_filename_component(BDDCML_PATH ${BDDCML_H} PATH)
include_directories(${BDDCML_PATH})
list(APPEND COMPILEFLAGS "-DHAVE_BDDC_ML=1")
list(APPEND COMPILEFLAGS "-DAdd_")
else()
message(FATAL_ERROR "Could not find BDDCML headers.")
endif()
find_library(BDDCML_LIB bddcml
HINTS ENV LIBRARY_PATH
DOC "BDDCML library")
if(BDDCML_LIB)
list(APPEND AMDIS_LIBS ${BDDCML_LIB})
else()
message(FATAL_ERROR "Could not find the BDDCML library")
endif()
find_file(BLOPEX_PATH blopex
HINTS ENV CPATH
DOC "Path to BLOPEX library.")
endif (ENABLE_BDDCML)
# enable the c++11 features. From cmake version 3.0 this is simply done by setting
# the cxx_standard variables. For older cmake version the compile-flags must be added manually.
if (ENABLE_CXX11)
list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
if (${CMAKE_VERSION} VERSION_GREATER "3.0")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(GXX_MIN_VER "4.8")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GXX_MIN_VER)
message (FATAL_ERROR "For C++11-Features the G++ Compiler must be at least version $GXX_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=gnu++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CLANG_MIN_VER "3.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Clang Compiler must be at least version $CLANG_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(INTEL_MIN_VER "12.1")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS INTEL_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Intel C++ Compiler must be at least version $INTEL_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(MSVC_MIN_VER "12.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_MIN_VER)
message (FATAL_ERROR "For C++11-Features the MSVC C++ Compiler must be at least version $MSVC_MIN_VER")
endif ()
endif ()
endif()
else ()
list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
endif (ENABLE_CXX11)
if (ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
find_path(EXTENSIONS_DIR NAMES Helpers.h
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../extensions
DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/base_problems/BaseProblem.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the 'Helpers.h' and the subdirectory 'base_problems'")
else()
SET(EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/SingularDirichletBC2.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
if(ENABLE_SEQ_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif(ENABLE_SEQ_PETSC)
if(ENABLE_PARALLEL_DOMAIN)
list(APPEND EXTENSIONS_SRC
# ${EXTENSIONS_DIR}/preconditioner/PetscSolverNavierStokes2.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
endif(ENABLE_PARALLEL_DOMAIN)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR})
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/nanoflann)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/pugixml/src)
if(WIN32)
add_library(extensions STATIC ${EXTENSIONS_SRC})
else()
add_library(extensions SHARED ${EXTENSIONS_SRC})
endif()
list(APPEND AMDIS_LIBS extensions)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
list(APPEND deb_add_dirs "include/amdis/extensions")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
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")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/nanoflann/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/nanoflann/)
list(APPEND deb_add_dirs "include/amdis/extensions/nanoflann")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/pugixml/)
list(APPEND deb_add_dirs "include/amdis/extensions/pugixml")
install(TARGETS extensions
DESTINATION lib/amdis/ )
# === baseProblems ====================================================================
if(ENABLE_BASE_PROBLEMS)
SET(BASE_PROBLEMS_SRC
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc
${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc
# ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
)
list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
if(WIN32)
add_library(base_problems STATIC ${BASE_PROBLEMS_SRC})
else()
add_library(base_problems SHARED ${BASE_PROBLEMS_SRC})
endif()
list(APPEND AMDIS_LIBS base_problems)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
list(APPEND deb_add_dirs "include/amdis/base_problems")
install(TARGETS base_problems
DESTINATION lib/amdis/ )
endif(ENABLE_BASE_PROBLEMS)
endif()
endif()
endif (ENABLE_EXTENSIONS)
if (ENABLE_HYPRE)
include(cmake/HYPREConfig.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_OPENMP)
if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
list(APPEND COMPILEFLAGS "-openmp")
else()
list(APPEND COMPILEFLAGS "-fopenmp")
endif()
endif (ENABLE_OPENMP)
if (ENABLE_PARALLEL_DOMAIN)
option(USE_PETSC_DEV false)
mark_as_advanced(USE_PETSC_DEV)
option(ENABLE_ZOLTAN false)
### Search for MPI compiler and get compile flags and include paths. ###
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
endif(MPI_FOUND)
### Search for ParMetis ###
find_file(PARMETIS_HEADER_FILE "parmetis.h" PATH ENV CPATH)
if(PARMETIS_HEADER_FILE)
get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE)
include_directories(${PARMETIS_INCLUDE_PATH})
else()
message(FATAL_ERROR "Could not find ParMetis header file!")
endif(PARMETIS_HEADER_FILE)
# find_file(PARMETIS_LIB_FILE "libparmetis.a" PATH ENV LIBRARY_PATH)
# if(PARMETIS_LIB_FILE)
# get_filename_component(PARMETIS_LINK_PATH "${PARMETIS_LIB_FILE}" PATH CACHE)
# link_directories(${PARMETIS_LINK_PATH})
# else()
# message(FATAL_ERROR "Could not find ParMetis library file!")
# endif(PARMETIS_LIB_FILE)
### Search for Zoltan ###
if(ENABLE_ZOLTAN)
find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" PATH ENV CPATH)
if(ZOLTAN_HEADER_FILE)
get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
include_directories(${ZOLTAN_HEADER_DIR})
else()
message(FATAL_ERROR "Could not find Zoltan include file!")
endif(ZOLTAN_HEADER_FILE)
list(APPEND COMPILEFLAGS "-DHAVE_ZOLTAN")
endif(ENABLE_ZOLTAN)
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/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/MeshPartitioner.cc
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
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 COMPILEFLAGS "-DHAVE_PARALLEL_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
${SOURCE_DIR}/parallel/PetscHelper.cc
${SOURCE_DIR}/parallel/PetscSolver.cc
${SOURCE_DIR}/parallel/PetscSolverFeti.cc
${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
${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}/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/PMTL_ProblemStat.cc
# )
list(APPEND AMDIS_LIBS ${MTL_LIBRARIES})
else()
message(SEND_ERROR "Set the domain-decomposition version correctly.")
endif()
INSTALL(FILES ResolveCompilerPaths.cmake FindPackageMultipass.cmake FindPETSc.cmake
DESTINATION share/amdis/)
if(USE_PETSC_DEV)
list(APPEND COMPILEFLAGS "-DHAVE_PETSC_DEV")
endif( USE_PETSC_DEV)
endif(ENABLE_PARALLEL_DOMAIN)
if (ENABLE_PNG)
find_file(PNG_H png.h
HINTS ENV CPATH /usr/include
DOC "headerfile png.h for PNG-READER")
if(PNG_H)
get_filename_component(PNG_PATH ${PNG_H} PATH)
include_directories(${PNG_PATH})
list(APPEND COMPILEFLAGS "-DHAVE_PNG=1")
else()
message(FATAL_ERROR "Could not find the PNG header png.h.")
endif()
endif (ENABLE_PNG)
if (ENABLE_SEQ_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_SEQ_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND AMDIS_SRC
${SOURCE_DIR}/solver/PetscSolver.cc
${SOURCE_DIR}/solver/PetscTypes.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_UMFPACK)
if (WIN32)
set(SuiteSparse_USE_LAPACK_BLAS ON)
endif (WIN32)
find_package(SuiteSparse)
if (SuiteSparse_FOUND)
include(${USE_SuiteSparse})
list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK")
else (SuiteSparse_FOUND)
find_file(UMFPACK_H umfpack.h
HINTS ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse
DOC "headerfile umfpack.h for UMFPACK")
if(UMFPACK_H)
get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
include_directories(${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH})
list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK")
else()
message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
endif()
endif (SuiteSparse_FOUND)
SET(RPM_DEPEND_STR "blas")
endif (ENABLE_UMFPACK)
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* 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
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -25,7 +25,11 @@
#ifndef AMDIS_H
#define AMDIS_H
#include "stdint.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#include <stdint.h>
#include "MTL4Types.h"
#include "AbstractFunction.h"
#include "AdaptInfo.h"
......
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* 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
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -24,9 +24,6 @@
namespace AMDiS {
using namespace std;
using namespace AMDiS;
bool Cholesky::factorization(Matrix<double> *A, Vector<double> *p)
{
FUNCNAME("Cholesky::factorization()");
......
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* 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
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -29,9 +29,6 @@
namespace AMDiS {
using namespace std;
using namespace AMDiS;
/**
* \ingroup Solvers
*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* 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
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -80,10 +80,10 @@ namespace AMDiS {
elinfo = elInfo;
double err = 0.0;
const double *u_vec;
u_vec = quadFast->getQuadrature()->fAtQp(errU, NULL);
errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec);
for (int i = 0; i < nPoints; i++) {
err = u_vec[i] > uh_vec[i] ? u_vec[i] - uh_vec[i] : uh_vec[i] - u_vec[i];
maxErr = std::max(maxErr, err);
......@@ -127,8 +127,8 @@ namespace AMDiS {
int degree = deg ? deg : 2 * fe_space->getBasisFcts()->getDegree() - 2;
q = Quadrature::provideQuadrature(dim, degree);
quadFast = FastQuadrature::provideFastQuadrature(basFct,
*q,
quadFast = FastQuadrature::provideFastQuadrature(basFct,
*q,
INIT_GRD_PHI);
double relative = relErr;
......@@ -139,7 +139,7 @@ namespace AMDiS {
ElInfo *elInfo = stack.traverseFirst(fe_space->getMesh(), -1,
Mesh::FILL_COORDS |
Mesh::CALL_LEAF_EL |
Mesh::FILL_DET |
Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA);
while (elInfo) {
elinfo = elInfo;
......@@ -147,14 +147,14 @@ namespace AMDiS {
double err, err_2, h1_err_el, norm_el, norm2, det, exact;
const WorldVector<double> *grdu_vec;
mtl::dense_vector<WorldVector<double> > grduh_vec;
grdu_vec = quadFast->getQuadrature()->grdFAtQp(grdErrU, NULL);
det = elInfo->getDet();
errUh->getGrdAtQPs(elinfo, NULL, quadFast, grduh_vec);
int nPoints = quadFast->getNumPoints();
int dow = Global::getGeo(WORLD);
for (h1_err_el = i = 0; i < nPoints; i++) {
for (err_2 = j = 0; j < dow; j++) {
err = grdu_vec[i][j] - grduh_vec[i][j];
......@@ -162,17 +162,17 @@ namespace AMDiS {
}
h1_err_el += quadFast->getWeight(i)*err_2;
}
exact = det*h1_err_el;
h1Err2 += exact;
maxErr = std::max(maxErr, exact);
if (writeInLeafData)
elInfo->getElement()->setEstimation(exact, component);
if (relative) {
for (norm_el = i = 0; i < nPoints; i++) {
for (norm2 = j = 0; j < dow; j++)
for (norm2 = j = 0; j < dow; j++)
norm2 += sqr(grdu_vec[i][j]);
norm_el += quadFast->getWeight(i)*norm2;
}
......@@ -223,7 +223,7 @@ namespace AMDiS {
ERROR("no function u specified; doing nothing\n");
return(0.0);
}
if (!(errUh = &uh) || !(fe_space = uh.getFeSpace())) {
ERROR("no discrete function or no fe_space for it; doing nothing\n");
return(0.0);
......@@ -240,7 +240,7 @@ namespace AMDiS {
q = Quadrature::provideQuadrature(dim, degree);
quadFast = FastQuadrature::provideFastQuadrature(basFct, *q, INIT_PHI);
double relative = relErr;
double maxErr = 0.0, l2Err2 = 0.0, l2Norm2 = 0.0;
double *u_vec = new double[quadFast->getQuadrature()->getNumPoints()];
......@@ -251,28 +251,28 @@ namespace AMDiS {
ElInfo *elInfo = stack.traverseFirst(fe_space->getMesh(), -1,
Mesh::FILL_COORDS |
Mesh::CALL_LEAF_EL |
Mesh::FILL_DET |
Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA);
while (elInfo) {
elinfo = elInfo;
quadFast->getQuadrature()->fAtQp(errU, u_vec);
errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec);
double det = elInfo->getDet();
double det = elInfo->getDet();
double l2_err_el = 0.0, err = 0.0;
for (int i = 0; i < nPoints; i++) {
err = u_vec[i] - uh_vec[i];
l2_err_el += quadFast->getWeight(i) * sqr(err);
}
double exact = det * l2_err_el;
l2Err2 += exact;
maxErr = std::max(maxErr, exact);
if (writeInLeafData)
elInfo->getElement()->setEstimation(exact, component);
if (relative) {
double norm_el = 0.0;
for (int i = 0; i < nPoints; i++)
......@@ -299,17 +299,17 @@ namespace AMDiS {
l2Err2 /= relNorm2;
}
if (max)
if (max)
*max = maxErr;
return (sqrt(l2Err2));
return std::sqrt(l2Err2);
}
template<typename T>
double Error<T>::L2Err_ElementWise(const AbstractFunction<T, WorldVector<double> >& u,
const DOFVector<T>& uh,
double* max,
bool writeLeafData,
bool writeLeafData,
int comp,
int level,
std::map<int, double>& estMap)
......@@ -325,7 +325,7 @@ namespace AMDiS {
ERROR("no function u specified; doing nothing\n");
return(0.0);
}
if (!(errUh = &uh) || !(fe_space = uh.getFeSpace())) {
ERROR("no discrete function or no fe_space for it; doing nothing\n");
return(0.0);
......@@ -342,7 +342,7 @@ namespace AMDiS {
q = Quadrature::provideQuadrature(dim, degree);
quadFast = FastQuadrature::provideFastQuadrature(basFct, *q, INIT_PHI);
double maxErr = 0.0, l2Err2 = 0.0;
double *u_vec = new double[quadFast->getQuadrature()->getNumPoints()];
int nPoints = quadFast->getNumPoints();
......@@ -362,10 +362,10 @@ namespace AMDiS {
while (elInfo) {
elinfo = elInfo;
quadFast->getQuadrature()->fAtQp(errU, u_vec);
errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec);
double det = elInfo->getDet();
double det = elInfo->getDet();
double l2_err_el = 0.0;
double int_u_vec = 0.0;
......@@ -381,10 +381,10 @@ namespace AMDiS {
l2_err_el = pow(fabs(det * int_u_vec - det * int_uh_vec), 2.0);
l2Err2 += l2_err_el;
maxErr = std::max(maxErr, l2_err_el);
if (writeInLeafData)
elInfo->getElement()->setEstimation(l2_err_el, component);
estMap[elInfo->getElement()->getIndex()] = l2_err_el;
elInfo = stack.traverseNext(elInfo);
......@@ -394,7 +394,7 @@ namespace AMDiS {
delete [] u_vec;
if (max)