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

Add CGAL::Surface_mesh support #13653

Merged
merged 7 commits into from May 4, 2022
Merged

Conversation

fdrmrc
Copy link
Contributor

@fdrmrc fdrmrc commented Apr 28, 2022

Depends on #13644
This is intended to work in 2d and 3d, and allows to convert a dealii cell to a CGAL::Surface_mesh

@luca-heltai luca-heltai force-pushed the cgal-surface-mesh branch 2 times, most recently from 5b5530d to 4864299 Compare April 28, 2022 16:45
@luca-heltai
Copy link
Member

Only 4864299 refers to this PR.

31c5f13 is included in #13644.

@@ -0,0 +1,4 @@
New: Added function CGALWrappers::to_cgal_mesh() to convert a deal.II cell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge the change-log entries so that the major one lists all the features that can be used.

//
// ---------------------------------------------------------------------

#ifndef dealii_cgal_surface_mesh_h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment (not just related to this library): I think we should consider to not make these folders a top level folder but rather move them into subdirs (here into grid). The same holds also for arborx.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But CGAL does other things in addition to "grid". It also handles point clouds, bounding boxes of trees, etc. Don't you think it makes sense to keep features related to an external library in their own directory when this is the case (e.g, sundials, opencascade)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But CGAL does other things in addition to "grid". It also handles point clouds, bounding boxes of trees, etc.

I see. It seems we have now too many options to do the same thing ;) Does CGAL work in the distributed setting?

Apart from that I would very much prefer if external libraries where we only provide wrappers (incl. sundials) would not be in the main deal.II include directory but in a 3rd party library. But I guess I am too late for such wishes...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. If it makes you feel better, there will be also functions like

const Quadrature<spacedim> compute_intersection(Tria::cell_iterator, OtherTria::cell_iterator)

that internally use CGAL. This is not a wrapper, strictly speaking... where would you prefer these functions to be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(all the types there are native dealii types)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

include/deal.II/cgal/surface_mesh.h Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
tests/cgal/cgal_surface_mesh_01.cc Outdated Show resolved Hide resolved
tests/cgal/cgal_surface_mesh_01.cc Outdated Show resolved Hide resolved
@fdrmrc
Copy link
Contributor Author

fdrmrc commented Apr 30, 2022

@peterrum Thanks for the review. I addressed some of your comments.

Copy link
Member

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor comments. Good to go, once the other PR is merged!

source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
source/cgal/surface_mesh.cc Outdated Show resolved Hide resolved
include/deal.II/cgal/surface_mesh.h Outdated Show resolved Hide resolved
@luca-heltai
Copy link
Member

@peterrum, I think we have addressed all your comments.

@luca-heltai
Copy link
Member

/rebuild

Copy link
Member

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go, once you have rebased!

//
// ---------------------------------------------------------------------

#ifndef dealii_cgal_surface_mesh_h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@peterrum
Copy link
Member

peterrum commented May 2, 2022

@luca-heltai

[ 81%] Building CXX object source/base/CMakeFiles/obj_base_debug.dir/polynomials_rannacher_turek.cc.o
In file included from /home/runner/work/dealii/dealii/bundled/boost-1.70.0/include/boost/thread/tss.hpp:8:0,
                 from /usr/include/CGAL/CORE/MemoryPool.h:44,
                 from /usr/include/CGAL/CORE/Impl.h:56,
                 from /usr/include/CGAL/CORE/extLong.h:41,
                 from /usr/include/CGAL/CORE/CoreDefs.h:41,
                 from /usr/include/CGAL/CORE/CORE.h:39,
                 from /usr/include/CGAL/CORE_coercion_traits.h:33,
                 from /usr/include/CGAL/CORE_Expr.h:29,
                 from /usr/include/CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h:33,
                 from /home/runner/work/dealii/dealii/include/deal.II/cgal/utilities.h:24,
                 from /home/runner/work/dealii/dealii/include/deal.II/cgal/surface_mesh.h:25,
                 from /home/runner/work/dealii/dealii/source/cgal/surface_mesh.cc:18:
/home/runner/work/dealii/dealii/bundled/boost-1.70.0/include/boost/thread/detail/config.hpp:14:10: fatal error: boost/thread/detail/thread_safety.hpp: No such file or directory
 #include <boost/thread/detail/thread_safety.hpp>
``

There seems to be an issue with the compilation (includes).

@luca-heltai
Copy link
Member

This is failing with bundled boost. This header is missing. I'm adding it to our bundled boost.

#include <boost/thread/detail/thread_safety.hpp>

@luca-heltai
Copy link
Member

luca-heltai commented May 2, 2022

Also, @peterrum, shall we rename the functions to be more verbose also here? Something like dealii_cell_to_cgal_surface_mesh anddealii_triangulation_to_cgal_surface_mesh?

@peterrum
Copy link
Member

peterrum commented May 2, 2022

Something like dealii_cell_to_cgal_surface_mesh anddealii_triangulation_to_cgal_surface_mesh?

Sounds good 👍 I guess we will have at some stage functions that work in the opposite direction?

@fdrmrc
Copy link
Contributor Author

fdrmrc commented May 2, 2022

Sounds good 👍 I guess we will have at some stage functions that work in the opposite direction?

Yes, I'm working on it right now! @peterrum

Copy link
Member

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK from my side once the compilation issue has been sorted out!

@luca-heltai
Copy link
Member

I need help with the FindCGAL.cmake script. I wasted more hours than I can afford trying to get this working correctly on all three machines I have, and I don't seem to be able to do anything useful at this time.

Here are the issues:

  1. Versions < 5.0.0 of CGAL are not header only
  2. Also header only versions of CGAL maybe have some compiled stuff
  3. While find_package(CGAL) seems to work fine, I am not able to extract information in a consistent way and feed it back into deal.II

I think I need @tamiko's help here.

For users' codes, I do

find_package(CGAL REQUIRED)

target_link_libraries(${target} CGAL::CGAL)
include_directories(${CGAL_INCLUDE_DIRS})

In the FindCGAL.cmake file, however, I am not able to extract information from the CGAL::CGAL target in a consistent way, i.e., this does not seem to work consistently across different systems and cmake versions:

GET_PROPERTY(CGAL_INCLUDE_DIRS TARGET CGAL::CGAL PROPERTY INTERFACE_INCLUDE_DIRECTORIES)

some versions do, and some don't have the INTERFACE_INCLUDE_DIRECTORIES, and some do and don't have GET_PROPERTY(CGAL_LIBRARIES TARGET CGAL::CGAL PROPERTY INTERFACE_LINK_LIBRARIES)...

Any ideas?

@luca-heltai
Copy link
Member

@peterrum, for the moment I fixed the compilation by requiring a newer version of CGAL. In a followup PR I will update the simplex runner to 20.04 (20.04 ships with CGAL 5). Is there a reason for having it 18.04 in the first place?

@peterrum
Copy link
Member

peterrum commented May 4, 2022

It used to be that all linux runners used 18.04. But recently we switch one to be able to test C++20: #13535

@luca-heltai
Copy link
Member

@peterrum, can we merge this, and address the problem of the runner in a later PR? @fdrmrc is holding back a lot more stuff (there's about 5 more PRs to add), and I don't want those to be held back by the tester here.

Copy link
Member

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go ahead. @luca-heltai Could you open an issue to track the described problem.

@peterrum peterrum merged commit 73b814f into dealii:master May 4, 2022
@luca-heltai
Copy link
Member

#13668

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

Successfully merging this pull request may close these issues.

None yet

3 participants