diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index 55d4ac65775c7a1b05a78cca80a16308510b9004..a7604efaffe8e2b75ac2510589bbdc7b35464ca2 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -23,7 +23,7 @@ CellComplex::CellComplex( std::vector<GEntity*> domain, _multidim = false; int dim = 0; - for(int i = 0; i < domain.size(); i++){ + for(unsigned int i = 0; i < domain.size(); i++){ GEntity* entity = domain.at(i); if(i == 0) dim = entity->dim(); if(dim != entity->dim()){ @@ -258,7 +258,7 @@ CellComplex::~CellComplex() _ocells[i].clear(); } - for(int i = 0; i < _newcells.size(); i++) delete _newcells.at(i); + for(unsigned int i = 0; i < _newcells.size(); i++) delete _newcells.at(i); _newcells.clear(); } diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index e8e6b71f36812ceb3ac993e929fdf3d8161acaef..eb88538161679ee1332abd69cc4af8e3749abc92 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -491,7 +491,7 @@ bool Chain::deform(std::map<Cell*, int, Less_Cell>& cellsInChain, if(cc.empty() || (getDim() == 2 && cc.size() < 2) ) return false; int inout = cc[0]*bc[0]; - for(int i = 0; i < cc.size(); i++){ + for(unsigned int i = 0; i < cc.size(); i++){ if(cc[i]*bc[i] != inout) return false; } diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index b30aedc1368116059539517fddabf2ffabe76564..ae9b6cf627f1be260203e3e8d23456d13481e39d 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -91,7 +91,7 @@ Homology::Homology(GModel* model, std::vector<int> physicalDomain, Homology::~Homology(){ delete _cellComplex; for(int i = 0; i < 4; i++) { - for(int j = 0; j < _generators[i].size(); j++){ + for(unsigned int j = 0; j < _generators[i].size(); j++){ Chain* chain = _generators[i].at(j); //_model->deletePhysicalGroup(chain->getDim(), chain->getNum()); delete chain; @@ -368,7 +368,7 @@ std::string Homology::getDomainString() void Homology::createPViews() { for(int i = 0; i < 4; i++){ - for(int j = 0; j < _generators[i].size(); j++){ + for(unsigned int j = 0; j < _generators[i].size(); j++){ Chain* chain = _generators[i].at(j); chain->createPView(); } diff --git a/Geo/MTriangle.cpp b/Geo/MTriangle.cpp index 5e3534c34bcde0020e83f337e9e6f312a3ed04f5..34160161b43005e82d4c33a5466b03bda9549687 100644 --- a/Geo/MTriangle.cpp +++ b/Geo/MTriangle.cpp @@ -38,16 +38,15 @@ double MTriangle::getInnerRadius() { #if defined(HAVE_MESH) double r = 0.; - int n = getNumEdges(); + const int n = getNumEdges(); double dist[n]; double k = 0.; - for (int i=0; i<n; i++) - { - MEdge e = getEdge(i); - dist[i] = e.getVertex(0)->distance(e.getVertex(1)); - k+=0.5*dist[i]; + for (int i = 0; i < n; i++){ + MEdge e = getEdge(i); + dist[i] = e.getVertex(0)->distance(e.getVertex(1)); + k += 0.5 * dist[i]; } - r=sqrt(k*(k-dist[0])*(k-dist[1])*(k-dist[2]))/k; + r = sqrt(k * (k - dist[0]) * (k - dist[1]) * (k - dist[2])) / k; return r; #else return 0.; diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp index 16f893a6c964922424225aff2b78905417ab74f8..9e884e9fcf51949bcc0520eaeb333554c5fc9c6b 100644 --- a/Mesh/meshPartition.cpp +++ b/Mesh/meshPartition.cpp @@ -221,45 +221,43 @@ int RenumberMeshElements( std::vector<MElement*> &elements, meshPartitionOptions int RenumberMesh(GModel *const model, meshPartitionOptions &options) { - for (GModel::fiter it = model->firstFace() ; it != model->lastFace() ; ++it){ std::vector<MElement *> temp; - temp.insert(temp.begin(),(*it)->triangles.begin(),(*it)->triangles.end()); - RenumberMeshElements (temp,options); + temp.insert(temp.begin(), (*it)->triangles.begin(), (*it)->triangles.end()); + RenumberMeshElements(temp, options); (*it)->triangles.clear(); - for (int i=0;i<temp.size();i++) (*it)->triangles.push_back((MTriangle*)temp[i]); - + for(unsigned int i = 0; i <temp.size(); i++) + (*it)->triangles.push_back((MTriangle*)temp[i]); temp.clear(); temp.insert(temp.begin(),(*it)->quadrangles.begin(),(*it)->quadrangles.end()); RenumberMeshElements (temp,options); (*it)->quadrangles.clear(); - for (int i=0;i<temp.size();i++) (*it)->quadrangles.push_back((MQuadrangle*)temp[i]); + for(unsigned int i = 0; i < temp.size(); i++) + (*it)->quadrangles.push_back((MQuadrangle*)temp[i]); } for (GModel::riter it = model->firstRegion() ; it != model->lastRegion() ; ++it){ std::vector<MElement *> temp; - temp.insert(temp.begin(),(*it)->tetrahedra.begin(),(*it)->tetrahedra.end()); - RenumberMeshElements (temp,options); + temp.insert(temp.begin(), (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); + RenumberMeshElements(temp, options); (*it)->tetrahedra.clear(); - for (int i=0;i<temp.size();i++) (*it)->tetrahedra.push_back((MTetrahedron*)temp[i]); - + for (int i = 0; i < temp.size(); i++) + (*it)->tetrahedra.push_back((MTetrahedron*)temp[i]); temp.clear(); temp.insert(temp.begin(),(*it)->hexahedra.begin(),(*it)->hexahedra.end()); RenumberMeshElements (temp,options); (*it)->hexahedra.clear(); - for (int i=0;i<temp.size();i++) (*it)->hexahedra.push_back((MHexahedron*)temp[i]); + for (unsigned int i = 0; i < temp.size(); i++) + (*it)->hexahedra.push_back((MHexahedron*)temp[i]); } return 1; } - - int PartitionMesh(GModel *const model, meshPartitionOptions &options) { - Graph graph; BoElemGrVec boElemGrVec; int ier; diff --git a/Mesh/multiscalePartition.cpp b/Mesh/multiscalePartition.cpp index 6ae61efc40fc931dcdaaa4f7edfeaa80bc3f2572..658f998a54060ecd6489b6c4473cf6f5c3e6f2d7 100644 --- a/Mesh/multiscalePartition.cpp +++ b/Mesh/multiscalePartition.cpp @@ -71,8 +71,8 @@ static void connectedRegions (std::vector<MElement*> &elements, std::vector<std::vector<MElement*> > ®ions) { std::multimap<MEdge,MElement*,Less_Edge> e2e; - for (int i=0;i<elements.size();++i){ - for (int j=0;j<elements[i]->getNumEdges();j++){ + for (unsigned int i = 0; i < elements.size(); ++i){ + for (int j = 0; j < elements[i]->getNumEdges(); j++){ e2e.insert(std::make_pair(elements[i]->getEdge(j),elements[i])); } } @@ -162,7 +162,7 @@ static int getAspectRatio(std::vector<MElement *> &elements, tot_length += iLength; } int AR = 1.0; - if (boundaries.size() > 0 ){ + if (boundaries.size() > 0){ tot_length /= boundaries.size(); AR = (int) ceil(2*3.14*area3D/(tot_length*tot_length)); } @@ -238,7 +238,7 @@ static void partitionRegions(std::vector<MElement*> &elements, std::vector<std::vector<MElement*> > conRegions; conRegions.clear(); connectedRegions (regions[k], conRegions); - for (int j=0; j< conRegions.size() ; j++) + for (unsigned int j = 0; j < conRegions.size(); j++) allRegions.push_back(conRegions[j]); } regions.clear(); @@ -254,8 +254,8 @@ static void printLevel(std::vector<MElement *> &elements, int recur, int region) double version = 2.0; std::set<MVertex*> vs; - for (int i=0;i<elements.size();i++){ - for (int j=0;j<elements[i]->getNumVertices();j++){ + for (unsigned int i = 0; i < elements.size(); i++){ + for (int j = 0; j < elements[i]->getNumVertices(); j++){ vs.insert(elements[i]->getVertex(j)); } } @@ -277,15 +277,16 @@ static void printLevel(std::vector<MElement *> &elements, int recur, int region) fprintf(fp,"$EndNodes\n",elements.size()); fprintf(fp,"$Elements\n%d\n", (int)elements.size()); - for (int i=0;i<elements.size();i++){ - elements[i]->writeMSH(fp,version); + for (unsigned int i = 0; i < elements.size(); i++){ + elements[i]->writeMSH(fp, version); } fprintf(fp,"$EndElements\n%d\n", (int)elements.size()); fclose(fp); } -multiscalePartition::multiscalePartition(std::vector<MElement *> &elements, int nbParts, typeOfPartition method) +multiscalePartition::multiscalePartition(std::vector<MElement *> &elements, + int nbParts, typeOfPartition method) { options = CTX::instance()->partitionOptions; options.num_partitions = nbParts; @@ -315,7 +316,8 @@ void multiscalePartition::setNumberOfPartitions(int &nbParts) } } -void multiscalePartition::partition(partitionLevel & level, int nbParts, typeOfPartition method) +void multiscalePartition::partition(partitionLevel & level, int nbParts, + typeOfPartition method) { #if defined(HAVE_METIS) || defined(HAVE_CHACO)