From 28e461356a6c660875a15673ae7f898f5b9458ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Remacle=20=28students=29?= <jean-francois.remacle@uclouvain.be> Date: Tue, 11 Aug 2009 15:00:20 +0000 Subject: [PATCH] *** empty log message *** --- Geo/GFaceCompound.cpp | 69 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 44f6186d76..319ace6f84 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -96,20 +96,6 @@ static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, std: ucg = 0.0; vcg = 0.0; - //Place at CG polygon - //-------------------- -// int nbVert = cavV.size(); -// printf("nbVert =%d \n", nbVert); - -// for (std::set<MVertex*>::const_iterator it = cavV.begin() ; it != cavV.end() ; ++it){ -// SPoint3 vsp = coordinates[*it]; -// ucg+=vsp[0]; -// vcg+=vsp[1]; -// } -// ucg/=nbVert; -// vcg/=nbVert; -// printf("ucg=%g vcg=%g \n", ucg, vcg); - //Place at CG KERNEL polygon //-------------------------- @@ -166,7 +152,7 @@ static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, std: // mat(2,0) =0.;mat(2,1)=1. ; // mat(3,0) =0.;mat(3,1)=0. ; - double eps=-5.e-6; + double eps=-5.e-7; int N=nbPts; std::set<int> setP; @@ -247,8 +233,17 @@ static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, std: vcg/=nbFinal; } else{ - Msg::Error("No Kernel for polygon. Try reparametrization with new initial mesh."); - Msg::Exit(0); + Msg::Info("----> No Kernel for polygon: place point at CG polygon."); + + //Place at CG polygon + //-------------------- + for (std::vector<MVertex*>::iterator it = cavV.begin() ; it != cavV.end() ; ++it){ + SPoint3 vsp = coordinates[*it]; + ucg+=vsp[0]; + vcg+=vsp[1]; + } + ucg/=nbPts; + vcg/=nbPts; } } @@ -286,10 +281,14 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly ite= ePoly.begin() ; while (ite != ePoly.end()){ MVertex *vB = ite->getVertex(0); + MVertex *vE = ite->getVertex(1); if( vB == vPoly.back()){ - MVertex *vE = ite->getVertex(1); - if (vE != vINIT) vPoly.push_back(vE); - ePoly.erase(ite); + if (vE != vINIT) vPoly.push_back(vE); + ePoly.erase(ite); + } + else if( vE == vPoly.back()){ + if (vB != vINIT) vPoly.push_back(vB); + ePoly.erase(ite); } else ite++; } @@ -400,9 +399,20 @@ void GFaceCompound::one2OneMap() const{ bool badCavity = checkCavity(vTri); if(badCavity){ - Msg::Info("Wrong cavity around vertex (%d onwhat=%d).", v->getNum(), v->onWhat()->dim()); + Msg::Info("Wrong cavity around vertex %d (onwhat=%d).", v->getNum(), v->onWhat()->dim()); Msg::Info("--> Place vertex at center of gravity of %d-Polygon kernel." , vTri.size()); + double u_cg, v_cg; + myPolygon(vTri, cavV); + computeCGKernelPolygon(coordinates, cavV, u_cg, v_cg); + SPoint3 p_cg(u_cg,v_cg,0); + coordinates[v] = p_cg; + +// printf("Kernel CG: ucg=%g vcg=%g \n", u_cg, v_cg); +// bool testbadCavity = checkCavity(vTri); +// if (testbadCavity == true ) printf("**** New cavity is KO \n"); +// else printf("-- New cavity is OK \n"); + // for (int i=0; i< vTri.size(); i++){ // MTriangle *t = (MTriangle*) vTri[i]; // SPoint3 v1 = coordinates[t->getVertex(0)]; @@ -426,17 +436,6 @@ void GFaceCompound::one2OneMap() const{ // printf("//Area=%g \n", a_new); // } - double u_cg, v_cg; - myPolygon(vTri, cavV); - computeCGKernelPolygon(coordinates, cavV, u_cg, v_cg); - SPoint3 p_cg(u_cg,v_cg,0); - coordinates[v] = p_cg; - - //printf("Kernel CG: ucg=%g vcg=%g \n", u_cg, v_cg); - //bool testbadCavity = checkCavity(vTri); - //if (testbadCavity == true ) printf("**** New cavity is KO \n"); - //else printf("-- New cavity is OK \n"); - } } @@ -759,9 +758,9 @@ void GFaceCompound::parametrize(iterationStep step) const Msg::Info("Parametrizing Surface %d coordinate (ITER %d)", tag(), step); #ifdef HAVE_GMM - //gmshLinearSystemGmm<double> lsys; - gmshLinearSystemCSRGmm<double> lsys; - lsys.setPrec(1.e-10); + gmshLinearSystemGmm<double> lsys; + //gmshLinearSystemCSRGmm<double> lsys; + lsys.setPrec(1.e-15); if(Msg::GetVerbosity() == 99) lsys.setNoisy(2); #else gmshLinearSystemFull<double> lsys; -- GitLab