Skip to content

[GeoMechanicsApplication] Updating FindNeighboursOfInterfacesProcess#14487

Merged
markelov208 merged 7 commits into
masterfrom
geo/14476-update-find-neighbours-of-interfaces-process
Jun 10, 2026
Merged

[GeoMechanicsApplication] Updating FindNeighboursOfInterfacesProcess#14487
markelov208 merged 7 commits into
masterfrom
geo/14476-update-find-neighbours-of-interfaces-process

Conversation

@markelov208

@markelov208 markelov208 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Please mark the PR with appropriate tags:

  • removed use of GlobalPointersVector.erase()
  • removed an empty line for column.mdpa

@markelov208 markelov208 self-assigned this Jun 8, 2026
@markelov208 markelov208 requested a review from a team as a code owner June 8, 2026 09:34
@markelov208 markelov208 requested review from avdg81 and rfaasse June 8, 2026 11:58

@avdg81 avdg81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Gennady,
Thanks a lot for investigating and resolving this issue. I have two minor suggestions that you may want to consider. Please, let me know what you think of them.

Comment on lines +26 to +36
GlobalPointersVector<Element> KeepNeighboursWithHigherLocalDimension(const GlobalPointersVector<Element>& rNeighbourElements,
const std::size_t InterfaceElementLocalDimension)
{
GlobalPointersVector<Element> kept_neighbours;
for (auto it = rNeighbourElements.ptr_begin(); it != rNeighbourElements.ptr_end(); ++it) {
if ((**it).GetGeometry().LocalSpaceDimension() > InterfaceElementLocalDimension) {
kept_neighbours.push_back(*it);
}
}

return kept_neighbours;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This helper function is more general than its name suggests. It returns all elements that have a local space dimension that is higher than the given local space dimension. There is nothing specific for neighbors or interface elements here. Perhaps we can reflect that more general nature by renaming a few things? Also, I think we can use an STL algorithm here, e.g.:

Suggested change
GlobalPointersVector<Element> KeepNeighboursWithHigherLocalDimension(const GlobalPointersVector<Element>& rNeighbourElements,
const std::size_t InterfaceElementLocalDimension)
{
GlobalPointersVector<Element> kept_neighbours;
for (auto it = rNeighbourElements.ptr_begin(); it != rNeighbourElements.ptr_end(); ++it) {
if ((**it).GetGeometry().LocalSpaceDimension() > InterfaceElementLocalDimension) {
kept_neighbours.push_back(*it);
}
}
return kept_neighbours;
GlobalPointersVector<Element> ExtractElementsWithHigherLocalDimension(const GlobalPointersVector<Element>& rElements,
std::size_t LocalSpaceDimension)
{
GlobalPointersVector<Element> result;
std::copy_if(rElements.ptr_begin(), rElements.ptr_end(), std::back_inserter(result),
[LocalSpaceDimension](auto ElementPtr) {
return ElementPtr->GetGeometry().LocalSpaceDimension() > LocalSpaceDimension;
});
return result;

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. You are absolutely right and perhaps, this function will move to utilities later. Used your suggestion.

Comment on lines +78 to +79
r_neighbour_elements = KeepNeighboursWithHigherLocalDimension(
r_neighbour_elements, interface_element_local_dimension);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that we no longer have the lambda expression that needed interface_element_local_dimension, we can perhaps move the function call to where we need the value:

Suggested change
r_neighbour_elements = KeepNeighboursWithHigherLocalDimension(
r_neighbour_elements, interface_element_local_dimension);
r_neighbour_elements = KeepNeighboursWithHigherLocalDimension(
r_neighbour_elements, r_interface_element.GetGeometry().LocalSpaceDimension());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed before it was used in the for loop. changed.

@markelov208 markelov208 requested a review from avdg81 June 10, 2026 12:12

@avdg81 avdg81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Gennady,
Thanks for processing the review suggestions. This PR is ready to go in my opinion. 👍

@markelov208 markelov208 merged commit 8a7f579 into master Jun 10, 2026
19 of 20 checks passed
@markelov208 markelov208 deleted the geo/14476-update-find-neighbours-of-interfaces-process branch June 10, 2026 19:28
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.

[GeoMechanicsApplication] Updating FindNeighboursOfInterfacesProcess

2 participants