Skip to Content.
Sympa Menu

cgal-discuss - RE: [cgal-discuss] How to mesh and refine the domains defined by polyhedrons?

Subject: CGAL users discussion list

List archive

RE: [cgal-discuss] How to mesh and refine the domains defined by polyhedrons?


Chronological Thread 
  • From: Zhanghong Tang <>
  • To: <>
  • Subject: RE: [cgal-discuss] How to mesh and refine the domains defined by polyhedrons?
  • Date: Tue, 18 Sep 2012 01:00:43 +1200
  • Importance: Normal

Dear Dr. Yvinec,

Could you please give me a small example to do this?
For example, I have two domains: a sphere outside with radius 2 and a cubit inside with edge length 2, how to define the domains and mesh these domains?

I have tried to mesh a domain by an OFF file, but it crashed.

Thanks,
Zhanghong Tang



The code is as follows:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h> 
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Nef_polyhedron_3.h>

#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>

#include <CGAL/Polyhedral_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/refine_mesh_3.h>

#include "math.h"
#include <iostream>
#include <istream>
#include <fstream> 

using namespace std; 
typedef CGAL::Exact_predicates_exact_constructions_kernel        Kernel;
typedef CGAL::Simple_cartesian<double>                                            sKernel;
typedef Kernel::Point_3                                                                            Point_3;
typedef CGAL::Nef_polyhedron_3<Kernel>                                            Nef_polyhedron;
typedef CGAL::Polyhedron_3<Kernel>                                                    Polyhedron;
typedef Polyhedron::HalfedgeDS                                                            HalfedgeDS;
typedef Kernel::Plane_3                                                                            Plane_3;
typedef Polyhedron::Vertex_iterator                                                    Vertex_iterator;
typedef Polyhedron::Facet_iterator                                                    Facet_iterator;
typedef Polyhedron::Halfedge_around_facet_circulator                Halfedge_facet_circulator;
typedef Nef_polyhedron::Aff_transformation_3                                Aff_transformation_3;
typedef Nef_polyhedron::Vector_3                                                        Vector_3;

// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K>                                                                Polyhedron3;
typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron3, K>            Mesh_domain;

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type                Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr>                    C3t3;

// Criteria
typedef CGAL::Mesh_criteria_3<Tr>                                                        Mesh_criteria;

// To avoid verbose function and named parameters call
using namespace CGAL::parameters;


  Polyhedron3 polyhedron;
  std::ifstream input("a1.off");
  input >> polyhedron;
    Mesh_domain domain(polyhedron);
  // Mesh criteria (no cell_size set)
  Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
                         cell_radius_edge_ratio=3);
  // Mesh generation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());

  // Output
  std::ofstream medit_file("out_1.mesh");
  c3t3.output_to_medit(medit_file);
  medit_file.close();

  // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
  Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03);

  // Mesh refinement
  CGAL::refine_mesh_3(c3t3, domain, new_criteria);

  // Output
  medit_file.open("out_2.mesh");
  c3t3.output_to_medit(medit_file);



Date: Mon, 17 Sep 2012 14:08:03 +0200
From:
To:
Subject: Re: [cgal-discuss] How to mesh and refine the domains defined by polyhedrons?

you mai provide your domain as an implicit domain
CGAL::Implicit_mesh_domain_3<Function,BGT>

you will have to use
CGAL::Mesh_domain_with_polyline_features_3<MeshDomain_3>
if you wish  to have the edges of the cube represented by the mesh


Le 15/09/12 05:30, Zhanghong Tang a écrit :
Dear all,

I plan to mesh and refine the domains defined by polyhedrons. Different domains maybe contact each other so there are some common facets in different polyhedrons (they are formed by bool operations). Could anyone give me some hints or examples on how to work on it? For example, I have two domains: a sphere outside with radius 2 and a cubit inside with edge length 2, how to define the domains and mesh these domains?



Thanks,
Zhanghong Tang

-- 
Mariette Yvinec
Geometrica project team
INRIA  Sophia-Antipolis  





Archive powered by MHonArc 2.6.18.

Top of Page