-
Notifications
You must be signed in to change notification settings - Fork 245
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
[ModelPart] CreateNewElement/-Condition sorts Nodes #9227
Comments
rom my point of view the find does not work if the nodes are not sorted...so the sorting is an expected side effect i would say... the problem is that the Nodes array should always be sorted, if it is not it implies we are doing something wrong before |
but it works if it is PointerVectorSet my_set;
// ...
my_set.find(...); // this might do the Sort
const PointerVectorSet& const_ref = my_set;
const_ref.find(...); // this does not do Sort
why? |
the problem is probably the buffer size in PointerVectorSet. the PointerVectorSet probably needs a good rewrite/cleanup |
+100 |
You can create a temp vector
The order of the ids should be the one of the connectivity? (which is not necessarily ordered) |
I believe that we should take out the buffer (Which I can do by myself) |
@KratosMultiphysics/technical-committee have decided to add a new threadsafe method |
Question?, but you will be the responsible to store those nodes or will be stored somewhere? |
You will be responsible to store those until added to the modelpart. Mainly that would let you create a bunch of nodes without having to call the internal sort of the PointerVectorSet. |
So this is mostly a macro, because the ModelPart does not do anything special in order to create nodes |
The only thing special is the VariableLists |
but how does this solve the issue? I don't think adding tricky-to-use interfaces to the (already blob object) |
|
@KratosMultiphysics/technical-committee agrees that the issue is from The method of ModelPart is a side discussion for solving performance issue that we have in creation of nodes and we do it manually in several places and taking out the buffer will even worsen it. |
another problem I discovered: when accessing the (non-const) |
Description
CreateNewElement
andCreateNewCondition
sort the Nodes when the nodes are given by Ids, i.e. when using this function:Kratos/kratos/includes/model_part.h
Lines 1069 to 1072 in 5009962
If the Nodes are directly given then it works fine, i.e. when using this function:
Kratos/kratos/includes/model_part.h
Lines 1074 to 1077 in 5009962
The problems seems to be that the nodes are retrieved by Id using
pGetNode
:Kratos/kratos/sources/model_part.cpp
Line 948 in 5009962
pGetNode
callsfind
in theMesh
:Kratos/kratos/includes/mesh.h
Line 309 in 5009962
This call ends up in the
PointerVectorSet
where the offendingSort
is called (only in the non-const version offind
):Kratos/kratos/containers/pointer_vector_set.h
Line 484 in 5009962
IMO this sort is wrong. I would not expect my set to be sorted when I call
find
.Rationale: IMO the sort should be removed from the
find
function, i.e. the non-const
function should do the same as theconst
oneScope
ModelPart
To Reproduce
This prints:
Expected behavior
CreateNewElement
andCreateNewCondition
should not sort the Nodes@KratosMultiphysics/technical-committee
The text was updated successfully, but these errors were encountered: