While I was debugging the kratos cpp tests (they do not run fine in my pc currently) I realized that the variables in the Core are registered twice. It is not introducing bugs (afak), but it is useless.
In particular, the line
https://github.com/KratosMultiphysics/Kratos/blob/93a0288b434de86b7b50504f575dafe1ffe6ac3a/kratos/sources/kernel.cpp#L28
is calling the registering function, but the next line is importing the Core, which again registers the variables.
Does anyone know if this is done on purpose?
I removed the line referenced above and everything runs ok...
Just referencing @RiccardoRossi , @roigcarlo
I found the same when doing #3666, I leave it as it is to not break anything :P
Is the function being called twice or is there another call in the code?
Line 29 calls line 51
https://github.com/KratosMultiphysics/Kratos/blob/93a0288b434de86b7b50504f575dafe1ffe6ac3a/kratos/sources/kernel.cpp#L51
, which takes us to
https://github.com/KratosMultiphysics/Kratos/blob/f36684aee65f1fae924d4e9a63bbcb8dea9d544e/kratos/includes/kratos_application.h#L89
which does exactly the same as what we just did (see my first message).
It is still there?!? My fault then...
Let me explain the historical reason: Now they are calling twice but they used to be different. One was to registering the variables in core of Kratos.so and another one for registering the core of application. After we changed the library structure of Kratos and put the core as a single shared library. So now only one of them is needed.
Understood. So I added this to the PR #3786 . I close this one and if there's issues we can talk about them there.