diff --git a/Common/GamePad.cpp b/Common/GamePad.cpp index 88c8274d223c3a8c31a852078142273d6c3919c1..ab8c21efa8f6e4c30caaeed77a70139b1e259115 100644 --- a/Common/GamePad.cpp +++ b/Common/GamePad.cpp @@ -173,8 +173,8 @@ int GamePad::read_event() } for (int i = 0; i < 6; i++) if(fabs(axe[i]) < .01) axe[i] = 0.; bool event = false; - int event_num; - bool event_value; + int event_num = 0; + bool event_value = false; for (int i = 0; i < buttons; i++){ int bin = pow(2, i); if(button[i] != (bool)(infoex.dwButtons & bin)) { diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index b3ddfdd40f340741dd46ca753a6adf60a7003a22..56c922f3a584ee9fd357bbeb657cb580a039aa57 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -1961,7 +1961,7 @@ GPoint GFaceCompound::pointInRemeshedOctree(double par1, double par2) const } } - printf("size octrre new = %d \n", myParamElems.size()); + //printf("size octrre new = %d \n", myParamElems.size()); octNew = new MElementOctree(myParamElems); //build kdtree boundary nodes in parametric space @@ -2470,7 +2470,7 @@ void GFaceCompound::buildOct() const {_gfct[count].p2.y() - _gfct[count].p1.y(), _gfct[count].p3.y() - _gfct[count].p1.y()}}; double inv[2][2]; - double det = inv2x2(mat,inv); + inv2x2(mat, inv); SVector3 dXdxi (_gfct[count].v2 - _gfct[count].v1); SVector3 dXdeta(_gfct[count].v3 - _gfct[count].v1); SVector3 dXdu(dXdxi * inv[0][0] + dXdeta * inv[1][0]); @@ -2503,7 +2503,7 @@ void GFaceCompound::buildOct() const std::vector<MElement*> vTri = it->second; SVector3 dXdu(0.0), dXdv(0.0); int nbTri = vTri.size(); - for (unsigned int j = 0; j < nbTri; j++){ + for (int j = 0; j < nbTri; j++){ dXdu += firstElemDerivatives[vTri[j]].first(); dXdv += firstElemDerivatives[vTri[j]].second(); } diff --git a/Geo/boundaryLayersData.cpp b/Geo/boundaryLayersData.cpp index 6b01a2c6f715f3ca45cb94691cffc66a1ccbc6f3..3acad8e02cf10785ccb6ab9f5383fa2420bbe405 100644 --- a/Geo/boundaryLayersData.cpp +++ b/Geo/boundaryLayersData.cpp @@ -397,9 +397,9 @@ bool buildAdditionalPoints2D (GFace *gf, BoundaryLayerColumns *_columns) if (N1.size() == 2){ int fanSize = M_PI / _treshold; - printf("%g %g --> %g %g \n",e1.getVertex(0)->x(),e1.getVertex(0)->y(), - e1.getVertex(1)->x(),e1.getVertex(1)->y()); - printf("N1.size = %d %g %g %g %g\n",N1.size(),N1[0].x(),N1[0].y(),N1[1].x(),N1[1].y()); + //printf("%g %g --> %g %g \n",e1.getVertex(0)->x(),e1.getVertex(0)->y(), + // e1.getVertex(1)->x(),e1.getVertex(1)->y()); + //printf("N1.size = %d %g %g %g %g\n",N1.size(),N1[0].x(),N1[0].y(),N1[1].x(),N1[1].y()); double alpha1 = atan2(N1[0].y(),N1[0].x()); double alpha2 = atan2(N1[1].y(),N1[1].x()); @@ -469,10 +469,10 @@ bool buildAdditionalPoints2D (GFace *gf, BoundaryLayerColumns *_columns) break; } // printf("%g %g %g \n",current->x(),current->y(),blf->current_distance); - if (0 && blf->current_closest != catt || blf -> current_distance < _current_distance){ + if (0 && (blf->current_closest != catt || blf -> current_distance < _current_distance)){ SVector3 aaa (_close- blf->_closest_point); if (aaa.norm() > 8*blf->hwall_n || blf -> current_distance < _current_distance){ - printf("reaching the skelton %d %g %g\n", (int) _column.size(), aaa.norm(),blf->hwall_n); + // printf("reaching the skelton %d %g %g\n", (int) _column.size(), aaa.norm(),blf->hwall_n); delete _column[_column.size()-1]; _column.erase(--_column.end()); _metrics.erase(--_metrics.end()); diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index 39a400f01b21e5327a82a9e0410ee63332a0717f..0dc3fb162eb45a7b3c67a98650baad9b202f23fc 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -1915,7 +1915,7 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge void BoundaryLayerField::computeFor1dMesh (double x, double y, double z, SMetric3 &metr) { - double xpk,ypk,zpk; + double xpk = 0., ypk = 0., zpk = 0.; double distk = 1.e22; for(std::list<int>::iterator it = nodes_id.begin(); it != nodes_id.end(); ++it) { @@ -1923,19 +1923,19 @@ void BoundaryLayerField::computeFor1dMesh (double x, double y, double z, double xp = v->x(); double yp = v->y(); double zp = v->z(); - const double dist = sqrt ((x-xp)*(x-xp)+ - (y-yp)*(y-yp)+ - (z-zp)*(z-zp)); + const double dist = sqrt ((x - xp) *(x - xp)+ + (y - yp) *(y - yp)+ + (z - zp) *(z - zp)); if (dist < distk){ distk = dist; - xpk=xp; - ypk=yp; - zpk=zp; + xpk = xp; + ypk = yp; + zpk = zp; } } const double ll1 = (distk*(ratio-1) + hwall_n) / (1. + 0.5 * (ratio - 1)); - //const double ll1 = (distk*(ratio-1) + hwall_n) / (1.); + // const double ll1 = (distk*(ratio-1) + hwall_n) / (1.); double lc_n = std::min(ll1,hfar); if (distk > thickness) lc_n = hfar; @@ -1946,7 +1946,6 @@ void BoundaryLayerField::computeFor1dMesh (double x, double y, double z, metr = buildMetricTangentToCurve(t1,lc_n,lc_n); } - void BoundaryLayerField::operator() (AttractorField *cc, double dist, double x, double y, double z, SMetric3 &metr, GEntity *ge) diff --git a/Mesh/directions3D.cpp b/Mesh/directions3D.cpp index 7507dfc3bd3b693161d5d9ef74925ad28cd84abc..9e6adac3882b1be986711f788f599b77f82ad3fc 100644 --- a/Mesh/directions3D.cpp +++ b/Mesh/directions3D.cpp @@ -996,8 +996,7 @@ void Frame_field::continuousCrossField(GRegion *gr, GFace *gf){ fprintf(fi,"};\n"); fclose (fi); - printf("touched =%d vert =%d \n", touched.size(), vertex_to_vertices.size()); - + //printf("touched =%d vert =%d \n", touched.size(), vertex_to_vertices.size()); } void Frame_field::saveCrossField(const std::string& filename, double scale, bool full){ diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 4f463cceb50641386825822d0b06ddad284a808e..25579c3a62f9e8df01ddac4406d0d3d405c2c1d6 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1920,28 +1920,29 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true) std::map<BDS_Point*, MVertex*>::iterator it = recoverMap.begin(); while(it != recoverMap.end()){ // we have twice vertex MVertex with 2 different coordinates - MVertex * mv1 = it->second; - BDS_Point* bds = it->first; + MVertex *mv1 = it->second; + BDS_Point *bds = it->first; std::map<MVertex*, BDS_Point*>::iterator invIt = invertMap.find(mv1); if (invIt != invertMap.end()){ // create a new "fake" vertex that will be destroyed afterwards - MVertex * mv2 ; + MVertex *mv2 = 0; if (mv1->onWhat()->dim() == 1) { double t; mv1->getParameter(0,t); - mv2 = new MEdgeVertex (mv1->x(),mv1->y(),mv1->z(),mv1->onWhat(), t, - ((MEdgeVertex*)mv1)->getLc()); + mv2 = new MEdgeVertex(mv1->x(),mv1->y(),mv1->z(),mv1->onWhat(), t, + ((MEdgeVertex*)mv1)->getLc()); } else if (mv1->onWhat()->dim() == 0) { - mv2 = new MVertex (mv1->x(),mv1->y(),mv1->z(),mv1->onWhat()); + mv2 = new MVertex (mv1->x(),mv1->y(),mv1->z(),mv1->onWhat()); } else - Msg::Error("error in seam reconstruction"); - - it->second = mv2; - equivalence[mv2] = mv1; - parametricCoordinates[mv2] = SPoint2(bds->u,bds->v); - invertMap[mv2] = bds; + Msg::Error("Could not reconstruct seam"); + if(mv2){ + it->second = mv2; + equivalence[mv2] = mv1; + parametricCoordinates[mv2] = SPoint2(bds->u,bds->v); + invertMap[mv2] = bds; + } } else { parametricCoordinates[mv1] = SPoint2(bds->u,bds->v); @@ -1949,9 +1950,9 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true) } ++it; } - // recoverMap.insert(new_relations.begin(), new_relations.end()); + // recoverMap.insert(new_relations.begin(), new_relations.end()); } - Msg::Info("%d points that are duplicated for delaunay meshing",equivalence.size()); + Msg::Info("%d points that are duplicated for Delaunay meshing", equivalence.size()); // fill the small gmsh structures { diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index 34223cc01133f05e8d1c777c8f9b9cfe302b1aae..3c67143c9889f1492a051d5927841bc8bfa72027 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -889,7 +889,6 @@ void gmshRuppert(GFace *gf, double minqual, int MAXPNT, return; } - int ITER = 0; int NBDELETED = 0; while (1){ MTri3 *worst = *AllTris.begin(); diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index c3a5568146039c69bd87dfb841eca4f01bb02329..e7c5e29075fb2805f2f36943601cd386fe6c9510 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -169,9 +169,9 @@ void buildMeshGenerationDataStructures(GFace *gf, std::list<GEdge*>::iterator ite = embedded_edges.begin(); while(ite != embedded_edges.end()){ if(!(*ite)->isMeshDegenerated()){ - for (int i=0;i<(*ite)->lines.size();i++) - data.internalEdges.insert (MEdge((*ite)->lines[i]->getVertex(0), - (*ite)->lines[i]->getVertex(1))); + for (unsigned int i = 0; i < (*ite)->lines.size(); i++) + data.internalEdges.insert(MEdge((*ite)->lines[i]->getVertex(0), + (*ite)->lines[i]->getVertex(1))); } ++ite; } @@ -2238,11 +2238,9 @@ int optiSmoothing(GFace *gf, int niter, bool infinity_norm) return N; } - - int untangleInvalidQuads(GFace *gf, int niter) { - // return 0; + // return 0; int N = 0; #if defined(HAVE_BFGS) v2t_cont adj; @@ -2259,33 +2257,35 @@ int untangleInvalidQuads(GFace *gf, int niter) return N; } -static int orientationOK (GFace *gf, MVertex *v1, MVertex *v2, MVertex *v3){ - SPoint2 p1,p2,p3; - reparamMeshVertexOnFace(v1,gf, p1); - reparamMeshVertexOnFace(v2,gf, p2); - reparamMeshVertexOnFace(v3,gf, p3); - if (robustPredicates::orient2d (p1,p2,p3) < 0)return true; +static int orientationOK (GFace *gf, MVertex *v1, MVertex *v2, MVertex *v3) +{ + SPoint2 p1, p2, p3; + reparamMeshVertexOnFace(v1, gf, p1); + reparamMeshVertexOnFace(v2, gf, p2); + reparamMeshVertexOnFace(v3, gf, p3); + if (robustPredicates::orient2d(p1, p2, p3) < 0) return true; return false; } -static int allowSwap (GFace *gf, MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4){ +static int allowSwap (GFace *gf, MVertex *v1, MVertex *v2, MVertex *v3, MVertex *v4) +{ SPoint2 p1,p2,p3,p4; - reparamMeshVertexOnFace(v1,gf, p1); - reparamMeshVertexOnFace(v2,gf, p2); - reparamMeshVertexOnFace(v3,gf, p3); - reparamMeshVertexOnFace(v4,gf, p4); - if (robustPredicates::orient2d (p1,p2,p3) * - robustPredicates::orient2d (p1,p2,p4) < 0 && - robustPredicates::orient2d (p3,p4,p1) * - robustPredicates::orient2d (p3,p4,p2) > 0)return true; + reparamMeshVertexOnFace(v1, gf, p1); + reparamMeshVertexOnFace(v2, gf, p2); + reparamMeshVertexOnFace(v3, gf, p3); + reparamMeshVertexOnFace(v4, gf, p4); + if (robustPredicates::orient2d(p1, p2, p3) * + robustPredicates::orient2d(p1, p2, p4) < 0 && + robustPredicates::orient2d(p3, p4, p1) * + robustPredicates::orient2d(p3, p4, p2) > 0) return true; return false; } -static double myShapeMeasure(MElement *e){ +static double myShapeMeasure(MElement *e) +{ return e->etaShapeMeasure(); } - int _edgeSwapQuadsForBetterQuality(GFace *gf, double eps, std::set<MEdge,Less_Edge> &prioritory) { e2t_cont adj; @@ -3741,4 +3741,4 @@ void Temporary::quadrilaterize(std::string file_name,double _w1,double _w2,doubl /***************************************************/ /***************************************************/ -/***************************************************/ \ No newline at end of file +/***************************************************/ diff --git a/Solver/frameSolver.h b/Solver/frameSolver.h index 9bf9ea753bfb771fca81bc66f8449e224ffcca0c..6494a9a26a15de8d7ce5f55ec51bb97534f9897b 100644 --- a/Solver/frameSolver.h +++ b/Solver/frameSolver.h @@ -25,11 +25,11 @@ struct gmshBeam2d int _rotationTags [2]; fullMatrix<double> _stiffness; gmshBeam2d (MLine *l, double E , double I, double A, int r[2]) - : _element(l), _A(A), _E(E), _I(I){ + : _element(l), _I(I), _A(A), _E(E){ _L = distance(_element->getVertex(0),_element->getVertex(1)); _rotationTags[0] = _rotationTags[1] = 0; - _rigidNodes[0] = r[0];_rigidNodes[1] = r[1]; - for (int i=0;i<6;i++)_displacement[i] = 0.; + _rigidNodes[0] = r[0]; _rigidNodes[1] = r[1]; + for (int i = 0; i < 6; i++) _displacement[i] = 0.; } inline bool isRigid(MVertex*v)const{ return _element->getVertex(0) == v ? _rigidNodes[0] : _rigidNodes[1]; @@ -41,10 +41,10 @@ struct gmshBeam2d struct gmshFixation { - GVertex * _vertex; + GVertex *_vertex; int _direction; double _value; - gmshFixation (GVertex *v, int d, double val) : _vertex(v),_direction(d), _value(val) {} + gmshFixation (GVertex *v, int d, double val) : _vertex(v), _direction(d), _value(val) {} }; // a solver that computes equilibriums of frames... @@ -53,23 +53,21 @@ class frameSolver2d dofManager<double> *pAssembler; std::vector<gmshBeam2d> _beams; std::vector<std::pair<GVertex*,std::vector<double> > > _nodalForces; - std::vector<gmshFixation > _fixations; + std::vector<gmshFixation> _fixations; GModel *_myModel; void computeStiffnessMatrix (int iBeam, fullMatrix<double> &K); void createDofs () ; void computeRotationTags () ; void addBeamsOrBars (const std::vector<int> &modelEdges, double E, double I, double A, int r[2]); - - public: - frameSolver2d (GModel* myModel); - void addBeams (const std::vector<int> &modelEdges, - double E, double I, double A); - void addBars (const std::vector<int> &modelEdges, + frameSolver2d(GModel* myModel); + void addBeams(const std::vector<int> &modelEdges, double E, double I, double A); - void addNodalForces (const std::vector<int> &modelVertices, const std::vector<double> & force); - void addFixations (const std::vector<int> & dirs, const std::vector<int> &modelVertices, double value); + void addBars(const std::vector<int> &modelEdges, + double E, double I, double A); + void addNodalForces(const std::vector<int> &modelVertices, const std::vector<double> & force); + void addFixations(const std::vector<int> & dirs, const std::vector<int> &modelVertices, double value); void exportFrameData(const char * displ, const char* M); void solve () ; };