Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGAL 3D conversions. #33

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

CGAL 3D conversions. #33

wants to merge 7 commits into from

Conversation

luca-heltai
Copy link
Owner

@fdrmrc, I tried implementing deal.II cells to cgal polyhedron translations, and deal.II two-dimensional triangulation to

It seems to work for single cells. Now I'd like to use the intersections, but I'm not able (yet) to construct a valid triangulation from a polyhedron to feed to the CGAL::Polygon_mesh_processing::corefine_and_compute_boolean_operations. I'll look into it later on. Do you have an idea on how to do that?

@fdrmrc
Copy link
Collaborator

fdrmrc commented Apr 24, 2022

Looking at the docs, the issue should be that you're passing a C3T3 instead of a CGAL::surface_mesh. tm1,tm2 have to be surfaces (https://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__corefinement__grp.html#ga70346bbfd568de05220767cdcbcd6f68).

@fdrmrc
Copy link
Collaborator

fdrmrc commented Apr 24, 2022

The only way I can think of now is to add a wrapper for surfaces, as we can't use HDS (https://doc.cgal.org/latest/Surface_mesh/classCGAL_1_1Surface__mesh.html)

  template <typename CGALPointType, int dim, int spacedim>
  void
  to_cgal(const typename dealii::Triangulation<dim, spacedim> &tria,
          const dealii::Mapping<dim, spacedim> &               mapping,
          CGAL::Surface_mesh<CGALPointType> &                                     surface_mesh);

@luca-heltai
Copy link
Owner Author

would this allow us to use intersection and refinement algorithms?

@luca-heltai
Copy link
Owner Author

Also, I was trying to support tetrahedral mesh generation, that's why I was using the C3T3 meshes.

@fdrmrc
Copy link
Collaborator

fdrmrc commented Apr 24, 2022

would this allow us to use intersection and refinement algorithms?

In all the examples they're using surfaces, so yes, that would work. But it seems too strange that Polyhedrons are not supported.

@luca-heltai
Copy link
Owner Author

Once we have a surface mesh, it should be easy enough to get a tetra mesh.

@fdrmrc
Copy link
Collaborator

fdrmrc commented Apr 25, 2022

I've added a first wrapper for Surface_mesh<CGALPointType>, tested only with cubes. The previously commented test now compiles, but it's still not robust, (see next comment)

@fdrmrc
Copy link
Collaborator

fdrmrc commented Apr 26, 2022

Tests still don't work if you perform the second (commented) rotation.

GridTools::rotate(numbers::PI_4, 0, tria);
// GridTools::rotate(numbers::PI_4, 1, tria);

The thrown exception is

[ctest] C++ exception with description "CGAL ERROR: assertion violation!
[ctest] Expr: (size_ == 2 && (v == first || v == second) ) || v==first
[ctest] File: /usr/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_impl.h
[ctest] Line: 131" thrown in the test body.

That's only related to machine precision. If you use exact arithmetic, everything works fine.

Is there something more to do in this PR? @luca-heltai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants