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

bug in adaptation corrected

parent 77b6b3cf
No related branches found
No related tags found
No related merge requests found
......@@ -539,6 +539,10 @@ int GModel::adaptMesh(std::vector<int> technique,
int niter, bool meshAll)
{
#if defined(HAVE_MESH)
// copy context (in order to allow multiple calls)
CTX _backup = *(CTX::instance());
if (getNumMeshElements() == 0) mesh(getDim());
int nbElemsOld = getNumMeshElements();
int nbElems;
......@@ -642,6 +646,9 @@ int GModel::adaptMesh(std::vector<int> technique,
}
fields->reset();
// copy context (in order to allow multiple calls)
*(CTX::instance()) = _backup ;
return 0;
#else
......
......@@ -670,14 +670,14 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
CTX::instance()->mesh.algo3d == ALGO_3D_MMG3D ||
CTX::instance()->mesh.algo2d == ALGO_2D_FRONTAL_QUAD ||
CTX::instance()->mesh.algo2d == ALGO_2D_BAMG){
sprintf(opts, "-pY%c", (Msg::GetVerbosity() < 3) ? 'Q':
sprintf(opts, "-q1.3pY%c", (Msg::GetVerbosity() < 3) ? 'Q':
(Msg::GetVerbosity() > 6) ? 'V': '\0');
// removed -q because mesh sizes at vertices were wrong...
// sprintf(opts, "-q1.5pY%c", (Msg::GetVerbosity() < 3) ? 'Q':
// (Msg::GetVerbosity() > 6) ? 'V': '\0');
}
else {
sprintf(opts, "-Ype%c", (Msg::GetVerbosity() < 3) ? 'Q':
sprintf(opts, "-q1.5Ype%c", (Msg::GetVerbosity() < 3) ? 'Q':
(Msg::GetVerbosity() > 6) ? 'V': '\0');
}
try{
......
......@@ -12,7 +12,7 @@ double PViewEvaluator::operator() (const double x, const double y, const double
PViewData * pvd = _pv->getData();
double value;
bool found = pvd->searchScalar(x, y, z, &value, _step);
printf("found %d %g %g %g %g\n",found,x,y,value,x*x+y*y);
// printf("found %d %g %g %g %g\n",found,x,y,value,x*x+y*y);
if (found) return value;
return 1.e22;
}
Mesh.Algorithm = 6; //(1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=bamg, 8=delquad)
Mesh.Algorithm3D = 7; //(1=tetgen, 4=netgen, 7=mmg3D
//Mesh.Algorithm3D = 7; //(1=tetgen, 4=netgen, 7=mmg3D
Mesh.LcIntegrationPrecision = 1.e-2;
......@@ -16,7 +16,7 @@ Field[1].nbElemLayer = 4;
Field[1].hLayer = 0.2;//percent of vessel radius
Field[1].closeVolume =1;
//Field[1].extrudeWall =1;
Field[1].extrudeWall =1;
Field[1].reMesh =1;
Field[1].run;
......
......@@ -401,6 +401,19 @@ static std::vector<std::pair<std::set<MElement*> , std::set<MVertex*> > > getCon
return result;
}
static void PrintBlob (std::set<MElement*> &eles, int iTag){
char name[256];
sprintf(name,"BLOB%d.pos",iTag);
FILE *f = fopen (name,"w");
fprintf(f,"View\"%s\"{\n",name);
for (std::set<MElement*>::iterator it = eles.begin(); it != eles.end();++it){
(*it)->writePOS(f,true,false,false,false,false,false,1.0,iTag);
}
fprintf(f,"};\n");
fclose(f);
}
void HighOrderMeshOptimizer (GModel *gm, OptHomParameters &p)
{
......@@ -454,6 +467,7 @@ void HighOrderMeshOptimizer (GModel *gm, OptHomParameters &p)
//#pragma omp parallel for schedule(dynamic, 1)
p.SUCCESS = 1;
for (int i = 0; i < toOptimize.size(); ++i) {
PrintBlob (toOptimize[i].first, i+1);
OptHomMessage("Optimizing a blob %i/%i composed of %4d elements", i+1, toOptimize.size(), toOptimize[i].first.size());
fflush(stdout);
OptHOM temp(&entity, toOptimize[i].first, toOptimize[i].second, method);
......@@ -524,6 +538,7 @@ void HighOrderMeshOptimizer (GModel *gm, OptHomParameters &p)
// std::ostringstream ossF;
// ossF << "final_" << (*itf)->tag() << ".msh";
// temp.mesh.writeMSH(ossF.str().c_str());
PrintBlob (toOptimize, ITER);
}
double DTF = Cpu()-tf1;
if (p.SUCCESS == 1){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment