From 802e128a1f955b2adeded8d5e377bec021798eae Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Sun, 17 Feb 2013 22:42:46 +0000 Subject: [PATCH] AMDiS now compiles with -pedantic --- extensions/ExtendedProblemStat.h | 19 ++++---- extensions/SignedDistFunctors.h | 8 ++-- extensions/SingularDirichletBC.h | 80 +++++++++++++++++--------------- extensions/VtuReader.h | 4 +- 4 files changed, 57 insertions(+), 54 deletions(-) diff --git a/extensions/ExtendedProblemStat.h b/extensions/ExtendedProblemStat.h index c9c0abe1..04424f07 100644 --- a/extensions/ExtendedProblemStat.h +++ b/extensions/ExtendedProblemStat.h @@ -91,8 +91,7 @@ public: void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, bool asmMatrix, bool asmVector) - { FUNCNAME("ExtendedProblemStat::buildAfterCoarsen()"); - + { ProblemStat_::buildAfterCoarsen(adaptInfo, flag, asmMatrix, asmVector); #ifndef HAVE_PARALLEL_DOMAIN_AMDIS @@ -136,8 +135,7 @@ public: void solve(AdaptInfo *adaptInfo, bool createMatrixData = true, bool storeMatrixData = false) - { FUNCNAME("ExtendedProblemStat::solve()"); - + { ProblemStat_::solve(adaptInfo, createMatrixData, storeMatrixData); oldMeshChangeIdx = getMesh()->getChangeIndex(); @@ -146,8 +144,6 @@ public: /// Add arbitrary boundary condition to system void addBoundaryCondition(BoundaryCondition *bc, int row, int col) { - FUNCNAME("ProblemStatType::addBoundaryCondition()"); - boundaryConditionSet = true; if (systemMatrix && (*systemMatrix)[row][col]) @@ -264,7 +260,8 @@ protected: typedef mtl::traits::range_generator<tag::row, Matrix>::type c_type; typedef mtl::traits::range_generator<tag::nz, c_type>::type ic_type; - for (size_t col = 0; col < getNumComponents(); col++) { + size_t numCols = static_cast<size_t>(getNumComponents()); + for (size_t col = 0; col < numCols; col++) { TEST_EXIT(getSystemMatrix(row_, col) != NULL || col != col_) ("SystemMatrix block (%d,%d) must not be NULL! Insert a Simple_ZOT(0.0) as Workaround.\n",row_,col); if (getSystemMatrix(row_, col) == NULL) @@ -308,7 +305,8 @@ protected: typedef mtl::traits::range_generator<tag::row, Matrix>::type c_type; typedef mtl::traits::range_generator<tag::nz, c_type>::type ic_type; - for (size_t col = 0; col < getNumComponents(); col++) { + size_t numCols = static_cast<size_t>(getNumComponents()); + for (size_t col = 0; col < numCols; col++) { TEST_EXIT(getSystemMatrix(row, col) != NULL) ("SystemMatrix block (%d,%d) must not be NULL! Insert a Simple_ZOT(0.0) as Workaround.\n",row,col); @@ -377,12 +375,13 @@ protected: typedef mtl::traits::range_generator<tag::row, Matrix>::type c_type; typedef mtl::traits::range_generator<tag::nz, c_type>::type ic_type; + size_t numCols = static_cast<size_t>(getNumComponents()); TEST_EXIT(row_idx.size() == coefficients.size() && row_idx.size() == rhs.size() && rhs.size()>0) ("rhs_idx, coefficients and rhs must have the same size and size >! 0\n"); - TEST_EXIT(coefficients[0].size() == getNumComponents()) + TEST_EXIT(coefficients[0].size() == numCols) ("You have to give coefficients for all variables\n"); - for (size_t col = 0; col < getNumComponents(); col++) { + for (size_t col = 0; col < numCols; col++) { TEST_EXIT(getSystemMatrix(row, col) != NULL) ("SystemMatrix block (%d,%d) must not be NULL! Insert a Simple_ZOT(0.0) as Workaround.\n",row,col); diff --git a/extensions/SignedDistFunctors.h b/extensions/SignedDistFunctors.h index 87bb1501..8bdb629e 100644 --- a/extensions/SignedDistFunctors.h +++ b/extensions/SignedDistFunctors.h @@ -251,7 +251,7 @@ class Plane : public AbstractFunction<double, WorldVector<double> > public: Plane(double shift_, double factor_=1.0, int component_=1) : - shift(shift_), factor(factor_), component(component_) {} + shift(shift_), component(component_), factor(factor_) {} double operator()(const WorldVector<double>& x) const { return factor*(shift-x[component]); @@ -375,12 +375,12 @@ public: std::vector<double> result(pos.size(),0.0); for(int k=0; k<x.getSize(); k++) { - for (int j=0; j<pos.size(); j++) { + for (size_t j=0; j<pos.size(); j++) { result[j] += sqr(x[k]-pos[j][k]); } } double minResult = 1.e10; - for (int j=0; j<pos.size(); j++) { + for (size_t j=0; j<pos.size(); j++) { minResult = std::min(minResult, sqrt(result[j])-radius); } return -minResult; @@ -582,7 +582,7 @@ public: std::vector<WorldVector<double> > newVertices; for (size_t i = 0; i < vertices.size()-1; i++) { - for (size_t j = 0; j < np-1; j++) { + for (int j = 0; j < np-1; j++) { double lambda = static_cast<double>(j)/static_cast<double>(np - 1.0); WorldVector<double> p = lambda*vertices[i+1] + (1.0-lambda)*vertices[i]; newVertices.push_back(p); diff --git a/extensions/SingularDirichletBC.h b/extensions/SingularDirichletBC.h index cb9b28ea..bcb55180 100644 --- a/extensions/SingularDirichletBC.h +++ b/extensions/SingularDirichletBC.h @@ -263,7 +263,9 @@ namespace details { association.push_back(std::make_pair(std::min(*it, idx_), std::max(*it, idx_))); } - MSG_DBG("Nr of associations: %d\n", association.size()); +#if DEBUG != 0 + MSG("Nr of associations: %d\n", association.size()); +#endif } @@ -294,116 +296,116 @@ struct DirichletBcData { // pos = WorldVector DirichletBcData(int i_, int j_, WorldVector<double> pos_, double val_) - : row(i_), col(j_), pos(pos_), val0(val_), + : row(i_), col(j_), pos(pos_), val0(val_), val1(NULL), val2(NULL), posType(0), valueType(0), - idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), val1(NULL), val2(NULL), + idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) {} DirichletBcData(int i_, int j_, WorldVector<double> pos_, DOFVector<double> &val_) - : row(i_), col(j_), pos(pos_), val1(&val_), + : row(i_), col(j_), pos(pos_), val1(&val_), val0(0.0), val2(NULL), posType(0), valueType(1), - idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), val0(0.0), val2(NULL), + idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) {} DirichletBcData(int i_, int j_, WorldVector<double> pos_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), pos(pos_), val2(&val_), + : row(i_), col(j_), pos(pos_), val0(0.0), val1(NULL), val2(&val_), posType(0), valueType(2), - idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), val0(0.0), val1(NULL), + idx(0), SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) {} // pos = idx DirichletBcData(int i_, int j_, DegreeOfFreedom idx_, double val_) - : row(i_), col(j_), idx(idx_), val0(val_), + : row(i_), col(j_), idx(idx_), val0(val_), val1(NULL), val2(NULL), posType(1), valueType(0), - SignedDistFct(NULL), SignedDistDOF(NULL), val1(NULL), val2(NULL), + SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, DegreeOfFreedom idx_, DOFVector<double> &val_) - : row(i_), col(j_), idx(idx_), val1(&val_), + : row(i_), col(j_), idx(idx_), val0(0.0), val1(&val_), val2(NULL), posType(1), valueType(1), - SignedDistFct(NULL), SignedDistDOF(NULL), val0(0.0), val2(NULL), + SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, DegreeOfFreedom idx_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), idx(idx_), val2(&val_), + : row(i_), col(j_), idx(idx_), val0(0.0), val1(NULL), val2(&val_), posType(1), valueType(2), - SignedDistFct(NULL), SignedDistDOF(NULL), val0(0.0), val1(NULL), + SignedDistFct(NULL), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } // pos = SignedDistFct DirichletBcData(int i_, int j_, AbstractFunction<double, WorldVector<double> > *SignedDistFct_, double val_) - : row(i_), col(j_), SignedDistFct(SignedDistFct_), val0(val_), + : row(i_), col(j_), SignedDistFct(SignedDistFct_), val0(val_), val1(NULL), val2(NULL), posType(2), valueType(0), - idx(0), SignedDistDOF(NULL), val1(NULL), val2(NULL), + idx(0), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, AbstractFunction<double, WorldVector<double> > *SignedDistFct_, DOFVector<double> &val_) - : row(i_), col(j_), SignedDistFct(SignedDistFct_), val1(&val_), + : row(i_), col(j_), SignedDistFct(SignedDistFct_), val0(0.0), val1(&val_), val2(NULL), posType(2), valueType(1), - idx(0), SignedDistDOF(NULL), val0(0.0), val2(NULL), + idx(0), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, AbstractFunction<double, WorldVector<double> > *SignedDistFct_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), SignedDistFct(SignedDistFct_), val2(&val_), + : row(i_), col(j_), SignedDistFct(SignedDistFct_), val0(0.0), val1(NULL), val2(&val_), posType(2), valueType(2), - idx(0), SignedDistDOF(NULL), val0(0.0), val1(NULL), + idx(0), SignedDistDOF(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } // pos = SignedDistDOF DirichletBcData(int i_, int j_, DOFVector<double> *SignedDistDOF_, double val_) - : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val0(val_), + : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val0(val_), val1(NULL), val2(NULL), posType(3), valueType(0), - idx(0), SignedDistFct(NULL), val1(NULL), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, DOFVector<double> *SignedDistDOF_, DOFVector<double> &val_) - : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val1(&val_), + : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val0(0.0), val1(&val_), val2(NULL), posType(3), valueType(1), - idx(0), SignedDistFct(NULL), val0(0.0), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } DirichletBcData(int i_, int j_, DOFVector<double> *SignedDistDOF_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val2(&val_), + : row(i_), col(j_), SignedDistDOF(SignedDistDOF_), val0(0.0), val1(NULL), val2(&val_), posType(3), valueType(2), - idx(0), SignedDistFct(NULL), val0(0.0), val1(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(NULL) { pos.set(0.0); } // pos = meshindicator + boundary_nr DirichletBcData(int i_, int j_, BoundaryType nr, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, double val_) - : row(i_), col(j_), SignedDistDOF(NULL), val0(val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(val_), val1(NULL), val2(NULL), posType(4), valueType(0), - idx(0), SignedDistFct(NULL), val1(NULL), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(nr), meshIndicator(meshIndicator_) { pos.set(0.0); } DirichletBcData(int i_, int j_, BoundaryType nr, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, DOFVector<double> &val_) - : row(i_), col(j_), SignedDistDOF(NULL), val1(&val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(0.0), val1(&val_), val2(NULL), posType(4), valueType(1), - idx(0), SignedDistFct(NULL), val0(0.0), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(nr), meshIndicator(meshIndicator_) { pos.set(0.0); } DirichletBcData(int i_, int j_, BoundaryType nr, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), SignedDistDOF(NULL), val2(&val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(0.0), val1(NULL), val2(&val_), posType(4), valueType(2), - idx(0), SignedDistFct(NULL), val0(0.0), val1(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(nr), meshIndicator(meshIndicator_) { pos.set(0.0); } // pos = meshindicator DirichletBcData(int i_, int j_, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, double val_) - : row(i_), col(j_), SignedDistDOF(NULL), val0(val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(val_), val1(NULL), val2(NULL), posType(4), valueType(0), - idx(0), SignedDistFct(NULL), val1(NULL), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(meshIndicator_) { pos.set(0.0); } DirichletBcData(int i_, int j_, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, DOFVector<double> &val_) - : row(i_), col(j_), SignedDistDOF(NULL), val1(&val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(0.0), val1(&val_), val2(NULL), posType(4), valueType(1), - idx(0), SignedDistFct(NULL), val0(0.0), val2(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(meshIndicator_) { pos.set(0.0); } DirichletBcData(int i_, int j_, AbstractFunction<bool, WorldVector<double> > *meshIndicator_, AbstractFunction<double, WorldVector<double> > &val_) - : row(i_), col(j_), SignedDistDOF(NULL), val2(&val_), + : row(i_), col(j_), SignedDistDOF(NULL), val0(0.0), val1(NULL), val2(&val_), posType(4), valueType(2), - idx(0), SignedDistFct(NULL), val0(0.0), val1(NULL), + idx(0), SignedDistFct(NULL), boundary_nr(0), meshIndicator(meshIndicator_) { pos.set(0.0); } void addToList(const FiniteElemSpace *feSpace, std::vector<SingularDirichletBC> &list) @@ -473,7 +475,9 @@ struct DirichletBcData { list.push_back(SingularDirichletBC(row, col, indices_[i], values_[i])); } - MSG_DBG("Dirichle BC at %d DOFs added.\n",indices_.size()); +#if DEBUG != 0 + MSG("Dirichle BC at %d DOFs added.\n",indices_.size()); +#endif } diff --git a/extensions/VtuReader.h b/extensions/VtuReader.h index 346c095c..34a8a228 100644 --- a/extensions/VtuReader.h +++ b/extensions/VtuReader.h @@ -113,7 +113,7 @@ namespace AMDiS { inline void valueVector2type(std::vector<double> p, WorldVector<double>& value) { - if (p.size() != Global::getGeo(WORLD)) + if (static_cast<int>(p.size()) != Global::getGeo(WORLD)) throw(std::runtime_error("Not enough data for assignment!\n")); for (int i = 0; i < Global::getGeo(WORLD); i++) value[i] = p[i]; @@ -123,7 +123,7 @@ namespace AMDiS { { if (p.size() == 0) throw(std::runtime_error("Not enough data for assignment!\n")); - for (int i = 0; i < p.size(); i++) + for (size_t i = 0; i < p.size(); i++) value.push_back(p[i]); } -- GitLab