Skip to content

Conversation

@SoilRos
Copy link
Member

@SoilRos SoilRos commented Nov 13, 2025

This PR ensures that the entity marking process conforms to dune interface by adding a boolean flag that defines whether to throw an exception when the marking is invalid or not.

If the flag is false, the function returns gracefully as the dune-grid interface expects. If true, the function will throw a message with the reason of the failure. The default flag (false) follows the dune interface.

In cases where the LGR is explicitly requested by the user, the flag is set to true to still provide useful diagnostics.

Ensures that the entity marking process conforms to dune interface by adding a boolean flag that defines whether to throw an exception when the marking is invalid or not. If false, the function returns gracefully as the dune-grid interface expects. If true, the function will throw a message with the reason of the failure.
@SoilRos SoilRos self-assigned this Nov 13, 2025
@SoilRos SoilRos requested a review from aritorto November 13, 2025 16:34
@SoilRos SoilRos added enhancement manual:irrelevant This PR is a minor fix and should not appear in the manual labels Nov 13, 2025
@SoilRos
Copy link
Member Author

SoilRos commented Nov 13, 2025

jenkins build this please

@SoilRos SoilRos mentioned this pull request Nov 13, 2025
Copy link
Member

@aritorto aritorto left a comment

Choose a reason for hiding this comment

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

Nice fix towards being able to run the DUNE Grid test! Only one question and minor suggestions

// Mark all the elements of the current leaf grid view for refinement
mark(1, element);
assignRefinedLevel[element.index()] = preAdaptMaxLevel +1;
if (mark(1, element))
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why here we do not add the throwOnFailure flag with true? I would say we want to throw if the element is at the boundary of an LGR

mark(1, element);
assignRefinedLevel[element.index()] = preAdaptMaxLevel +1;
if (mark(1, element))
assignRefinedLevel[element.index()] = preAdaptMaxLevel +1;
Copy link
Member

Choose a reason for hiding this comment

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

Accidental white-space?

auto assignAndDetect = [this, &assignRefinedLevel, &lgr_with_at_least_one_active_cell](const cpgrid::Entity<0>& element, int level)
{
mark(1, element);
mark(1, element, true);
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add /* throwOnFailure = */ before true? So it's easier to read/understand

}
if(belongsToLevel) {
this->mark(1, element);
this->mark(1, element, true);
Copy link
Member

Choose a reason for hiding this comment

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

Same here (the suggestion of /* throwOnFailure = */ true) and in the other files too, please

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

Labels

enhancement manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants