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

*** empty log message ***

parent 4fbec4e2
Branches
Tags
No related merge requests found
// $Id: BDS.cpp,v 1.82 2007-10-14 17:30:42 remacle Exp $
// $Id: BDS.cpp,v 1.83 2007-10-14 19:54:16 remacle Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -786,7 +786,26 @@ bool BDS_SwapEdgeTestParametric::operator () (BDS_Point *_p1,BDS_Point *_p2,
double ori_t1 = gmsh::orient2d(op1, p1, op2);
double ori_t2 = gmsh::orient2d(op1,op2, p2);
return (ori_t1 * ori_t2 > 0);
return( ori_t1 * ori_t2 > 0 ); // the quadrangle was strictly convex !
// double ori_t1 = gmsh::orient2d(p1, p2, op1);
// double ori_t2 = gmsh::orient2d(p1, p2, op2);
// double ori_t3 = gmsh::orient2d(op1, op2, p1);
// double ori_t4 = gmsh::orient2d(op1, op2, p2);
// return (ori_t1 * ori_t2 < 0 && ori_t3 * ori_t4 < 0);
// double t1 = fabs(surface_triangle_param(_p1,_p2,_q1));
// double t2 = fabs(surface_triangle_param(_p1,_p2,_q2));
// double t3 = fabs(surface_triangle_param(_q1,_q2,_p1));
// double t4 = fabs(surface_triangle_param(_q1,_q2,_p2));
// // printf("%12.5E %12.5E %12.5E %12.5E -- %12.5E so %1d\n",t1,t2,t3,t4,fabs(t1+t2-t3-t4),fabs(t1+t2-t3-t4) > 1.e-15 * (t1+t2+t3+t4));
// if (fabs(t1+t2-t3-t4) > 1.e-13*(t1+t2+t3+t4))return false;
// return true;
}
bool BDS_Mesh::swap_edge(BDS_Edge * e, const BDS_SwapEdgeTest &theTest)
......@@ -1174,25 +1193,25 @@ bool BDS_Mesh::smooth_point_parametric(BDS_Point * p, GFace *gf)
double U = 0;
double V = 0;
// double tot_length = 0;
double tot_length = 0;
double LC = 0;
std::list < BDS_Edge * >::iterator eit = p->edges.begin();
while(eit != p->edges.end()) {
if ((*eit)->numfaces() == 1) return false;
BDS_Point *op = ((*eit)->p1 == p) ? (*eit)->p2 : (*eit)->p1;
// const double l_e = (*eit)->length();
U += op->u;
V += op->v;
// tot_length += l_e;
const double l_e = (*eit)->length();
U += op->u*l_e;
V += op->v*l_e;
tot_length += l_e;
LC += op->lc();
++eit;
}
U /= (p->edges.size());
V /= (p->edges.size());
// U /= tot_length;
// V /= tot_length;
//U /= (p->edges.size());
//V /= (p->edges.size());
U /= tot_length;
V /= tot_length;
LC /= p->edges.size();
std::list < BDS_Face * >ts;
......
// $Id: meshGFace.cpp,v 1.97 2007-10-14 17:30:42 remacle Exp $
// $Id: meshGFace.cpp,v 1.98 2007-10-14 19:54:16 remacle Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -326,10 +326,6 @@ bool edgeSwapTestDelaunay(BDS_Edge *e,GFace *gf)
double p2x[3] = {e->p2->X,e->p2->Y,e->p2->Z};
double op1x[3] = {op[0]->X,op[0]->Y,op[0]->Z};
double op2x[3] = {op[1]->X,op[1]->Y,op[1]->Z};
double p1u[2] = {e->p1->u,e->p1->v};
double p2u[2] = {e->p2->u,e->p2->v};
double op1u[2] = {op[0]->u,op[0]->v};
double op2u[2] = {op[1]->u,op[1]->v};
double fourth[3];
fourthPoint(p1x,p2x,op1x,fourth);
double result = gmsh::insphere(p1x, p2x, op1x, fourth, op2x) * gmsh::orient3d(p1x, p2x, op1x, fourth);
......@@ -393,7 +389,7 @@ void OptimizeMesh(GFace *gf, BDS_Mesh &m, const int NIT)
{
int result = edgeSwapTestQuality(*it,5);
if (result >= 0)
if(edgeSwapTestDelaunay(*it,gf) || result > 0)
if(edgeSwapTestDelaunay(*it,gf))
m.swap_edge ( *it , BDS_SwapEdgeTestParametric());
}
++it;
......@@ -545,7 +541,6 @@ void smoothVertexPass ( GFace *gf, BDS_Mesh &m, int &nb_smooth)
std::set<BDS_Point*,PointLessThan>::iterator itp = m.points.begin();
while (itp != m.points.end())
{
if(m.smooth_point_centroid(*itp,gf))
nb_smooth ++;
++itp;
......@@ -627,15 +622,15 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
splitEdgePass ( gf, m, maxE, nb_split);
//saturateEdgePass ( gf, m, maxE, nb_split);
clock_t t2 = clock();
swapEdgePass ( gf, m, nb_swap);
// swapEdgePass ( gf, m, nb_swap);
clock_t t3 = clock();
collapseEdgePass ( gf, m, minE , MAXNP, nb_collaps);
clock_t t4 = clock();
swapEdgePass ( gf, m, nb_swap);
// swapEdgePass ( gf, m, nb_swap);
clock_t t5 = clock();
smoothVertexPass ( gf, m, nb_smooth);
clock_t t6 = clock();
swapEdgePass ( gf, m, nb_swap);
// swapEdgePass ( gf, m, nb_swap);
clock_t t7 = clock();
// clean up the mesh
......@@ -653,6 +648,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT)
if (nb_split==0 && nb_collaps == 0)break;
}
double t_total = t_spl + t_sw + t_col + t_sm;
Msg(DEBUG1," ---------------------------------------");
Msg(DEBUG1," CPU Report ");
......@@ -1143,9 +1139,9 @@ bool gmsh2DMeshGenerator ( GFace *gf , int RECUR_ITER, bool debug = true)
if (!AlgoDelaunay2D ( gf ))
{
RefineMesh (gf,*m, CTX.mesh.refine_steps);
OptimizeMesh(gf, *m, 2);
RefineMesh (gf,*m, -CTX.mesh.refine_steps);
OptimizeMesh(gf, *m, 2);
// OptimizeMesh(gf, *m, 2);
// RefineMesh (gf,*m, -CTX.mesh.refine_steps);
// OptimizeMesh(gf, *m, 2);
if (gf->meshAttributes.recombine)
{
m->recombineIntoQuads (gf->meshAttributes.recombineAngle,gf);
......@@ -1824,7 +1820,7 @@ void meshGFace::operator() (GFace *gf)
// temp fix until we create MEdgeLoops in gmshFace
Msg(DEBUG1, "Generating the mesh");
if(gf->getNativeType() == GEntity::GmshModel || gf->edgeLoops.empty()){
gmsh2DMeshGenerator(gf,0, false);
gmsh2DMeshGenerator(gf,0, true);
}
else{
if(!gmsh2DMeshGeneratorPeriodic(gf,false))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment