Advice on data structure for custom mesh optimization algorithm #9171
-
|
Dear all, I need advice on deciding which CGAL data structure I should go with for my mesh optimization algorithm. ProblemI have implemented a tetrahedral mesh optimization algorithm that is currently built upon using Vb = CGAL::Triangulation_vertex_base_with_info_3<int, K>;
using Cb = CGAL::Triangulation_cell_base_with_info_3<int, K>;
using Tds = CGAL::Triangulation_data_structure_3<Vb, Cb>;
using Delaunay_triangulation_3 = CGAL::Delaunay_triangulation_3<K, Tds>;
using Triangulation_3 = CGAL::Triangulation_3<K, Tds>;It does not add or remove vertices and runs well on random (Delaunay) triangulations of unit spheres. It needs an index for each vertex and cell in order to run efficiently. Now, I have some additional requirements that appear difficult to realize with
QuestionNow, with which CGAL data structure am I able to meet the above requirements? Ideas
Any help is greatly appreciated, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
I now chose to use using K = CGAL::Epick;
using Mesh_domain_3 = CGAL::Labeled_mesh_domain_3<K>;
// Based on https://doc.cgal.org/latest/Triangulation_3/Triangulation_3_2adding_handles_3_8cpp-example.html
template <class GT, class MD, class Vb = CGAL::Mesh_vertex_base_3<GT, MD>>
class Mesh_vertex_base_with_info_3 : public Vb {
public:
using Point = typename Vb::Point;
Mesh_vertex_base_with_info_3() : Vb(), idx(-1) {}
explicit Mesh_vertex_base_with_info_3(const Point& p) : Vb(p), idx(-1) {}
int& info() { return idx; }
const int& info() const { return idx; }
template <class TDS2>
struct Rebind_TDS {
using Vb2 = typename Vb::template Rebind_TDS<TDS2>::Other;
using Other = Mesh_vertex_base_with_info_3<GT, MD, Vb2>;
};
private:
int idx;
};
// Based on https://doc.cgal.org/latest/Triangulation_3/Triangulation_3_2adding_handles_3_8cpp-example.html
template <class GT, class MD, class Cell_base = CGAL::Compact_mesh_cell_base_3<GT, MD>>
class Compact_mesh_cell_base_with_info_3 : public Cell_base {
public:
Compact_mesh_cell_base_with_info_3() : Cell_base(), idx(-1) {}
int& info() { return idx; }
const int& info() const { return idx; }
template <class TDS2>
struct Rebind_TDS {
using Base2 = typename Cell_base::template Rebind_TDS<TDS2>::Other;
using Other = Compact_mesh_cell_base_with_info_3<GT, MD, Base2>;
};
private:
int idx;
};
using Vb = Mesh_vertex_base_with_info_3<K, Mesh_domain_3>;
using Cb = Compact_mesh_cell_base_with_info_3<K, Mesh_domain_3>;
using Tds = CGAL::Triangulation_data_structure_3<Vb, Cb>;
using Mesh_triangulation_3 = CGAL::Mesh_triangulation_3<Mesh_domain_3, K, CGAL::Sequential_tag, Tds>::type;
using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3<Mesh_triangulation_3>;However, when trying to create a C3t3, I get the error In template: no type named 'Vertex_handle' in 'CGAL::Mesh_triangulation_3<CGAL::Labeled_mesh_domain_3<CGAL::Epick>, CGAL::Epick, CGAL::Sequential_tag, CGAL::Triangulation_data_structure_3<Mesh_vertex_base_with_info_3<CGAL::Epick, CGAL::Labeled_mesh_domain_3<CGAL::Epick>>, Compact_mesh_cell_base_with_info_3<CGAL::Epick, CGAL::Labeled_mesh_domain_3<CGAL::Epick>>>>' |
Beta Was this translation helpful? Give feedback.
-
|
I could solve it by changing using Mesh_triangulation_3 = CGAL::Mesh_triangulation_3<Mesh_domain_3, K, CGAL::Sequential_tag, Tds>::type;to using Mesh_triangulation_3 = CGAL::Mesh_triangulation_3<Mesh_domain_3, K, CGAL::Sequential_tag, Vb, Cb>::type;But I am still interested if |
Beta Was this translation helpful? Give feedback.
-
|
Hello @larsmunaf , thank you for your interest in the CGAL data structures. I think the best available data structure is the If you use a simpler triangulation, with only the index information added to the vertex/cell bases, you may miss some of the additional info that is stored in the Medit file that you are using as input, including the You can use the function
About that : there is no reason why CGAL would add extra finite vertices. It only adds one infinite vertex, to have a fully valid connectivity. Each and every facet, including the ones of the convex hull of a triangulation, has two valid neighboring cells (two finite, or one finite and one infinite, or two infinite). It adds finite cells to cover the convex hull of the triangulation vertices. It is important to mention that a CGAL triangulation is meant to be a triangulation of the convex hull of its vertices. In the case where the input triangulation (read from Medit file for example) does not cover the entire convex hull, the I hope it helps! |
Beta Was this translation helpful? Give feedback.
-
|
Hello @janetournois, thank you for the detailed insights! Then I think I am on the right way with Two follow-up questions:
Regards! |
Beta Was this translation helpful? Give feedback.
-
|
Hello @larsmunaf ,
actually I think that is a documentation mistake and the
yes, that sounds good! |
Beta Was this translation helpful? Give feedback.
Hello @larsmunaf ,
thank you for your interest in the CGAL data structures.
I think the best available data structure is the
Mesh_complex_3_in_triangulation_3, with a triangulation as close as possible to theRemeshing_triangulation_3, which uses "only" theSimplicialMeshVertexBase_3(and cell). As you already found out, you can use the functionc3t3.set_triangulation()to set the triangulation in the C3T3.If you use a simpler triangulation, with only the index information added to the vertex/cell bases, you may miss some of the additional info that is stored in the Medit file that you are using as input, including the
Subdomain_index(index of subdomain in cells), orSurface_patch_index…