Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Holes in mesh

Subject: CGAL users discussion list

List archive

[cgal-discuss] Holes in mesh


Chronological Thread 
  • From: Gabriel Balaban <>
  • To:
  • Subject: [cgal-discuss] Holes in mesh
  • Date: Mon, 21 May 2018 17:33:00 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
  • Ironport-phdr: 9a23:5RuQkBBbuoSjvabiN5seUyQJP3N1i/DPJgcQr6AfoPdwSPvyrsbcNUDSrc9gkEXOFd2Cra4c0KyO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglUijexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Xymp4aV2Rx/ykCoJNzA3/mLKhMJukK1boQmspxljz4POeoyZKOZyc6HbcNgHRWRBRMFRVylZD429dYQAFPABPedGoIn5ulADsAGxBQ22C+z00DBIgGL90Ko10+s7Cg7Gxg0gEMwKsHjOt9r6LqMSXvquw6bSyzXOdPBW1iv56ITSaB8uveuAXa9zccfIz0QkCgDLjk2IpID4Iz+Y2f4BvmeZ4uZ6S+6jkWoqpgJprjWtycogkJTFipwVx1ze9ih13pw5KcC5RUN/Z9OvDYFeuDuAN4RsR8MvW2Fotzg+yr0BoZO1cyYFxog7yxLCcvCJfZWF7xL6WOaWOjh3mmhpeLWihxau6kegzfD8Vs+p31pQtipFiN7MtmwT2BPP9siHS/x9/kG71TaIygDT9uVEIUczlarYMZIu3rkwlp8LvUTCGC/5hln2gbeLekk49eWk8evqb7f8qpOCLYN5jgLzPrwrmsOlAOQ4NgYOX3Kc+eS5zLDj8lf2T65Qjv03jKbZtIrWKt8Bqa69GQBayZws6xCkAjelzNsYmWMLI0hZdx6dkojpOEnCIOrkAvenn1SsjDBryujaMb3uGJrNKmHPn6rgfbZm90Fc1REzzctE6pJPCrABJerzVVXruNzZCB85KQ20zPz9BNVzzINNEV6IV6SWOaeXvV6T7f80OMGNYpUUsXDzMasL/fnr2FAwk0UccK3h95ITYXqxGLwyLEyTe3vhhpELGGMDtAM4ZO/hjBuLWnhOZCDhDOoH+jgnBdf+Xs/4TYe3jenZhXbpLthtfmlDT2u0PzLtfoSAVe0LbXvLcMxqlnoNXv68SN14jE38hErB07Nia9Hs1GgAr5u6jYp27OmVnBp06D8mV53AgVHIdHl9myYzfxFz3K17phAimHq+6/AhxtBySJlU7f4PVRomP5nByeA8E8r1Rg/KYtaOThChX8miBjYyCNk2xo1Xbg==
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Dear CGAL people,

I modified the demo mesh_polyhedral complex to make a mesh within a mesh,
but I seem to be getting holes in the outside mesh for some reason. Could you please help me out?

The file holes_in_mesh.png is a screenshot from paraview of the resulting mesh,
and make_mesh.cpp is the c++ program that makes the mesh.
The outer two files are the inner and outer mesh.

I am aware that for cubes it would be easier to use geometric predicates, but I would like to extend the meshing to more complicated meshes so that is why my simple test case has surface meshes.

Cheers,
   Gabriel


Research Associate
Kings College London
St. Thomas Hospital

Attachment: holes_in_mesh.png
Description: PNG image

Attachment: outer_cube.off
Description: model/geomview-off

Attachment: inner_cube.off
Description: model/geomview-off

#include <CGAL/Exact_predicates_inexact_constructions_kernel.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_complex_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>

#include <cstdlib>

// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
typedef CGAL::Polyhedral_complex_mesh_domain_3<K> Mesh_domain;


#ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;

typedef CGAL::Mesh_complex_3_in_triangulation_3<
  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_index> C3t3;

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

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

const char* const filenames[] = {
  "inner_cube.off",
  "inner_cube.off",
  "outer_cube.off"
};

const std::pair<int, int> incident_subdomains[] = {
  std::make_pair(0, 1),
  std::make_pair(1, 2),
  std::make_pair(0, 2),
};

int main()
{
  const std::size_t nb_patches = sizeof(filenames) / sizeof(const char*);
  CGAL_assertion(sizeof(incident_subdomains) ==
                 nb_patches * sizeof(std::pair<int, int>));
  std::vector<Polyhedron> patches(nb_patches);
  for(std::size_t i = 0; i < nb_patches; ++i) {
    std::ifstream input(filenames[i]);
    if(!(input >> patches[i])) {
      std::cerr << "Error reading " << filenames[i] << " as a polyhedron!\n";
      return EXIT_FAILURE;
    }
  }
  // Create domain
  Mesh_domain domain(patches.begin(), patches.end(),
                     incident_subdomains,
                      incident_subdomains+nb_patches);

  domain.detect_features(); //includes detection of borders

  // Mesh criteria
  // facet_angle = 25,
  // facet_distance = 0.3,
  // cell_radius_edge_ratio = 3,
  // facet_size = 0.3,
  // edge_size = 0.3,

  Mesh_criteria criteria(cell_size = 0.3);

  // Mesh generation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);

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

  return EXIT_SUCCESS;
}



Archive powered by MHonArc 2.6.18.

Top of Page