Skip to content
Snippets Groups Projects
Commit 10178848 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix infinite loop
parent 2a72e277
No related branches found
No related tags found
No related merge requests found
// $Id: gmshFace.cpp,v 1.42 2007-09-26 20:51:58 geuzaine Exp $
// $Id: gmshFace.cpp,v 1.43 2007-11-27 16:45:27 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -96,6 +96,7 @@ gmshFace::gmshFace(GModel *m, int num)
{
s = Create_Surface(num, MSH_SURF_DISCRETE);
Tree_Add(m->getGEOInternals()->Surfaces, &s);
meshStatistics.status = GFace::DONE;
}
void gmshFace::setModelEdges(std::list<GEdge*>&ed)
......
// $Id: Generator.cpp,v 1.125 2007-11-26 14:34:10 remacle Exp $
// $Id: Generator.cpp,v 1.126 2007-11-27 16:45:27 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -188,21 +188,19 @@ void PrintMesh2dStatistics (GModel *m)
double worst = 1, best = 0, avg = 0;
double e_long = 0, e_short = 1.e22, e_avg = 0;
int nTotT=0,nTotE=0,nTotGoodLength=0,nTotGoodQuality=0,nUnmeshed=0,numFaces=0;
int nTotT = 0, nTotE = 0, nTotGoodLength = 0, nTotGoodQuality = 0;
int nUnmeshed = 0, numFaces = 0;
Msg(INFO,"2D Mesh Statistics :");
for (GModel::fiter it = m->firstFace() ; it!=m->lastFace(); ++it)
{
for(GModel::fiter it = m->firstFace() ; it!=m->lastFace(); ++it){
worst = std::min((*it)->meshStatistics.worst_element_shape, worst);
best = std::max((*it)->meshStatistics.best_element_shape, best);
avg += (*it)->meshStatistics.average_element_shape * (*it)->meshStatistics.nbTriangle;
e_avg += (*it)->meshStatistics.efficiency_index;//* (*it)->meshStatistics.nbEdge;
e_long = std::max((*it)->meshStatistics.longest_edge_length, e_long);
e_short = std::min((*it)->meshStatistics.smallest_edge_length, e_short);
if ((*it)->meshStatistics.status == GFace::FAILED || (*it)->meshStatistics.status == GFace::PENDING)nUnmeshed++;
if ((*it)->meshStatistics.status == GFace::FAILED ||
(*it)->meshStatistics.status == GFace::PENDING) nUnmeshed++;
nTotT += (*it)->meshStatistics.nbTriangle;
nTotE += (*it)->meshStatistics.nbEdge;
nTotGoodLength += (*it)->meshStatistics.nbGoodLength;
......@@ -211,16 +209,19 @@ void PrintMesh2dStatistics (GModel *m)
}
if(CTX.create_append_statreport == 1){
fprintf(statreport,"2D stats\tname\t\t#faces\t\t#fail\t\t#t\t\tQavg\t\tQbest\t\tQworst\t\t#Q>90\t\t#Q>90/#t\t#e\t\ttau\t\t#Egood\t\t#Egood/#e\tCPU\n");
fprintf(statreport, "2D stats\tname\t\t#faces\t\t#fail\t\t"
"#t\t\tQavg\t\tQbest\t\tQworst\t\t#Q>90\t\t#Q>90/#t\t"
"#e\t\ttau\t\t#Egood\t\t#Egood/#e\tCPU\n");
}
fprintf(statreport,"\t%16s\t%d\t\t%d\t\t", CTX.base_filename, numFaces, nUnmeshed);
fprintf(statreport,"%d\t\t%8.7f\t%8.7f\t%8.7f\t%d\t\t%8.7f\t",
nTotT,avg/(double)nTotT,best,worst,nTotGoodQuality,(double)nTotGoodQuality/nTotT);
nTotT, avg / (double)nTotT, best, worst, nTotGoodQuality,
(double)nTotGoodQuality / nTotT);
fprintf(statreport,"%d\t\t%8.7f\t%d\t\t%8.7f\t%8.1f\n",
nTotE,exp(e_avg/(double)nTotE),nTotGoodLength,(double)nTotGoodLength/nTotE,CTX.mesh_timer[1]);
nTotE, exp(e_avg / (double)nTotE), nTotGoodLength,
(double)nTotGoodLength / nTotE, CTX.mesh_timer[1]);
fclose(statreport);
}
void Mesh2D(GModel *m)
......@@ -245,20 +246,20 @@ void Mesh2D(GModel *m)
if(!Mesh2DWithBoundaryLayers(m)){
std::for_each(m->firstFace(), m->lastFace(), meshGFace());
int nIter = 0;
while(1)
{
while(1){
meshGFace mesher;
int nbPending = 0;
for (GModel::fiter it = m->firstFace() ; it!=m->lastFace(); ++it)
{
if ((*it)->meshStatistics.status == GFace::PENDING){mesher(*it);nbPending++;}
for(GModel::fiter it = m->firstFace() ; it!=m->lastFace(); ++it){
if ((*it)->meshStatistics.status == GFace::PENDING){
mesher(*it);
nbPending++;
}
}
if(!nbPending) break;
if (nIter > 10)break;
if(nIter++ > 10) break;
}
}
double t2 = Cpu();
CTX.mesh_timer[1] = t2 - t1;
Msg(INFO, "Mesh 2D complete (%g s)", CTX.mesh_timer[1]);
......
// $Id: meshGFaceExtruded.cpp,v 1.22 2007-08-02 16:16:19 geuzaine Exp $
// $Id: meshGFaceExtruded.cpp,v 1.23 2007-11-27 16:45:27 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -235,6 +235,7 @@ int MeshExtrudedSurface(GFace *gf,
MVertexLessThanLexicographic::tolerance = old_tol;
gf->meshStatistics.status = GFace::DONE;
return 1;
}
// $Id: meshGFaceTransfinite.cpp,v 1.21 2007-09-04 13:47:02 remacle Exp $
// $Id: meshGFaceTransfinite.cpp,v 1.22 2007-11-27 16:45:27 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -401,5 +401,6 @@ int MeshTransfiniteSurface(GFace *gf)
}
}
gf->meshStatistics.status = GFace::DONE;
return 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment