Commit 831ce194 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

removed some warnings and minor errors in the code

parent 99303ce3
...@@ -44,6 +44,7 @@ namespace AMDiS { ...@@ -44,6 +44,7 @@ namespace AMDiS {
* To create your own function you have to derive AbstractFunction and * To create your own function you have to derive AbstractFunction and
* overload operator(). * overload operator().
*/ */
// #ifndef HAS_VARIADIC_TEMPLATES
template<typename ReturnType, typename ArgumentType> template<typename ReturnType, typename ArgumentType>
class AbstractFunction class AbstractFunction
{ {
...@@ -67,7 +68,8 @@ namespace AMDiS { ...@@ -67,7 +68,8 @@ namespace AMDiS {
protected: protected:
int degree_; int degree_;
}; };
// #endif
/** /**
* \ingroup Common * \ingroup Common
* *
...@@ -173,6 +175,7 @@ namespace AMDiS { ...@@ -173,6 +175,7 @@ namespace AMDiS {
int degree_; int degree_;
}; };
// #ifndef HAS_VARIADIC_TEMPLATES
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// test of AbstractFunction with arbitrary number of arguments // test of AbstractFunction with arbitrary number of arguments
...@@ -195,17 +198,46 @@ namespace AMDiS { ...@@ -195,17 +198,46 @@ namespace AMDiS {
int degree_; \ int degree_; \
}; \ }; \
// template< typename ReturnType,
// BOOST_PP_ENUM_PARAMS(N, typename T) // expands to typename T0, typename T1, typename T2... #if 0 // description of the macro
// > template< typename ReturnType, BOOST_PP_ENUM_PARAMS(N, typename T) >// expands to typename T0, typename T1, typename T2...
// class CONCAT_STR(AbstractFunction,N) class CONCAT_STR(AbstractFunction,N)
{
public:
CONCAT_STR(AbstractFunction,N)(int degree = 0) :
degree_(degree)
{}
virtual ~CONCAT_STR(AbstractFunction,N)() {}
/// Returns \ref degree_.
inline int getDegree() const
{
return degree_;
}
/// function evaluation.
virtual ReturnType operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)) const = 0;
protected:
int degree_;
};
#endif
BOOST_PP_REPEAT_FROM_TO(1, 11, ABSTRACT_FUNCTION_MACRO, nil)
// #else
//
// /// C++11 implementation of abstract functions with arbitrary nr of arguments using variadic templates
// template< typename ReturnType, typename... Ts >
// class AbstractFunction
// { // {
// public: // public:
// CONCAT_STR(AbstractFunction,N)(int degree = 0) : // AbstractFunction(int degree = 0)
// degree_(degree) // : degree_(degree)
// {} // {}
// //
// virtual ~CONCAT_STR(AbstractFunction,N)() {} // virtual ~AbstractFunction() {}
// //
// /// Returns \ref degree_. // /// Returns \ref degree_.
// inline int getDegree() const // inline int getDegree() const
...@@ -214,15 +246,13 @@ namespace AMDiS { ...@@ -214,15 +246,13 @@ namespace AMDiS {
// } // }
// //
// /// function evaluation. // /// function evaluation.
// virtual ReturnType operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)) const = 0; // virtual ReturnType operator()(Ts const&... args) const = 0;
// //
// protected: // protected:
// int degree_; // int degree_;
// }; // };
//
BOOST_PP_REPEAT_FROM_TO(1, 11, ABSTRACT_FUNCTION_MACRO, nil) // #endif
} }
#endif // AMDIS_ABSTRACTFUNCTION_H #endif // AMDIS_ABSTRACTFUNCTION_H
...@@ -77,17 +77,17 @@ ...@@ -77,17 +77,17 @@
* *
* *
* with F a functor that implements * with F a functor that implements
* typedef (...) value_type; * typedef (...) result_type;
* int getDegree(int d0); * int getDegree(int d0);
* value_type operator()(const T0& v0) const; * result_type operator()(const T0& v0) const;
* *
* respective * respective
* int getDegree(int d0, int d1); * int getDegree(int d0, int d1);
* value_type operator()(const T0& v0, const T1& v1) const; * result_type operator()(const T0& v0, const T1& v1) const;
* *
* respective * respective
* int getDegree(int d0, int d1, int d2); * int getDegree(int d0, int d1, int d2);
* value_type operator()(const T0& v0, const T1& v1, const T2& v2) const; * result_type operator()(const T0& v0, const T1& v1, const T2& v2) const;
* *
* where the d0, d1, d2 give the polynomial degrees of the v0, v1, v2 terms. * where the d0, d1, d2 give the polynomial degrees of the v0, v1, v2 terms.
* */ * */
......
...@@ -96,7 +96,6 @@ template<typename Term, typename Functor> ...@@ -96,7 +96,6 @@ template<typename Term, typename Functor>
inline typename boost::enable_if<typename traits::is_expr<Term>::type, typename Term::value_type>::type inline typename boost::enable_if<typename traits::is_expr<Term>::type, typename Term::value_type>::type
accumulate(Term term, Functor f, typename Term::value_type value0) accumulate(Term term, Functor f, typename Term::value_type value0)
{ {
typedef typename Term::value_type TOut;
typename GenericOperatorTerm<Term>::type ot(term); typename GenericOperatorTerm<Term>::type ot(term);
std::set<const FiniteElemSpace*> feSpaces = ot.getAuxFeSpaces(); std::set<const FiniteElemSpace*> feSpaces = ot.getAuxFeSpaces();
......
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
#if !((defined BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_DECLTYPE)) #if !((defined BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_DECLTYPE))
#define HAS_CPP11_DECLTYPE #define HAS_CPP11_DECLTYPE
#endif #endif
#if !((defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (defined BOOST_NO_VARIADIC_TEMPLATES)) || (defined BOOST_HAS_VARIADIC_TMPL)
#define HAS_VARIADIC_TEMPLATES
#endif
/** \brief current AMDiS version */ /** \brief current AMDiS version */
#ifndef AMDIS_VERSION #ifndef AMDIS_VERSION
......
...@@ -567,7 +567,7 @@ namespace AMDiS { namespace io { ...@@ -567,7 +567,7 @@ namespace AMDiS { namespace io {
vector<vector<int> > sortedFeSpaces(nFeSpaces); vector<vector<int> > sortedFeSpaces(nFeSpaces);
// Read macro table // Read macro table
for(int i = 0; i < nMacroElements; i++) { for(uint32_t i = 0; i < nMacroElements; i++) {
file.read(reinterpret_cast<char*>(&macroElIndex[i]), 4); file.read(reinterpret_cast<char*>(&macroElIndex[i]), 4);
file.read(reinterpret_cast<char*>(&macroElSize[i]), 4); file.read(reinterpret_cast<char*>(&macroElSize[i]), 4);
} }
...@@ -576,7 +576,7 @@ namespace AMDiS { namespace io { ...@@ -576,7 +576,7 @@ namespace AMDiS { namespace io {
file.seekg(nFeSpaces * 4 * 4, ios_base::cur); file.seekg(nFeSpaces * 4 * 4, ios_base::cur);
// Read value table // Read value table
for(int i = 0; i < nValueVectors; i++) { for(uint32_t i = 0; i < nValueVectors; i++) {
string tmpString(""); string tmpString("");
uint32_t tmpInt = 0; uint32_t tmpInt = 0;
file.read(reinterpret_cast<char*>(&tmpInt), 4); file.read(reinterpret_cast<char*>(&tmpInt), 4);
...@@ -586,7 +586,7 @@ namespace AMDiS { namespace io { ...@@ -586,7 +586,7 @@ namespace AMDiS { namespace io {
sortedFeSpaces[tmpInt].push_back(i); sortedFeSpaces[tmpInt].push_back(i);
} }
for (unsigned int i = 0; i < nMacroElements; i++) { for (uint32_t i = 0; i < nMacroElements; i++) {
stringstream dataStream(ios::out | ios::in | ios::binary); stringstream dataStream(ios::out | ios::in | ios::binary);
int size = 0; int size = 0;
...@@ -623,7 +623,7 @@ namespace AMDiS { namespace io { ...@@ -623,7 +623,7 @@ namespace AMDiS { namespace io {
if (nValueVectors > 0) { if (nValueVectors > 0) {
for(unsigned int j = 0; j < nFeSpaces; j++) { for(uint32_t j = 0; j < nFeSpaces; j++) {
uint32_t nValuesPerVector = 0; uint32_t nValuesPerVector = 0;
dataStream.read(reinterpret_cast<char*>(&nValuesPerVector), 4); dataStream.read(reinterpret_cast<char*>(&nValuesPerVector), 4);
dataStream.seekg(sortedFeSpaces[j].size() * 8 * nValuesPerVector, ios_base::cur); dataStream.seekg(sortedFeSpaces[j].size() * 8 * nValuesPerVector, ios_base::cur);
......
...@@ -33,7 +33,7 @@ namespace AMDiS { ...@@ -33,7 +33,7 @@ namespace AMDiS {
/// A wrapper for AMDiS::SolverMatrix to be used in MTL/ITL solvers /// A wrapper for AMDiS::SolverMatrix to be used in MTL/ITL solvers
struct BlockMTLMatrix struct BlockMTLMatrix
{ {
typedef typename mtl::Collection<MTLTypes::MTLMatrix>::size_type size_type; typedef mtl::Collection<MTLTypes::MTLMatrix>::size_type size_type;
size_type n; // overall number of rows size_type n; // overall number of rows
size_type m; // overall number of columns size_type m; // overall number of columns
...@@ -42,11 +42,11 @@ namespace AMDiS { ...@@ -42,11 +42,11 @@ namespace AMDiS {
size_t n_cols; // number of column blocks size_t n_cols; // number of column blocks
BlockMTLMatrix() BlockMTLMatrix()
: A(NULL), initialized(false) : initialized(false), A(NULL)
{ } { }
BlockMTLMatrix(const SolverMatrix<Matrix<DOFMatrix*> >& A_) BlockMTLMatrix(const SolverMatrix<Matrix<DOFMatrix*> >& A_)
: A(&A_), initialized(false) : initialized(false), A(&A_)
{ {
init(); init();
} }
...@@ -163,7 +163,7 @@ namespace mtl ...@@ -163,7 +163,7 @@ namespace mtl
struct Collection<AMDiS::BlockMTLMatrix> struct Collection<AMDiS::BlockMTLMatrix>
{ {
typedef double value_type; typedef double value_type;
typedef int size_type; typedef AMDiS::BlockMTLMatrix::size_type size_type;
}; };
namespace ashape namespace ashape
......
...@@ -193,8 +193,8 @@ namespace AMDiS { ...@@ -193,8 +193,8 @@ namespace AMDiS {
{ {
const Matrix<DOFMatrix* >& orMat(*sm.getOriginalMat()); const Matrix<DOFMatrix* >& orMat(*sm.getOriginalMat());
for (int i= 0; i < nRowComp; i++) { for (unsigned int i = 0; i < nRowComp; i++) {
for (int j = 0; j < nColComp; j++) { for (unsigned int j = 0; j < nColComp; j++) {
if (orMat[i][j]) { if (orMat[i][j]) {
sizes_rows[i] = orMat[i][j]->getRowFeSpace()->getAdmin()->getUsedSize(); sizes_rows[i] = orMat[i][j]->getRowFeSpace()->getAdmin()->getUsedSize();
sizes_cols[j] = orMat[i][j]->getColFeSpace()->getAdmin()->getUsedSize(); sizes_cols[j] = orMat[i][j]->getColFeSpace()->getAdmin()->getUsedSize();
...@@ -202,7 +202,7 @@ namespace AMDiS { ...@@ -202,7 +202,7 @@ namespace AMDiS {
} }
nrow += sizes_rows[i]; nrow += sizes_rows[i];
} }
for (int j = 0; j < nColComp; j++) for (unsigned int j = 0; j < nColComp; j++)
ncol += sizes_cols[j]; ncol += sizes_cols[j];
} }
......
...@@ -42,7 +42,7 @@ namespace AMDiS { ...@@ -42,7 +42,7 @@ namespace AMDiS {
bool initMatrix = false; bool initMatrix = false;
unsigned nRows(0); unsigned nRows(0);
unsigned nEntries(0); // unsigned nEntries(0);
std::vector< int > nRowsBlock(A.getNumRows()); std::vector< int > nRowsBlock(A.getNumRows());
for(int i(0); i < A.getNumRows(); ++i) { for(int i(0); i < A.getNumRows(); ++i) {
int j(0); int j(0);
......
...@@ -26,7 +26,7 @@ class diagonal<AMDiS::BlockMTLMatrix, mtl::Collection<AMDiS::BlockMTLMatrix>::va ...@@ -26,7 +26,7 @@ class diagonal<AMDiS::BlockMTLMatrix, mtl::Collection<AMDiS::BlockMTLMatrix>::va
for (size_t i = 0; i < A.n_rows; i++) for (size_t i = 0; i < A.n_rows; i++)
inv_diag[A.getRowRange(i)] = mtl::matrix::diagonal(A.getSubMatrix(i,i)); inv_diag[A.getRowRange(i)] = mtl::matrix::diagonal(A.getSubMatrix(i,i));
for (size_type i= 0; i < num_rows(A); ++i) for (size_type i = 0; i < num_rows(A); ++i)
inv_diag[i]= reciprocal(inv_diag[i]); inv_diag[i]= reciprocal(inv_diag[i]);
} }
......
...@@ -36,13 +36,13 @@ namespace AMDiS { ...@@ -36,13 +36,13 @@ namespace AMDiS {
firstTimestep(true), firstTimestep(true),
lastTimestepRejected(false), lastTimestepRejected(false),
succRejection(false), succRejection(false),
maxRejectedSolverError(3),
fixFirstTimesteps(0), fixFirstTimesteps(0),
tau(1.0), tau(1.0),
tauGamma(1.0), tauGamma(1.0),
minusTauGamma(-1.0), minusTauGamma(-1.0),
invTauGamma(1.0), invTauGamma(1.0),
minusInvTauGamma(-1.0), minusInvTauGamma(-1.0),
maxRejectedSolverError(3),
dbgTimestepStudy(false) dbgTimestepStudy(false)
{ {
initConstructor(problemStat); initConstructor(problemStat);
...@@ -61,13 +61,13 @@ namespace AMDiS { ...@@ -61,13 +61,13 @@ namespace AMDiS {
firstTimestep(true), firstTimestep(true),
lastTimestepRejected(false), lastTimestepRejected(false),
succRejection(false), succRejection(false),
maxRejectedSolverError(3),
fixFirstTimesteps(0), fixFirstTimesteps(0),
tau(1.0), tau(1.0),
tauGamma(1.0), tauGamma(1.0),
minusTauGamma(-1.0), minusTauGamma(-1.0),
invTauGamma(1.0), invTauGamma(1.0),
minusInvTauGamma(-1.0), minusInvTauGamma(-1.0),
maxRejectedSolverError(3),
dbgTimestepStudy(false) dbgTimestepStudy(false)
{ {
initConstructor(&problemStat); initConstructor(&problemStat);
......
...@@ -160,12 +160,12 @@ namespace AMDiS { ...@@ -160,12 +160,12 @@ namespace AMDiS {
} }
double RosenbrockStationary::estimateTimeError(AdaptInfo* adaptInfo) void RosenbrockStationary::estimateTimeError(AdaptInfo* adaptInfo)
{ {
for (int i = 0; i < nComponents; i++) { for (int i = 0; i < nComponents; i++) {
(*(lowSol->getDOFVector(i))) -= (*(newUn->getDOFVector(i))); (*(lowSol->getDOFVector(i))) -= (*(newUn->getDOFVector(i)));
adaptInfo->setTimeEstSum(lowSol->getDOFVector(i)->L2Norm(), i+componentShift); adaptInfo->setTimeEstSum(lowSol->getDOFVector(i)->L2Norm(), i+componentShift);
} }
} }
......
...@@ -70,8 +70,8 @@ namespace AMDiS { ...@@ -70,8 +70,8 @@ namespace AMDiS {
public: public:
RosenbrockStationary(std::string name, int componentShift_ = 0) RosenbrockStationary(std::string name, int componentShift_ = 0)
: ProblemStat(name), : ProblemStat(name),
componentShift(componentShift_),
first(true), first(true),
componentShift(componentShift_),
minusOne(-1.0), minusOne(-1.0),
stageTime(0.0), stageTime(0.0),
oldTime(0.0), oldTime(0.0),
...@@ -88,7 +88,7 @@ namespace AMDiS { ...@@ -88,7 +88,7 @@ namespace AMDiS {
virtual Flag stageIteration(AdaptInfo *adaptInfo, Flag flag, virtual Flag stageIteration(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix, bool asmVector); bool asmMatrix, bool asmVector);
virtual double estimateTimeError(AdaptInfo* adaptInfo); virtual void estimateTimeError(AdaptInfo* adaptInfo);
/// update solution vector and oldTime value /// update solution vector and oldTime value
void acceptTimestep(AdaptInfo* adaptInfo); void acceptTimestep(AdaptInfo* adaptInfo);
......
...@@ -193,8 +193,7 @@ void PolarizationField<P>::fillLaplacian() ...@@ -193,8 +193,7 @@ void PolarizationField<P>::fillLaplacian()
template<typename P> template<typename P>
void PolarizationField<P>::closeTimestep(AdaptInfo *adaptInfo) void PolarizationField<P>::closeTimestep(AdaptInfo *adaptInfo)
{ FUNCNAME("PolarizationField::closeTimestep()"); {
calcVectorField(); calcVectorField();
for (size_t i = 0; i < self::dow; i++) for (size_t i = 0; i < self::dow; i++)
oldSolution[i]->copy(*self::prob->getSolution()->getDOFVector(i)); oldSolution[i]->copy(*self::prob->getSolution()->getDOFVector(i));
...@@ -205,8 +204,7 @@ void PolarizationField<P>::closeTimestep(AdaptInfo *adaptInfo) ...@@ -205,8 +204,7 @@ void PolarizationField<P>::closeTimestep(AdaptInfo *adaptInfo)
template<typename P> template<typename P>
void PolarizationField<P>::writeFiles(AdaptInfo *adaptInfo, bool force) void PolarizationField<P>::writeFiles(AdaptInfo *adaptInfo, bool force)
{ FUNCNAME("PolarizationField::closeTimestep()"); {
super::writeFiles(adaptInfo, force); super::writeFiles(adaptInfo, force);
self::fileWriter->writeFiles(adaptInfo, false); self::fileWriter->writeFiles(adaptInfo, false);
} }
......
...@@ -27,7 +27,7 @@ namespace detail { ...@@ -27,7 +27,7 @@ namespace detail {
~QuasiCrystal() {}; ~QuasiCrystal() {};
void fillOperators() override; void fillOperators() override;
void fillBoundaryConditions() {} override; void fillBoundaryConditions() override {};
void finalizeData() override; void finalizeData() override;
......
...@@ -30,8 +30,7 @@ namespace AMDiS { namespace base_problems { ...@@ -30,8 +30,7 @@ namespace AMDiS { namespace base_problems {
template<typename P> template<typename P>
void QuasiCrystal<P>::fillOperators() void QuasiCrystal<P>::fillOperators()
{ FUNCNAME("QuasiCrystal::fillOperators()"); {
const FiniteElemSpace* feSpace = self::getFeSpace(0); const FiniteElemSpace* feSpace = self::getFeSpace(0);
DOFVector<double>* rho = self::prob->getSolution()->getDOFVector(0); DOFVector<double>* rho = self::prob->getSolution()->getDOFVector(0);
......
...@@ -23,8 +23,7 @@ namespace AMDiS { ...@@ -23,8 +23,7 @@ namespace AMDiS {
/// solve Pfc Preconditioner /// solve Pfc Preconditioner
PetscErrorCode pcPfcShell(PC pc, Vec b, Vec x) // solve Px=b PetscErrorCode pcPfcShell(PC pc, Vec b, Vec x) // solve Px=b
{ FUNCNAME("pcPfcShell()"); {
void *ctx; void *ctx;
PCShellGetContext(pc, &ctx); PCShellGetContext(pc, &ctx);
PfcData* data = static_cast<PfcData*>(ctx); PfcData* data = static_cast<PfcData*>(ctx);
...@@ -130,9 +129,7 @@ namespace AMDiS { ...@@ -130,9 +129,7 @@ namespace AMDiS {
void PetscPreconPfc::exit() void PetscPreconPfc::exit()
{ {
FUNCNAME("PetscPreconPfc::exit()");
MatDestroy(&MpK); MatDestroy(&MpK);
MatDestroy(&MpK2); MatDestroy(&MpK2);
......
...@@ -23,8 +23,7 @@ namespace AMDiS { ...@@ -23,8 +23,7 @@ namespace AMDiS {
/// solve Pfc Preconditioner /// solve Pfc Preconditioner
PetscErrorCode pcPfcDiagShell(PC pc, Vec b, Vec x) // solve Px=b PetscErrorCode pcPfcDiagShell(PC pc, Vec b, Vec x) // solve Px=b
{ FUNCNAME("pcPfcShell()"); {
void *ctx; void *ctx;
PCShellGetContext(pc, &ctx); PCShellGetContext(pc, &ctx);
PfcDiagData* data = static_cast<PfcDiagData*>(ctx); PfcDiagData* data = static_cast<PfcDiagData*>(ctx);
...@@ -143,9 +142,7 @@ namespace AMDiS { ...@@ -143,9 +142,7 @@ namespace AMDiS {
void PetscPreconPfcDiag::exit() void PetscPreconPfcDiag::exit()
{ {
FUNCNAME("PetscPreconPfcDiag::exit()");
MatDestroy(&MpK); MatDestroy(&MpK);
MatDestroy(&matS); MatDestroy(&matS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment