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

recombine & blossom without parametrization

parent e8ee0c3e
No related branches found
No related tags found
No related merge requests found
......@@ -567,6 +567,22 @@ void AdaptMesh(GModel *m)
Msg::StatusBar(2, true, "Done adaptating 3D mesh (%g s)", t2 - t1);
}
void RecombineMesh(GModel *m)
{
Msg::StatusBar(2, true, "Recombining 2D mesh...");
double t1 = Cpu();
for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
GFace *gf = *it;
recombineIntoQuads(gf);
}
CTX::instance()->mesh.changed = ENT_ALL;
double t2 = Cpu();
Msg::StatusBar(2, true, "Done recombining 2D mesh (%g s)", t2 - t1);
}
void GenerateMesh(GModel *m, int ask)
{
if(CTX::instance()->lock) {
......
......@@ -15,5 +15,6 @@ void OptimizeMesh(GModel *m);
void OptimizeMeshNetgen(GModel *m);
void RefineMesh(GModel *m, bool linear, bool splitIntoQuads=false,
bool splitIntoHexas=false);
void RecombineMesh(GModel *m);
#endif
......@@ -1842,20 +1842,28 @@ void recombineIntoQuads(GFace *gf,
bool topologicalOpti,
bool nodeRepositioning)
{
double t1 = Cpu();
bool haveParam = true;
if(gf->geomType() == GEntity::DiscreteSurface && !gf->getCompound())
haveParam = false;
gf->model()->writeMSH("before.msh");
if (topologicalOpti)removeFourTrianglesNodes(gf, false);
if(haveParam && topologicalOpti)
removeFourTrianglesNodes(gf, false);
int success = _recombineIntoQuads(gf, 0);
// gf->addLayersOfQuads(1, 0);
gf->model()->writeMSH("raw.msh");
if (nodeRepositioning)
if(haveParam && nodeRepositioning)
laplaceSmoothing(gf, CTX::instance()->mesh.nbSmoothing);
// blossom-quad algo
if(success && CTX::instance()->mesh.algoRecombine == 1){
if(topologicalOpti){
if(haveParam){
gf->model()->writeMSH("smoothed.msh");
int COUNT = 0;
char NAME[256];
......@@ -1869,9 +1877,10 @@ void recombineIntoQuads(GFace *gf,
if(z){ sprintf(NAME,"iter%dS.msh",COUNT++); gf->model()->writeMSH(NAME); }
if (!(x+y+z)) break;
}
}
edgeSwapQuadsForBetterQuality(gf);
//if(z){ sprintf(NAME,"iter%dS.msh",COUNT++); gf->model()->writeMSH(NAME); }
laplaceSmoothing(gf,CTX::instance()->mesh.nbSmoothing);
if(haveParam) laplaceSmoothing(gf,CTX::instance()->mesh.nbSmoothing);
}
double t2 = Cpu();
Msg::Info("Blossom recombination algorithm completed (%g s)", t2 - t1);
......@@ -1880,19 +1889,19 @@ void recombineIntoQuads(GFace *gf,
// simple recombination algo
_recombineIntoQuads(gf, 0);
laplaceSmoothing(gf,CTX::instance()->mesh.nbSmoothing);
if(haveParam) laplaceSmoothing(gf, CTX::instance()->mesh.nbSmoothing);
_recombineIntoQuads(gf, 0);
laplaceSmoothing(gf,CTX::instance()->mesh.nbSmoothing);
if(haveParam) laplaceSmoothing(gf, CTX::instance()->mesh.nbSmoothing);
// gf->model()->writeMSH("after.msh");
double t2 = Cpu();
Msg::Info("Simple recombination algorithm completed (%g s)", t2 - t1);
}
// give it a try : add one quad layer on the
void addOneLayerOnContour(GFace *gf, GVertex *gv){
void addOneLayerOnContour(GFace *gf, GVertex *gv)
{
/*
, int nbLayers, double hplus, double factor){
// for each vertex
......@@ -1985,7 +1994,8 @@ void addOneLayerOnContour(GFace *gf, GVertex *gv){
*/
}
void quadsToTriangles(GFace *gf, double minqual = -10000.){
void quadsToTriangles(GFace *gf, double minqual = -10000.)
{
std::vector<MQuadrangle*> qds;
for (int i=0;i<gf->quadrangles.size();i++){
MQuadrangle *q = gf->quadrangles[i];
......@@ -2023,8 +2033,8 @@ void quadsToTriangles(GFace *gf, double minqual = -10000.){
gf->quadrangles = qds;
}
void recombineIntoQuadsIterative(GFace *gf){
void recombineIntoQuadsIterative(GFace *gf)
{
recombineIntoQuads(gf);
quadsToTriangles(gf,0.03);
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment