diff --git a/dune/elasticity/asmhandler.hpp b/dune/elasticity/asmhandler.hpp index a190263..4f29be0 100644 --- a/dune/elasticity/asmhandler.hpp +++ b/dune/elasticity/asmhandler.hpp @@ -55,7 +55,7 @@ class ASMHandler { //! \brief Get the number of equations in the system //! \returns The number of equations in the system - int getEqns() const + size_t getEqns() const { return maxeqn; } diff --git a/dune/elasticity/asmhandler_impl.hpp b/dune/elasticity/asmhandler_impl.hpp index 73b5e16..7ca9068 100644 --- a/dune/elasticity/asmhandler_impl.hpp +++ b/dune/elasticity/asmhandler_impl.hpp @@ -59,7 +59,7 @@ void ASMHandler::addDOF(int row, int erow, for (int l=0;lgetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int idx = meqn[mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1]; if (idx != -1) A[row][idx] += scale*mpc->getMaster(n).coeff*(*K)[erow][j*dim+l]; @@ -93,7 +93,7 @@ void ASMHandler::addElement( for (int k=0;kgetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int idx = meqn[mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1]; addDOF(idx,i*dim+k,K,S,set,cell,b2,mpc->getMaster(n).coeff); } @@ -124,7 +124,7 @@ void ASMHandler::extractValues(Dune::FieldVector& v, if (it2 != fixedNodes.end() && it2->second.first & (1 << n)) v[l++] = it2->second.second[n]; else if (mpc) { - for (int m=0;mgetNoMaster();++m) { + for (size_t m=0;mgetNoMaster();++m) { int idx = meqn[mpc->getMaster(m).node*dim+mpc->getMaster(m).dof-1]; if (idx != -1) v[l] += u[idx]*mpc->getMaster(m).coeff; @@ -143,7 +143,7 @@ void ASMHandler::expandSolution(Vector& result, const Vector& u) result.resize(nodes*dim); result = 0; int l=0; - for (size_t i=0;i::expandSolution(Vector& result, const Vector& u) } // second loop - handle MPC couplings l = 0; - for (size_t i=0;igetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int idx = mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1; if (meqn[idx] != -1) result[l] += u[meqn[idx]]*mpc->getMaster(n).coeff; @@ -188,7 +188,7 @@ void ASMHandler::addMPC(MPC* mpc) fixIt it = fixedNodes.find(mpc->getSlave().node); int flag = 1 << (mpc->getSlave().dof-1); if (it == fixedNodes.end() || - !(it->second.first & (1 << (mpc->getSlave().dof-1)))) { + !(it->second.first & flag)) { mpcs.insert(std::make_pair(slaveNode,mpc)); return; } @@ -257,7 +257,7 @@ void ASMHandler::resolveMPCChain(MPC* mpc) coeff[master.dof-1] = master.coeff; int removeOld = 0; - for (size_t d = 1; d <= dim; d++) + for (int d = 1; d <= dim; d++) if (fabs(coeff[d-1]) > 1.0e-8) { MPC* mpc2 = getMPC(mpc->getMaster(i).node,d-1); @@ -354,7 +354,7 @@ void ASMHandler::nodeAdjacency(const LeafIterator& it, for (int l=0;lgetNoMaster();++i) { + for (size_t i=0;igetNoMaster();++i) { int idx = meqn[mpc->getMaster(i).node*dim+ mpc->getMaster(i).dof-1]; if (idx != -1) @@ -386,7 +386,7 @@ void ASMHandler::determineAdjacencyPattern() for (int k=0;kgetNoMaster();++l) { + for (size_t l=0;lgetNoMaster();++l) { nodeAdjacency(it,vertexsize, meqn[mpc->getMaster(l).node*dim+ mpc->getMaster(l).dof-1]); diff --git a/dune/elasticity/boundarygrid.cpp b/dune/elasticity/boundarygrid.cpp index d167a08..04bb408 100644 --- a/dune/elasticity/boundarygrid.cpp +++ b/dune/elasticity/boundarygrid.cpp @@ -175,7 +175,7 @@ int BoundaryGrid::Q4inv(FaceCoord& res, const Quad& q, // check that obtained solutions are inside element double tol = 1+epsOut; int nInside=0; - for (int i=0;i 1) { std::cout << "multiple solutions" << std::endl; @@ -232,7 +232,7 @@ bool BoundaryGrid::bilinearSolve(double epsilon, double order, double Q2 = A[0]*B[1]-B[0]*A[1]; std::vector Z; cubicSolve(epsilon,0,Q2,Q1,Q0,Z); - for (int i=0;i tol) { X.push_back(Z[i]); @@ -244,10 +244,10 @@ bool BoundaryGrid::bilinearSolve(double epsilon, double order, Q2 = A[0]*B[2]-B[0]*A[2]; Z.clear(); cubicSolve(epsilon,0,Q2,Q1,Q0,Z); - for (int i=0;i tol) { - int j=0; + size_t j=0; for (j=0;j const typename GridImp::LeafGridView::template Codim<3>::Iterator itend = gv.leafView().template end<3>(); for (int i=0;i<4;++i) { typename GridImp::LeafGridView::template Codim<3>::Iterator it=start; - for (it ; it != itend; ++it) { + for (; it != itend; ++it) { if (mapper.map(*it) == q.v[i].i) break; } @@ -414,7 +414,6 @@ class HexGeometry<2, cdim, GridImp> Dune::GenericReferenceElements< ctype, 2 >::general(type()); LocalCoordinate x = refElement.position(0,0); LocalCoordinate dx; - int i=0; do { using namespace Dune::GenericGeometry; // DF^n dx^n = F^n, x^{n+1} -= dx^n diff --git a/dune/elasticity/elasticity_impl.hpp b/dune/elasticity/elasticity_impl.hpp index 3aa3ff8..34743b8 100644 --- a/dune/elasticity/elasticity_impl.hpp +++ b/dune/elasticity/elasticity_impl.hpp @@ -30,7 +30,7 @@ void Elasticity::getBmatrix(Dune::FieldMatrix::getBmatrix(Dune::FieldMatrix::getBmatrix(Dune::FieldMatrix ElasticityUpscale::extractFace(Direction dir, ctype coord) { std::vector result; - const LeafIndexSet& set = gv.leafView().indexSet(); const LeafVertexIterator itend = gv.leafView().template end(); // make a mapper for codim dim entities in the leaf grid @@ -68,7 +67,7 @@ BoundaryGrid ElasticityUpscale::extractMasterFace(Direction dir, else if (side == RIGHT) idx = set.subIndex(*cell,V2[i][0],dim); LeafVertexIterator it=start; - for (it ; it != itend; ++it) { + for (; it != itend; ++it) { if (mapper.map(*it) == idx) break; } @@ -79,7 +78,7 @@ BoundaryGrid ElasticityUpscale::extractMasterFace(Direction dir, if (side == RIGHT) idx = set.subIndex(*cell,V2[i][j],dim); LeafVertexIterator it=start; - for (it ; it != itend; ++it) { + for (; it != itend; ++it) { if (mapper.map(*it) == idx) break; } @@ -145,7 +144,6 @@ void ElasticityUpscale::findBoundaries(double* min, { max[0] = max[1] = max[2] = -1e5; min[0] = min[1] = min[2] = 1e5; - const LeafIndexSet& set = gv.leafView().indexSet(); const LeafVertexIterator itend = gv.leafView().template end(); // iterate over vertices and find slaves @@ -179,7 +177,7 @@ void ElasticityUpscale::periodicPlane(Direction plane, Direction dir, const std::vector& slave, const BoundaryGrid& master) { - for (int i=0;i::findBMatrixLLM(const SlaveGrid& slave) continue; MPC* mpc = A.getMPC(it->first,k); if (mpc) { - for (int n=0;ngetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int idx = A.getEquationForDof(mpc->getMaster(n).node, mpc->getMaster(n).dof-1); if (idx != -1) @@ -227,7 +225,7 @@ Matrix ElasticityUpscale::findBMatrixLLM(const SlaveGrid& slave) continue; MPC* mpc = A.getMPC(it->first,k); if (mpc) { - for (int n=0;ngetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int idx = A.getEquationForDof(mpc->getMaster(n).node, mpc->getMaster(n).dof-1); if (idx != -1) @@ -251,7 +249,7 @@ Matrix ElasticityUpscale::findLMatrixLLM(const SlaveGrid& slave, int nbeqn=0; std::vector dofmap(master.totalNodes()*dim,-1); int col=0; - for (int i=0;i::assemble(int loadcase, bool matrix) { const int comp = 3+(dim-2)*3; static const int bfunc = 4+(dim-2)*4; - const int N = gv.size(dim); - const LeafIndexSet& set = gv.leafView().indexSet(); const LeafIterator itend = gv.leafView().template end<0>(); Dune::FieldMatrix C; @@ -567,8 +563,6 @@ void ElasticityUpscale::assemble(int loadcase, bool matrix) materials[m++]->getConstitutiveMatrix(C); // determine geometry type of the current element and get the matching reference element Dune::GeometryType gt = it->type(); - const Dune::template GenericReferenceElement &ref = - Dune::GenericReferenceElements::general(gt); Dune::FieldMatrix Aq; K = 0; @@ -616,14 +610,9 @@ void ElasticityUpscale::averageStress(Dune::FieldVector& s return; static const int bfunc = 4+(dim-2)*4; - const int N = gv.size(dim); - const LeafIndexSet& set = gv.leafView().indexSet(); const LeafIterator itend = gv.leafView().template end<0>(); - // get a set of P1 shape functions - P1ShapeFunctionSet basis = P1ShapeFunctionSet::instance(); - Dune::FieldMatrix C; Dune::FieldVector eps0; eps0 = 0; @@ -635,8 +624,6 @@ void ElasticityUpscale::averageStress(Dune::FieldVector& s materials[m++]->getConstitutiveMatrix(C); // determine geometry type of the current element and get the matching reference element Dune::GeometryType gt = it->type(); - const Dune::template GenericReferenceElement &ref = - Dune::GenericReferenceElements::general(gt); Dune::FieldVector v; A.extractValues(v,u,it); @@ -710,7 +697,7 @@ void ElasticityUpscale::loadMaterialsFromGrid(const std::string& file) // scale E modulus of materials if (Escale > 0) { Emin = *std::min_element(Emod.begin(),Emod.end()); - for (int i=0;i::loadMaterialsFromRocklist(const std::string& f // scale E modulus of materials if (Escale > 0) { Emin=1e10; - for (int i=0;igetE()); - for (int i=0;igetE(); ((Isotropic*)cache[i])->setE(E*Escale/Emin); } @@ -780,7 +767,7 @@ void ElasticityUpscale::loadMaterialsFromRocklist(const std::string& f std::vector volume; volume.resize(cache.size()); if (file == "uniform") { - for (size_t i=0;i::periodicBCsLLM(const double* min, Dune::LeafMultipleCodimMultipleGeomTypeMapper mapper(gv); - LeafVertexIterator start=gv.leafView().template begin(); - LeafVertexIterator itend = gv.leafView().template end(); BoundaryGrid::FaceCoord fmin,fmax; // YZ plane @@ -969,10 +954,10 @@ void ElasticityUpscale::periodicBCsLLM(const double* min, // step 5 std::map m; // find matching coefficients - for (int i=0;i::setupPreconditioner() if (cell / gv.logicalCartesianSize()[2] > 0 && cell % gv.logicalCartesianSize()[2] == 0) currdomain++; - for (int i=0;i<8;++i) { + for (size_t i=0;i<8;++i) { int idx=set.subIndex(*it,i,dim); for (int d=0;d<3;++d) { MPC* mpc = A.getMPC(idx,d); if (mpc) { - for (int n=0;ngetNoMaster();++n) { + for (size_t n=0;ngetNoMaster();++n) { int row = A.getEquationForDof(mpc->getMaster(n).node,d); if (row > -1) rows[currdomain].insert(row); @@ -1034,11 +1019,11 @@ void ElasticityUpscale::setupSolvers(Solver solver) // [ 0 0 0 L3' L4' 0 0] [ub_2] [0] int r = A.getOperator().N(); int c = A.getOperator().M(); - for (int i=0;i::setupSolvers(Solver solver) // [L1' 0 0] [l_1] = [0] // [L2' 0 0] [l_2] [0] int c = A.getOperator().M(); - for (int i=0;i >& adj A.setSize(rows, cols, sum); A.setBuildMode(Matrix::random); - for (int i = 0; i < adj.size(); i++) + for (size_t i = 0; i < adj.size(); i++) A.setrowsize(i,adj[i].size()); A.endrowsizes(); @@ -53,7 +53,7 @@ Matrix MatrixOps::Axpy(const Matrix& A, const Matrix& B, double alpha) assert(A.M() == B.M() && A.N() == B.N()); // establish union adjacency pattern - std::vector > adj; + AdjacencyPattern adj; adj.resize(A.N()); for (Matrix::ConstIterator it = A.begin(); it != A.end(); ++it) { @@ -120,7 +120,7 @@ Matrix MatrixOps::augment(const Matrix& A, const Matrix& B, } if (symmetric) { // always establish diagonal elements or superLU crashes - for (int i=0;i