From 548fc31d8a02f76834258b130c38091bb8afe961 Mon Sep 17 00:00:00 2001 From: Tristan Carrier Baudouin <tristan.carrier@uclouvain.be> Date: Tue, 25 Sep 2012 14:18:38 +0000 Subject: [PATCH] Voronoi 3D --- Mesh/Levy3D.cpp | 6 ++---- Mesh/periodical.cpp | 34 ++++++++++++++++++++++++++++++++++ Mesh/periodical.h | 1 + 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Mesh/Levy3D.cpp b/Mesh/Levy3D.cpp index 629d3b46a0..3d1fc515d5 100644 --- a/Mesh/Levy3D.cpp +++ b/Mesh/Levy3D.cpp @@ -1452,8 +1452,6 @@ void LpSmoother::improve_model(){ GModel* model = GModel::current(); GModel::riter it; - Frame_field::init_model(); - for(it=model->firstRegion();it!=model->lastRegion();it++) { gr = *it; @@ -1461,8 +1459,6 @@ void LpSmoother::improve_model(){ improve_region(gr); } } - - Frame_field::clear(); } void LpSmoother::improve_region(GRegion* gr) @@ -1494,6 +1490,7 @@ void LpSmoother::improve_region(GRegion* gr) alglib::real_1d_array x; alglib::real_1d_array alglib_scales; + Frame_field::init_model(); octree = new MElementOctree(gr->model()); for(i=0;i<gr->getNumMeshElements();i++){ @@ -1623,6 +1620,7 @@ void LpSmoother::improve_region(GRegion* gr) delete octree; free(initial_conditions); free(scales); + Frame_field::clear(); #endif } diff --git a/Mesh/periodical.cpp b/Mesh/periodical.cpp index a48996fff7..bf91f11e5f 100644 --- a/Mesh/periodical.cpp +++ b/Mesh/periodical.cpp @@ -182,6 +182,7 @@ void voroMetal3D::execute(std::vector<SPoint3>& vertices) std::ofstream file("cells.pos"); file << "View \"test\" {\n"; std::ofstream file2("cells.geo"); + file2 << "Coherence;\n"; file2 << "c = 1.0;\n"; for(i=0;i<pointers.size();i++){ obj = geo_cell(); @@ -363,3 +364,36 @@ void voroMetal3D::print_geo_face_loop(int index,std::vector<int>& indices,std::o file << "};\n"; } + +void voroMetal3D::correspondance(){ + int i; + GFace* gf; + GModel* model = GModel::current(); + GModel::fiter it; + std::vector<GFace*> faces; + std::map<GFace*,bool> markings; + + faces.clear(); + + for(it=model->firstFace();it!=model->lastFace();it++) + { + gf = *it; + if(gf->numRegions()==1){ + faces.push_back(gf); + } + printf("%d ",gf->numRegions()); + } + printf("\n"); + + printf("%zu\n",faces.size()); + + markings.clear(); + + for(i=0;i<faces.size();i++){ + markings.insert(std::pair<GFace*,bool>(faces[i],0)); + } + + std::ofstream file; + file.open("cells.geo",ios::out | ios::app); + //geofile << "test\n"; +} \ No newline at end of file diff --git a/Mesh/periodical.h b/Mesh/periodical.h index 5804394730..066b189045 100644 --- a/Mesh/periodical.h +++ b/Mesh/periodical.h @@ -28,4 +28,5 @@ class voroMetal3D{ void print_geo_volume(int,int,std::ofstream&); void print_geo_line_loop(int,std::vector<int>&,std::vector<int>&,std::ofstream&); void print_geo_face_loop(int,std::vector<int>&,std::ofstream&); + void correspondance(); }; -- GitLab