Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konto der externen Nutzer:innen sind über den Reiter "Standard" erreichbar. Die Administratoren

Dear Gitlab user, it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab. The administrators

Commit f148869d authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

small errors corrected

parent 52296030
......@@ -96,6 +96,7 @@ list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_OPENMP @ENABLE_OPENMP@)
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@)
......@@ -114,6 +115,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
endif()
if (AMDIS_NEED_CXX11)
list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=1" "-std=c++11")
else ()
list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0")
endif (AMDIS_NEED_CXX11)
#load mpi-compiler for use with parmetis and parallel_domain
if(AMDIS_HAS_PARALLEL_DOMAIN)
find_package(MPI REQUIRED)
......
......@@ -44,6 +44,7 @@ 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_CXX11 "Enable C++11 compiler features" false)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
......@@ -201,7 +202,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/time/RosenbrockMethod.cc
${SOURCE_DIR}/time/RosenbrockStationary.cc
)
if(ENABLE_PARALLEL_DOMAIN)
### Search for MPI compiler and get compile flags and include paths. ###
......@@ -621,6 +622,18 @@ if(WIN32)
endif(WIN32)
if (ENABLE_CXX11)
list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
set_property(TARGET "amdis" PROPERTY CXX_STANDARD 11)
set_property(TARGET "compositeFEM" PROPERTY CXX_STANDARD 11)
set_property(TARGET "reinit" PROPERTY CXX_STANDARD 11)
set_property(TARGET "muparser" PROPERTY CXX_STANDARD 11)
else ()
list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
endif (ENABLE_CXX11)
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
......
......@@ -62,6 +62,7 @@
#include "Element.h"
#include "ElementDofIterator.h"
#include "Error.h"
#include "Expressions.h"
#include "FiniteElemSpace.h"
#include "FirstOrderTerm.h"
#include "FixVec.h"
......
......@@ -30,6 +30,8 @@
#include <list>
#include "AMDiS_fwd.h"
#include "ProblemStat.h"
#include "CoarseningManager.h"
#include "RefinementManager.h"
#include "Initfile.h"
#include "utility/to_string.hpp"
......@@ -67,7 +69,6 @@ namespace AMDiS {
virtual void addProblem(ProblemStatType* prob)
{
problems.push_back(prob);
nComponents += prob->getNumComponents();
};
/// Initialisation of the problem.
......
......@@ -43,6 +43,8 @@ private:
T1 val;
};
typedef Const<double, WorldVector<double> > Constant;
template<typename T=double>
struct Factor : public AbstractFunction<T,T>
{
......
......@@ -74,10 +74,10 @@ namespace AMDiS {
FUNCNAME("Msg::change_out()");
if (fp) {
if (out && *out != std::cout && *out != std::cerr) {
dynamic_cast< std::ofstream*>(out)->close();
delete out;
}
// if (out && *out != std::cout && *out != std::cerr) {
// dynamic_cast< std::ofstream*>(out)->close();
// delete out;
// }
out = fp;
} else {
......@@ -92,10 +92,10 @@ namespace AMDiS {
FUNCNAME("Msg::change_error_out()");
if (fp) {
if (error && *error != std::cout && *error != std::cerr) {
dynamic_cast< std::ofstream*>(error)->close();
delete error;
}
// if (error && *error != std::cout && *error != std::cerr) {
// dynamic_cast< std::ofstream*>(error)->close();
// delete error;
// }
error = fp;
} else {
......@@ -111,10 +111,10 @@ namespace AMDiS {
std::ofstream *fp;
if (filename && (fp = new std::ofstream(filename, type))) {
if (error && *error != std::cout && *error != std::cerr) {
dynamic_cast< std::ofstream*>(error)->close();
delete error;
}
// if (error && *error != std::cout && *error != std::cerr) {
// dynamic_cast< std::ofstream*>(error)->close();
// delete error;
// }
error = fp;
} else {
......
......@@ -142,6 +142,12 @@ namespace AMDiS {
void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool assembleMatrix = true,
bool assembleVector = true) override;
/// assemble all operators of matrix and vector side
void assemble(AdaptInfo* adaptInfo)
{
buildAfterCoarsen(adaptInfo, 0, true, true);
}
bool dualMeshTraverseRequired();
......
......@@ -343,7 +343,7 @@ namespace AMDiS {
int size = x->getNumVectors();
for (int i = 0; i < size; i++)
result += x->getDOFVector(i)->squareNrm2();
return sqrt(result);
return std::sqrt(result);
}
/// L2 norm of system vector.
......@@ -353,7 +353,7 @@ namespace AMDiS {
int size = x->getNumVectors();
for (int i = 0; i < size; i++)
result += x->getDOFVector(i)->L2NormSquare();
return sqrt(result);
return std::sqrt(result);
}
/// H1 norm of system vector.
......@@ -363,7 +363,7 @@ namespace AMDiS {
int size = x->getNumVectors();
for (int i = 0; i < size; i++)
result += x->getDOFVector(i)->H1NormSquare();
return sqrt(result);
return std::sqrt(result);
}
inline void mv(const Matrix<DOFMatrix*> &matrix,
......
......@@ -48,7 +48,9 @@ typedef size_t aligned_size_t __attribute__ ((aligned(CACHE_LINE)));
// C++11 features
// --------------
#if __cplusplus > 199711L
#define HAS_CXX11 1
#ifndef HAS_CXX11
#define HAS_CXX11 1
#endif
// __has_feature(cxx_rvalue_references)
#if CLANG_VERSION >= 20900 && !defined(HAS_VARIADIC_TEMPLATES)
......
......@@ -48,7 +48,9 @@ typedef size_t aligned_size_t __attribute__ ((aligned(CACHE_LINE)));
// C++11 features
// --------------
#if __cplusplus > 199711L
#define HAS_CXX11 1
#ifndef HAS_CXX11
#define HAS_CXX11 1
#endif
#if GCC_VERSION >= 40300 && !defined(HAS_VARIADIC_TEMPLATES)
#define HAS_VARIADIC_TEMPLATES 1
......
......@@ -57,7 +57,9 @@ typedef __declspec(align(CACHE_LINE)) size_t aligned_size_t;
#include <functional>
#if defined(_GLIBCXX_TUPLE) || defined(_GLIBCXX_TYPE_TRAITS) || defined(_GLIBCXX_ARRAY) || (__cplusplus > 199711L)
#define HAS_CXX11 1
#ifndef HAS_CXX11
#define HAS_CXX11 1
#endif
#if INTEL_VERSION >= 1201 && !defined(HAS_VARIADIC_TEMPLATES)
#define HAS_VARIADIC_TEMPLATES 1
......
......@@ -54,7 +54,9 @@ typedef __declspec(align(CACHE_LINE)) size_t aligned_size_t;
// C++11 features
// --------------
#if __cplusplus > 199711L
#define HAS_CXX11 1
#ifndef HAS_CXX11
#define HAS_CXX11 1
#endif
#if MSC_VERSION >= 1800 && !defined(HAS_VARIADIC_TEMPLATES)
#define HAS_VARIADIC_TEMPLATES 1
......
......@@ -77,7 +77,7 @@ namespace AMDiS { namespace io {
basis[i][j] = p[i + 1][j] ;
lengthBasis[i] += basis[i][j] * basis[i][j];
}
lengthBasis[i] = sqrt(lengthBasis[i]);
lengthBasis[i] = std::sqrt(lengthBasis[i]);
}
// norm basis, get steps
......@@ -191,7 +191,7 @@ namespace AMDiS { namespace io {
basis[i][j] = p[i + 1][j] ;
lengthBasis[i] += basis[i][j] * basis[i][j];
}
lengthBasis[i] = sqrt(lengthBasis[i]);
lengthBasis[i] = std::sqrt(lengthBasis[i]);
}
// norm basis, get steps
......
......@@ -26,13 +26,14 @@
namespace AMDiS {
RosenbrockAdaptInstationary::RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary *problemStat,
ProblemIterationInterface *problemStat,
RosenbrockInterface *rbprob,
AdaptInfo *info,
ProblemTimeInterface *problemInstat,
AdaptInfo *initialInfo,
time_t initialTimestamp)
: AdaptInstationary(name, problemStat, info, problemInstat, initialInfo, initialTimestamp),
rosenbrockStat(problemStat),
rosenbrockStat(rbprob),
firstTimestep(true),
lastTimestepRejected(false),
succRejection(false),
......@@ -45,19 +46,20 @@ namespace AMDiS {
minusInvTauGamma(-1.0),
dbgTimestepStudy(false)
{
initConstructor(problemStat);
initConstructor(rbprob);
rosenbrockStat->setOldTime(adaptInfo->getStartTime());
}
RosenbrockAdaptInstationary::RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary &problemStat,
ProblemIterationInterface &problemStat,
RosenbrockInterface &rbprob,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestamp)
: AdaptInstationary(name, problemStat, info, problemInstat, initialInfo, initialTimestamp),
rosenbrockStat(&problemStat),
rosenbrockStat(&rbprob),
firstTimestep(true),
lastTimestepRejected(false),
succRejection(false),
......@@ -70,12 +72,12 @@ namespace AMDiS {
minusInvTauGamma(-1.0),
dbgTimestepStudy(false)
{
initConstructor(&problemStat);
initConstructor(&rbprob);
rosenbrockStat->setOldTime(adaptInfo->getStartTime());
}
void RosenbrockAdaptInstationary::initConstructor(RosenbrockStationary *problemStat)
void RosenbrockAdaptInstationary::initConstructor(RosenbrockInterface *problemStat)
{
FUNCNAME_DBG("RosenbrockAdaptInstationary::initConstructor()");
......@@ -283,11 +285,11 @@ namespace AMDiS {
{
double errorEst = 0.0;
for (int i = 0; i < adaptInfo->getSize(); i++) {
double weight = adaptInfo->getTimeTolerance(i) + rosenbrockStat->getSolution(i)->L2Norm() * adaptInfo->getTimeRelativeTolerance(i);
double weight = adaptInfo->getTimeTolerance(i) + adaptInfo->getEstSum(i) * adaptInfo->getTimeRelativeTolerance(i);
errorEst += sqr(adaptInfo->getTimeEstCombined(i)) / sqr(weight);
}
errorEst = sqrt(errorEst / adaptInfo->getSize());
errorEst = std::sqrt(errorEst / adaptInfo->getSize());
adaptInfo->setTimeEst(errorEst);
return errorEst;
}
......
......@@ -42,7 +42,8 @@ namespace AMDiS {
* dependent problem problemInstat. TODO: Make obsolete!
*/
RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary *problemStat,
ProblemIterationInterface *problemStat,
RosenbrockInterface *rbprob,
AdaptInfo *info,
ProblemTimeInterface *problemInstat,
AdaptInfo *initialInfo,
......@@ -54,7 +55,8 @@ namespace AMDiS {
* dependent problem problemInstat.
*/
RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary &problemStat,
ProblemIterationInterface &problemStat,
RosenbrockInterface &rbprob,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
......@@ -71,7 +73,7 @@ namespace AMDiS {
* removed, remove also this function.
* TODO: Remove if obsolete constructor will be removed.
*/
void initConstructor(RosenbrockStationary *problemStat);
void initConstructor(RosenbrockInterface *problemStat);
void reset();
......@@ -80,7 +82,7 @@ namespace AMDiS {
RosenbrockMethod *rosenbrockMethod;
/// Pointer to the stationary problem;
RosenbrockStationary *rosenbrockStat;
RosenbrockInterface *rosenbrockStat;
/// Indicates, if this is the very first timestep.
bool firstTimestep;
......
......@@ -52,6 +52,88 @@ namespace AMDiS {
int row;
int col;
};
class RosenbrockInterface
{
public:
RosenbrockInterface()
: rm(NULL),
oldTime(0.0),
tauPtr(NULL),
tauGamma(NULL),
minusTauGamma(NULL),
invTauGamma(NULL),
minusInvTauGamma(NULL)
{}
virtual ~RosenbrockInterface() {}
/// update solution vector and oldTime value
virtual void acceptTimestep(AdaptInfo* adaptInfo) = 0;
double* getTau()
{
return tauPtr;
}
double* getTauGamma()
{
return tauGamma;
}
double* getMinusTauGamma()
{
return minusTauGamma;
}
double* getInvTauGamma()
{
return invTauGamma;
}
double* getMinusInvTauGamma()
{
return minusInvTauGamma;
}
virtual void setRosenbrockMethod(RosenbrockMethod *method)
{
rm = method;
}
double* getOldTime()
{
return &oldTime;
}
void setTau(double *ptr)
{
tauPtr = ptr;
}
void setTauGamma(double *ptr0, double *ptr1, double *ptr2, double *ptr3)
{
tauGamma = ptr0;
minusTauGamma = ptr1;
invTauGamma = ptr2;
minusInvTauGamma = ptr3;
}
void setOldTime(double t)
{
oldTime = t;
}
protected:
RosenbrockMethod *rm;
double oldTime;
double *tauPtr;
double *tauGamma, *minusTauGamma, *invTauGamma, *minusInvTauGamma;
};
/// Realization of a Rosenbrock time-discretization of M*d_t(X) = F[x]
/**
......@@ -65,21 +147,16 @@ namespace AMDiS {
* and new solution
* X^{k+1} = X^k + sum_{j=1}^{s} m_j * Y_j^k
**/
class RosenbrockStationary : public ProblemStat
class RosenbrockStationary : public ProblemStat,
public RosenbrockInterface
{
public:
RosenbrockStationary(std::string name, int componentShift_ = 0)
: ProblemStat(name),
first(true),
componentShift(componentShift_),
minusOne(-1.0),
stageTime(0.0),
oldTime(0.0),
tauPtr(NULL),
tauGamma(NULL),
minusTauGamma(NULL),
invTauGamma(NULL),
minusInvTauGamma(NULL)
first(true),
componentShift(componentShift_),
minusOne(-1.0),
stageTime(0.0)
{}
......@@ -91,7 +168,7 @@ namespace AMDiS {
virtual void estimateTimeError(AdaptInfo* adaptInfo);
/// update solution vector and oldTime value
void acceptTimestep(AdaptInfo* adaptInfo);
void acceptTimestep(AdaptInfo* adaptInfo) override;
/// Add operators of function F
virtual void addOperator(Operator &op, int row, int col,
......@@ -120,42 +197,12 @@ namespace AMDiS {
{
return timeRhsVec->getDOFVector(i);
}
double* getTauGamma()
{
return tauGamma;
}
double* getTau()
{
return tauPtr;
}
double* getMinusTauGamma()
{
return minusTauGamma;
}
double* getInvTauGamma()
{
return invTauGamma;
}
double* getMinusInvTauGamma()
{
return minusInvTauGamma;
}
double* getStageTime()
{
return &stageTime;
}
double* getOldTime()
{
return &oldTime;
}
double* getTauGammaI()
{
return &tauGammaI;
......@@ -164,33 +211,15 @@ namespace AMDiS {
// setting methods
// _________________________________________________________________________
void setRosenbrockMethod(RosenbrockMethod *method)
{
rm = method;
init();
}
void setTau(double *ptr)
{
tauPtr = ptr;
}
void setTauGamma(double *ptr0, double *ptr1, double *ptr2, double *ptr3)
{
tauGamma = ptr0;
minusTauGamma = ptr1;
invTauGamma = ptr2;
minusInvTauGamma = ptr3;
}
void setOldTime(double t)
void setStageTime(double t)
{
oldTime = t;
stageTime = t;
}
void setStageTime(double t)
void setRosenbrockMethod(RosenbrockMethod *method) override
{
stageTime = t;
rm = method;
init();
}
......@@ -225,11 +254,10 @@ namespace AMDiS {
stageSolution->set(0.0);
unVec->set(0.0);
for (int i = 0; i < rm->getStages(); i++)
stageSolutions[i]->set(0.0);
stageSolutions[i]->set(0.0);
}
protected:
RosenbrockMethod *rm;
SystemVector *stageSolution, *unVec, *timeRhsVec, *newUn, *tmp, *lowSol;
......@@ -241,12 +269,8 @@ namespace AMDiS {
double minusOne;
double stageTime; // t_n + alpha_i*tau
double oldTime;
double tauGammaI; // tau*gamma_i
double *tauPtr;
double *tauGamma, *minusTauGamma, *invTauGamma, *minusInvTauGamma;
std::vector<RosenbrockBoundary> boundaries;
};
......
......@@ -208,7 +208,7 @@ namespace AMDiS { namespace extensions {
std::vector<int> N_;
int N_sum = 0;
for (int i = 0; i < Global::getGeo(WORLD); i++) {
N_.push_back(boost::math::iround(pow(static_cast<double>(N_const),lengths[i]/sum_lengths)));
N_.push_back(boost::math::iround(std::pow(static_cast<double>(N_const),lengths[i]/sum_lengths)));
N_sum += N_[i];
}
......@@ -306,8 +306,8 @@ namespace AMDiS { namespace extensions {
break;
case 2:
for (double phi = 0.0; phi < 2.0*m_pi; phi += incr) {
newIdx[0] = idx[0] + boost::math::iround(radius*cos(phi));
newIdx[1] = idx[1] + boost::math::iround(radius*sin(phi));
newIdx[0] = idx[0] + boost::math::iround(radius*std::cos(phi));
newIdx[1] = idx[1] + boost::math::iround(radius*std::sin(phi));
if (newIdx[0] >= 0 && newIdx[0] < N[0]
&& newIdx[1] >= 0 && newIdx[1] < N[1])
newNrs.insert(idx2nr(newIdx));
......@@ -316,9 +316,9 @@ namespace AMDiS { namespace extensions {
case 3:
for (double phi = -m_pi; phi < m_pi; phi += incr) {
for (double theta = 0.0; theta < m_pi; theta += incr) {
newIdx[0] = idx[0] + boost::math::iround(radius*sin(theta)*cos(phi));
newIdx[1] = idx[1] + boost::math::iround(radius*sin(theta)*sin(phi));
newIdx[2] = idx[2] + boost::math::iround(radius*cos(theta));
newIdx[0] = idx[0] + boost::math::iround(radius*std::sin(theta)*std::cos(phi));
newIdx[1] = idx[1] + boost::math::iround(radius*std::sin(theta)*std::sin(phi));