Skip to content
Snippets Groups Projects
Commit d23e8e67 authored by Bastien Gorissen's avatar Bastien Gorissen
Browse files

Fix bug with smoothing of matched meshes

parent 7d5c07b1
No related branches found
No related tags found
No related merge requests found
...@@ -567,9 +567,10 @@ int GeomMeshMatcher::forceTomatch(GModel *geom, GModel *mesh, const double TOL) ...@@ -567,9 +567,10 @@ int GeomMeshMatcher::forceTomatch(GModel *geom, GModel *mesh, const double TOL)
} }
static void copy_vertices (GVertex *to, GVertex *from, std::map<MVertex*,MVertex*> &_mesh_to_geom){ static void copy_vertices (GVertex *to, GVertex *from, std::map<MVertex*,MVertex*> &_mesh_to_geom){
if (from) {
to->deleteMesh(); to->deleteMesh();
for (unsigned int i=0;i<from->mesh_vertices.size();i++){ if (from) {
//to->deleteMesh();
for (unsigned int i=0;i<1;i++){
MVertex *v_from = from->mesh_vertices[i]; MVertex *v_from = from->mesh_vertices[i];
MVertex *v_to = new MVertex (v_from->x(),v_from->y(),v_from->z(), to); MVertex *v_to = new MVertex (v_from->x(),v_from->y(),v_from->z(), to);
to->mesh_vertices.push_back(v_to); to->mesh_vertices.push_back(v_to);
...@@ -597,15 +598,6 @@ static void copy_vertices (GEdge* to, GEdge* from, std::map<MVertex*,MVertex*> & ...@@ -597,15 +598,6 @@ static void copy_vertices (GEdge* to, GEdge* from, std::map<MVertex*,MVertex*> &
return; return;
} }
if (from->getBeginVertex() == from->getEndVertex()) {
MVertex *v_from = from->getBeginVertex()->mesh_vertices[0];
double t;
GPoint gp = to->closestPoint(SPoint3(v_from->x(),v_from->y(),v_from->z()), t );
MEdgeVertex *v_to = new MEdgeVertex (gp.x(),gp.y(),gp.z(), to, gp.u() );
to->mesh_vertices.push_back(v_to);
_mesh_to_geom[v_from] = v_to;
}
for (unsigned int i=0;i<from->mesh_vertices.size();i++){ for (unsigned int i=0;i<from->mesh_vertices.size();i++){
MVertex *v_from = from->mesh_vertices[i]; MVertex *v_from = from->mesh_vertices[i];
double t; double t;
...@@ -719,7 +711,5 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh) ...@@ -719,7 +711,5 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh)
copy_vertices(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f); copy_vertices(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f);
copy_elements(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f); copy_elements(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f);
geom->removeDuplicateMeshVertices(1e-8);
return 1; return 1;
} }
...@@ -128,6 +128,7 @@ static bool computeEquidistantParameters(GEdge *ge, double u0, double uN, int N, ...@@ -128,6 +128,7 @@ static bool computeEquidistantParameters(GEdge *ge, double u0, double uN, int N,
return computeEquidistantParameters0(ge,u0,uN,N,u,underRelax); return computeEquidistantParameters0(ge,u0,uN,N,u,underRelax);
else if (method_for_computing_intermediary_points == 1) // use projection else if (method_for_computing_intermediary_points == 1) // use projection
return computeEquidistantParameters1(ge,u0,uN,N,u,underRelax); return computeEquidistantParameters1(ge,u0,uN,N,u,underRelax);
return false;
} }
static double mylength(GFace *gf, int i, double *u, double *v) static double mylength(GFace *gf, int i, double *u, double *v)
...@@ -251,6 +252,7 @@ static bool computeEquidistantParameters(GFace *gf, double u0, double uN, ...@@ -251,6 +252,7 @@ static bool computeEquidistantParameters(GFace *gf, double u0, double uN,
return computeEquidistantParameters0(gf,u0,uN,v0,vN,N,u,v); return computeEquidistantParameters0(gf,u0,uN,v0,vN,N,u,v);
else if (method_for_computing_intermediary_points == 1) // use projection else if (method_for_computing_intermediary_points == 1) // use projection
return computeEquidistantParameters1(gf,u0,uN,v0,vN,N,u,v); return computeEquidistantParameters1(gf,u0,uN,v0,vN,N,u,v);
return false;
} }
...@@ -288,6 +290,7 @@ static void getEdgeVertices(GEdge *ge, MElement *ele, std::vector<MVertex*> &ve, ...@@ -288,6 +290,7 @@ static void getEdgeVertices(GEdge *ge, MElement *ele, std::vector<MVertex*> &ve,
if(computeEquidistantParameters(ge, std::min(u0,u1), std::max(u0,u1), if(computeEquidistantParameters(ge, std::min(u0,u1), std::max(u0,u1),
nPts + 2, US, relax)) nPts + 2, US, relax))
break; break;
relax /= 2.0; relax /= 2.0;
if(relax < 1.e-2) if(relax < 1.e-2)
break; break;
...@@ -585,7 +588,7 @@ static void reorientQuadPoints(std::vector<MVertex*> &vtcs, int orientation, ...@@ -585,7 +588,7 @@ static void reorientQuadPoints(std::vector<MVertex*> &vtcs, int orientation,
} }
order -= 2; order -= 2;
if (start >= vtcs.size()) break; if (start >= (int) vtcs.size()) break;
} }
} }
...@@ -1331,6 +1334,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete) ...@@ -1331,6 +1334,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete)
v.insert(v.begin(), (*it)->triangles.begin(), (*it)->triangles.end()); v.insert(v.begin(), (*it)->triangles.begin(), (*it)->triangles.end());
v.insert(v.end(), (*it)->quadrangles.begin(), (*it)->quadrangles.end()); v.insert(v.end(), (*it)->quadrangles.begin(), (*it)->quadrangles.end());
hot.applySmoothingTo(v, (*it)); hot.applySmoothingTo(v, (*it));
//hot.applySmoothingTo(v, .1,0);
} }
// hot.ensureMinimumDistorsion(0.1); // hot.ensureMinimumDistorsion(0.1);
checkHighOrderTriangles("Final surface mesh", m, bad, worst); checkHighOrderTriangles("Final surface mesh", m, bad, worst);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment