-
Notifications
You must be signed in to change notification settings - Fork 247
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
[Core] Use PointerVectorSet as geometry container #12843
Conversation
@sunethwarna @mpentek as far as I understand, this shouldn't interfere with your current PVS upgrade. |
Nice, finally.... :) @matekelemen |
I'm not sure if that works. The hash map would be indexed by the identifier, while the pointer vector by the index. This is a matter of efficiency of the model becomes large. |
mmm... I'm not sure I'm getting your point at all. The EDIT: also note that this is what we actually do for elements/conditions, to which your orbservation would also be important. |
@tteschemacher, as far as I see, the geometry identifier is also an Another note: |
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.
If we are changing this to align with the other containers, then we need to fully remove the GeometryContainer
and alias it to the PointerVectorSet
of the geometries.
In principle, makes sense for me. But I'd do it in a second stage (just in case...). |
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.
Just a minor comment
kratos/sources/model_part_io.cpp
Outdated
@@ -288,7 +288,7 @@ void ModelPartIO::WriteGeometries(GeometryContainerType const& rThisGeometries) | |||
(*mpStream) << "Begin Geometries\t" << geometry_name << std::endl; | |||
const auto it_geom_begin = rThisGeometries.Geometries().begin(); | |||
(*mpStream) << "\t" << it_geom_begin->Id() << "\t"; | |||
auto& r_geometry = *(it_geom_begin.base()->second); | |||
auto& r_geometry = *(*(it_geom_begin.base())); |
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.
shouldn't be: auto& r_geometry = *it_geom_begin
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 can give it a try, but I think that this will give you the content of the begin()
iterator of the underlying container, which is an std::vector
or, in other words, a pointer to the geometry but not a reference to the geometry.
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.
Please give it a try! The PointerVectorSet has its * operator redefined.
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.
You were right! I didn't remember the redefinition. Thanks for the hint.
kratos/sources/model_part_io.cpp
Outdated
@@ -302,7 +302,7 @@ void ModelPartIO::WriteGeometries(GeometryContainerType const& rThisGeometries) | |||
for(std::size_t i = 1; i < rThisGeometries.NumberOfGeometries(); i++) { | |||
if(GeometryType::IsSame(*it_geom_previous, *it_geom_current)) { | |||
(*mpStream) << "\t" << it_geom_current->Id() << "\t"; | |||
r_geometry = *(it_geom_current.base()->second); | |||
r_geometry = *(*(it_geom_current.base())); |
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.
same
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.
Done.
kratos/sources/model_part_io.cpp
Outdated
@@ -313,7 +313,7 @@ void ModelPartIO::WriteGeometries(GeometryContainerType const& rThisGeometries) | |||
|
|||
(*mpStream) << "Begin Geometries\t" << geometry_name << std::endl; | |||
(*mpStream) << "\t" << it_geom_current->Id() << "\t"; | |||
r_geometry = *(it_geom_current.base()->second); | |||
r_geometry = *(*(it_geom_current.base())); |
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.
same
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.
Done.
@@ -473,7 +473,7 @@ void AuxiliarModelPartUtilities::RemoveOrphanNodesFromSubModelParts() | |||
} | |||
const auto& r_geometries = r_sub_model_part.Geometries(); | |||
for (auto it_geom = r_geometries.begin(); it_geom != r_geometries.end(); ++it_geom) { | |||
auto& r_geometry = *((it_geom.base())->second); | |||
auto& r_geometry = *(*(it_geom.base())); |
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.
same
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.
Done.
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.
Thanks!
📝 Description
So far, the
GeometryContainer
used thePointerHasMapSet
as internal container for the geometries. @pooyan-dadvand as we discussed the other day, this PR upgrades it to use the customaryPointerVectorSet
.Making it draft until we are sure that all the suites pass (I ran the main ones that might be directly affected by this change).