Skip to content
Snippets Groups Projects
Commit e8d8852b authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 8935c92e
Branches
Tags
No related merge requests found
// $Id: BDS.cpp,v 1.74 2007-03-18 12:49:30 geuzaine Exp $ // $Id: BDS.cpp,v 1.75 2007-04-12 13:09:09 remacle Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -1010,6 +1010,69 @@ bool test_move_point_parametric_triangle (BDS_Point * p, double u, double v, BDS ...@@ -1010,6 +1010,69 @@ bool test_move_point_parametric_triangle (BDS_Point * p, double u, double v, BDS
return ori_init*ori_final > 0; return ori_init*ori_final > 0;
} }
bool BDS_Mesh::smooth_point_centroid(BDS_Point * p, GFace *gf)
{
if (!p->config_modified)return false;
if(p->g && p->g->classif_degree <= 1)
return false;
std::list < BDS_Edge * >::iterator eit = p->edges.begin();
while(eit != p->edges.end()) {
if ((*eit)->numfaces() == 1) return false;
eit++;
}
double U = 0;
double V = 0;
double LC = 0;
std::list < BDS_Face * >ts;
p->getTriangles(ts);
std::list < BDS_Face * >::iterator it = ts.begin();
std::list < BDS_Face * >::iterator ite = ts.end();
double sTot = 0;
while(it != ite) {
BDS_Face *t = *it;
BDS_Point *n[4];
t->getNodes(n);
double S = fabs(surface_triangle(n[0],n[1],n[2]));
S = 1;
sTot += S;
U += (n[0]->u + n[1]->u + n[2]->u) *S;
V += (n[0]->v + n[1]->v + n[2]->v) *S;
LC += (n[0]->lc() + n[1]->lc() + n[2]->lc()) *S;
++it;
}
U /= (3.*sTot);
V /= (3.*sTot);
LC /= (3.*sTot);
it = ts.begin();
while(it != ite) {
BDS_Face *t = *it;
if (!test_move_point_parametric_triangle ( p, U, V, t))
return false;
++it;
}
GPoint gp = gf->point(U*scalingU,V*scalingV);
p->u = U;
p->v = V;
p->lc() = LC;
p->X = gp.x();
p->Y = gp.y();
p->Z = gp.z();
eit = p->edges.begin();
while(eit != p->edges.end()) {
(*eit)->update();
++eit;
}
return true;
}
bool BDS_Mesh::smooth_point_parametric(BDS_Point * p, GFace *gf) bool BDS_Mesh::smooth_point_parametric(BDS_Point * p, GFace *gf)
{ {
... ...
......
...@@ -424,6 +424,7 @@ public: ...@@ -424,6 +424,7 @@ public:
void snap_point(BDS_Point* , BDS_Mesh *geom = 0); void snap_point(BDS_Point* , BDS_Mesh *geom = 0);
bool smooth_point(BDS_Point* , BDS_Mesh *geom = 0); bool smooth_point(BDS_Point* , BDS_Mesh *geom = 0);
bool smooth_point_parametric(BDS_Point * p, GFace *gf); bool smooth_point_parametric(BDS_Point * p, GFace *gf);
bool smooth_point_centroid(BDS_Point * p, GFace *gf);
bool move_point(BDS_Point *p , double X, double Y, double Z); bool move_point(BDS_Point *p , double X, double Y, double Z);
void split_edge(BDS_Edge *, BDS_Point *); void split_edge(BDS_Edge *, BDS_Point *);
bool edge_constraint ( BDS_Point *p1, BDS_Point *p2 ); bool edge_constraint ( BDS_Point *p1, BDS_Point *p2 );
... ...
......
// $Id: meshGFace.cpp,v 1.70 2007-04-12 08:47:25 remacle Exp $ // $Id: meshGFace.cpp,v 1.71 2007-04-12 13:13:55 remacle Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -266,7 +266,7 @@ void OptimizeMesh(GFace *gf, BDS_Mesh &m, const int NIT) ...@@ -266,7 +266,7 @@ void OptimizeMesh(GFace *gf, BDS_Mesh &m, const int NIT)
if(m.collapse_edge_parametric ( (*ite), (*itp)))break; if(m.collapse_edge_parametric ( (*ite), (*itp)))break;
} }
else else
m.smooth_point_parametric(*itp,gf); m.smooth_point_centroid(*itp,gf);
++itp; ++itp;
} }
} }
...@@ -487,7 +487,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT) ...@@ -487,7 +487,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
while (itp != m.points.end()) while (itp != m.points.end())
{ {
if(m.smooth_point_parametric(*itp,gf)) if(m.smooth_point_centroid(*itp,gf))
nb_smooth ++; nb_smooth ++;
++itp; ++itp;
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment