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
Create a Triangulation<3> from a Triangulation<2,3> #13767
Create a Triangulation<3> from a Triangulation<2,3> #13767
Conversation
0ed2dc1
to
8d4108a
Compare
I think this should go in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides moving it to grid_generator.h
, I think the documentation should be filled with the information about the additional parameters.
8d4108a
to
4b1e1f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
include/deal.II/grid/grid_tools.h
Outdated
void | ||
surface_mesh_to_volumetric_mesh(const Triangulation<2, 3> &surface_tria, | ||
Triangulation<3> & vol_tria, | ||
Args... cgal_args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would prefer to introduce an AdditionalData
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move #ifdef DEAL_II_WITH_CGAL
within the function and assert it there?
include/deal.II/grid/grid_tools.h
Outdated
#ifdef DEAL_II_WITH_CGAL | ||
template <typename... Args> | ||
void | ||
surface_mesh_to_volumetric_mesh(const Triangulation<2, 3> &surface_tria, | ||
Triangulation<3> & vol_tria, | ||
Args... cgal_args); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here? Isn't this the same as above?
@peterrum I pushed right after you wrote the review! |
One question: the original surface mesh determines the cells of the volume mesh on the surface or are the cells unrelated? |
They're currently unrelated. The use case I had in mind is like the one in the test: one just starts with a deal.II tria describing the surface and fills it. Another use case is the one with boolean operations I wrote in first message. However, it shouldn't be a problem to record the topological information about the first deal.II surface tria and use it to create the volumetric one. |
template <typename... Args> | ||
void | ||
surface_mesh_to_volumetric_mesh(const Triangulation<2, 3> &surface_tria, | ||
Triangulation<3> & vol_tria, | ||
Args... cgal_args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will object to this on the same grounds as for the other patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. As soon as the other patch is okay, I can update this!
ab71efb
to
b5418bc
Compare
So done, this should be good to go now. Also, I took the liberty to move the two utility functions that convert points back and forth from deal.II to CGAL in a separate header, fixing some issues with headers inclusions I hadn't noticed before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change required: add an implementation stub that throws ExcNotImplemented if cgal is not found.
source/grid/grid_generator.cc
Outdated
CGALWrappers::cgal_triangulation_to_dealii_triangulation(cgal_triangulation, | ||
vol_tria); | ||
} | ||
# endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a default implementation that throws an error saying that the function needs CGAL to be installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, apart from some adaptations to the comments.
|
||
/** | ||
* Create a deal.II Triangulation<3> out of a deal.II Triangulation<2,3> | ||
* by filling it with tetrahedrons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* by filling it with tetrahedrons. | |
* by filling it with tetrahedra. |
* The optional variable arguments @p cgal_args can be used to pass additional | ||
* arguments to the CGAL::Mesh_criteria_3 class (see | ||
* https://doc.cgal.org/latest/Mesh_3/index.html) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please adapt this and the text below, as we have now introduced AdditionalData.
1df12e7
to
be72338
Compare
I'm addressing Luca's comment, please don't merge |
be72338
to
1371aac
Compare
bb17e55
to
8141e31
Compare
d1e69d2
to
2337fe4
Compare
Rebased on top of master. |
2337fe4
to
8d243fd
Compare
The implementation of the present function has been moved in |
…_volumetric Create a Triangulation<3> from a Triangulation<2,3>
This creates a Triangulation<3> out of a Triangulation<2,3>, filling the latter with tetrahedrons. Named parameters can be used to control the size and the quality of the final mesh.
I put this into
GridTools
, but I'm happy to move this somewhere else if you think it's not the right namespace/place.The .cc test is just filling an hypersphere, but one could use this after boolean operations (#13717) , giving the capability of meshing things like the following, where the union of two spheres is computed and meshed inside