Skip to content
Snippets Groups Projects
Commit 0fac90ff authored by Emilie Marchandise's avatar Emilie Marchandise
Browse files

Improved centerlinefield + removed smoothMetric 1D which makes Blasius benchmark fail ...

parent 9f5b8048
No related branches found
No related tags found
No related merge requests found
...@@ -559,7 +559,7 @@ int GModel::adaptMesh(int technique, simpleFunction<double> *f, ...@@ -559,7 +559,7 @@ int GModel::adaptMesh(int technique, simpleFunction<double> *f,
writeMSH(name); writeMSH(name);
if (ITER++ >= niter) break; if (ITER++ >= niter) break;
if (ITER > 5 && fabs((double)(nbElems - nbElemsOld)) < 0.0 * nbElemsOld) break; if (ITER > 3 && fabs((double)(nbElems - nbElemsOld)) < 0.01 * nbElemsOld) break;
nbElemsOld = nbElems; nbElemsOld = nbElems;
} }
......
...@@ -12,12 +12,17 @@ ...@@ -12,12 +12,17 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <string> #include <string>
#include <fstream>
#include <sstream>
#include "GModel.h" #include "GModel.h"
#include "MElement.h" #include "MElement.h"
#include "MVertex.h" #include "MVertex.h"
#include "MLine.h" #include "MLine.h"
#include "GEntity.h" #include "GEntity.h"
#include "Field.h" #include "Field.h"
#include "Os.h"
#if defined(HAVE_ANN) #if defined(HAVE_ANN)
#include <ANN/ANN.h> #include <ANN/ANN.h>
...@@ -37,14 +42,9 @@ Centerline::Centerline(): kdtree(0), nodes(0){ ...@@ -37,14 +42,9 @@ Centerline::Centerline(): kdtree(0), nodes(0){
index = new ANNidx[1]; index = new ANNidx[1];
dist = new ANNdist[1]; dist = new ANNdist[1];
update_needed = false;
options["FileName"] = new FieldOptionString (fileName, "File Name for the centerlines"); options["FileName"] = new FieldOptionString (fileName, "File name for the centerlines", &update_needed);
fileName = "centerlines.vtk";//default fileName = "centerlines.vtk";//default
//TODO get fileName from file
importFile(fileName);
buildKdTree();
} }
...@@ -131,6 +131,17 @@ void Centerline::buildKdTree(){ ...@@ -131,6 +131,17 @@ void Centerline::buildKdTree(){
double Centerline::operator() (double x, double y, double z, GEntity *ge){ double Centerline::operator() (double x, double y, double z, GEntity *ge){
if (update_needed){
std::ifstream input;
input.open(fileName.c_str());
if(StatFile(fileName)) Msg::Fatal("Centerline file '%s' does not exist", fileName.c_str());
importFile(fileName);
buildKdTree();
update_needed = false;
}
double xyz[3] = {x,y,z }; double xyz[3] = {x,y,z };
int num_neighbours = 1; int num_neighbours = 1;
kdtree->annkSearch(xyz, num_neighbours, index, dist); kdtree->annkSearch(xyz, num_neighbours, index, dist);
......
...@@ -46,8 +46,8 @@ class Centerline : public Field{ ...@@ -46,8 +46,8 @@ class Centerline : public Field{
virtual std::string getDescription() virtual std::string getDescription()
{ {
return "The value of this field is the distance to the centerline.\n\n" return "The value of this field is the distance to the centerline.\n\n"
" You should specify a fileName that contains the centerline.\n" " You should specify a fileName that contains the centerline."
" The centerline of a surface can be obtained using the open source software vmtk\n\n" " The centerline of a surface can be obtained with the open source software vmtk (http://www.vmtk.org/)"
" using the following script:\n\n" " using the following script:\n\n"
"vmtk vmtkcenterlines -seedselector openprofiles -ifile mysurface.stl -ofile centerlines.vtp --pipe vmtksurfacewriter -ifile centerlines.vtp -ofile centerlines.vtk\n"; "vmtk vmtkcenterlines -seedselector openprofiles -ifile mysurface.stl -ofile centerlines.vtp --pipe vmtksurfacewriter -ifile centerlines.vtp -ofile centerlines.vtk\n";
} }
......
...@@ -396,7 +396,7 @@ void meshGEdge::operator() (GEdge *ge) ...@@ -396,7 +396,7 @@ void meshGEdge::operator() (GEdge *ge)
// FIXME JF : MAYBE WE SHOULD NOT ALWAYS SMOOTH THE 1D MESH SIZE FIELD ?? // FIXME JF : MAYBE WE SHOULD NOT ALWAYS SMOOTH THE 1D MESH SIZE FIELD ??
//printFandPrimitive(ge->tag(), Points); //printFandPrimitive(ge->tag(), Points);
a = smoothPrimitive (ge,CTX::instance()->mesh.smoothRatio*CTX::instance()->mesh.smoothRatio,Points); // a = smoothPrimitive (ge,CTX::instance()->mesh.smoothRatio*CTX::instance()->mesh.smoothRatio,Points);
//printFandPrimitive(ge->tag()+10000, Points); //printFandPrimitive(ge->tag()+10000, Points);
N = std::max(ge->minimumMeshSegments() + 1, (int)(a + 1.)); N = std::max(ge->minimumMeshSegments() + 1, (int)(a + 1.));
......
...@@ -80,7 +80,7 @@ meshMetric::meshMetric(GModel *gm, int technique, simpleFunction<double> *fct, s ...@@ -80,7 +80,7 @@ meshMetric::meshMetric(GModel *gm, int technique, simpleFunction<double> *fct, s
computeMetric(); computeMetric();
//printMetric("toto.pos"); printMetric("toto.pos");
//exit(1); //exit(1);
} }
...@@ -332,7 +332,6 @@ void meshMetric::computeMetric(){ ...@@ -332,7 +332,6 @@ void meshMetric::computeMetric(){
//smoothMetric (sol); //smoothMetric (sol);
//curvatureContributionToMetric(); //curvatureContributionToMetric();
} }
double meshMetric::operator() (double x, double y, double z, GEntity *ge) { double meshMetric::operator() (double x, double y, double z, GEntity *ge) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment