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

Move implementation of implicit_function() into .cc file #13932

Merged

Conversation

fdrmrc
Copy link
Contributor

@fdrmrc fdrmrc commented Jun 8, 2022

This moves the implementation of GridGenerator::implicit_function() inside grid_generator.cc and adds the corresponding stub.

To fix some issues with headers, this depends on #13929 , only be572d6 should be looked at.

@luca-heltai luca-heltai added this to In progress in CGAL Support via automation Jun 8, 2022
@luca-heltai luca-heltai added this to the Release 9.4 milestone Jun 8, 2022
@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from d57a795 to ada3eb1 Compare June 8, 2022 14:00
@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from ada3eb1 to 5534994 Compare June 8, 2022 14:45
@drwells
Copy link
Member

drwells commented Jun 8, 2022

This fixes part of #13926, but, in general, we need to avoid including any non-forwarded CGAL headers in our own headers to fully fix the problem.

To that end - could you move CGAL::AdditionalData into a separate header and define its constructor in a source file? That will completely eliminate the need for any CGAL stuff in GridGenerator.

Copy link
Member

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Also please rebase on top of master now.

include/deal.II/cgal/triangulation.h Show resolved Hide resolved
include/deal.II/cgal/triangulation.h Show resolved Hide resolved
@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from c16e551 to be572d6 Compare June 9, 2022 06:48
@masterleinad
Copy link
Member

/rebuild

Copy link
Member

@drwells drwells left a comment

Choose a reason for hiding this comment

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

👍

@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from be572d6 to 8329385 Compare June 9, 2022 14:20
@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from 8329385 to eee8625 Compare June 9, 2022 14:38
double facet_s = CGAL::parameters::is_default_parameter(true),
double facet_d = CGAL::parameters::is_default_parameter(true),
double cell_radius_edge_r = CGAL::parameters::is_default_parameter(true),
double cell_s = CGAL::parameters::is_default_parameter(true))
Copy link
Member

Choose a reason for hiding this comment

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

I double checked this and I don't understand why these are the default values. In particular, in my installed copy of CGAL/boost/graph/Named_function_parameters.h that function is defined as

bool inline is_default_parameter(const internal_np::Param_not_found&)
{
  return true;
}

template <class T>
bool is_default_parameter(const T&)
{
  return false;
}

i.e., these are always true which will be converted to 1 - why do we do this?

Copy link
Member

Choose a reason for hiding this comment

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

We also don't do this in 2D.

Copy link
Member

Choose a reason for hiding this comment

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

I thought this is what the CGAL::Mesh_criteria_3 uses as default values. We don't do this in 2d because in 2d we use Surface_mesh_criteria, which takes double values as input, and not named parameters. @fdrmrc, can you double check that this is actually the case? I seem to remember that the default should be something like cgal_ignored, which is not the same as a default_parameter when converted to double.

Copy link
Contributor Author

@fdrmrc fdrmrc Jun 9, 2022

Choose a reason for hiding this comment

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

My original issue was that this ignored value (also written in CGAL documentation) is not available in user codes. However, inside CGAL::Mesh_Criteria_3 they have:

https://github.com/CGAL/cgal/blob/a8e87526348d2d1faa2ea893747314853ee6868d/Mesh_3/include/CGAL/Mesh_criteria_3.h#L97-L111

which suggests to replace my CGAL::parameters::is_default_parameter(true) with their default (doubles) values, as we're allowing only doubles so far. All cgal tests are still okay.

I've just rebased and force pushed this change, but I'm okay with other options as well. The best choice would clearly be to allow named parameters, but that is not something I can fix (and test) in next hours.

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the lines you pointed out, I think we should replace the default values with std::limits::max for the first guy, and zero for all the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that one was added in one the next PRs. I'll add it here now.

@tamiko
Copy link
Member

tamiko commented Jun 9, 2022

I can confirm that moving the CGAL headers into the one compilation unit reduces the bogus misleading indentation warning to one compilation unit.

Incidentally this improves parsing and compilation of a lot of compilation units. In numbers: Compiling the entire library (debug configuration only, full dependencies) with this pull request took 5:59 min. Without this pull request I get 7:16 min.

@fdrmrc fdrmrc force-pushed the cgal-move_implementation_implicit_function branch from 469fca1 to 2aa60d8 Compare June 10, 2022 08:35
@drwells
Copy link
Member

drwells commented Jun 10, 2022

Incidentally this improves parsing and compilation of a lot of compilation units. In numbers: Compiling the entire library (debug configuration only, full dependencies) with this pull request took 5:59 min. Without this pull request I get 7:16 min.

I believe it. We should try hard to avoid putting external library headers in our own headers for precisely this reason.

@tamiko tamiko merged commit 587e1e8 into dealii:master Jun 10, 2022
CGAL Support automation moved this from In progress to Done Jun 10, 2022
mkghadban pushed a commit to OpenFCST/dealii that referenced this pull request Sep 8, 2022
…tion_implicit_function

Move implementation of implicit_function() into .cc file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants