Skip to content

Conversation

@roigcarlo
Copy link
Member

📝 Description
This (hopefully) fixes once and for all the auto register macro. Specifically this PR addresses the case of classes that contains a variable number of templates which are a mix between values and other classes (which can recursively be also mixed templates)

The only requirement is that the class cannot contain "," when passing it to the macro, so the old:

KRATOS_REGISTRY_ADD_TEMPLATE_PROTOTYPE("Processes.KratosMultiphysics", Process, MyProcess<Foo,Dim>)

becomes:

using RegistryBaseType = Process;
using RegistryClassType = MyProcess<Foo,Dim>;
KRATOS_REGISTRY_ADD_TEMPLATE_PROTOTYPE("Processes.KratosMultiphysics", RegistryBaseType, RegistryClassType)

@ddiezrod, @loumalouomega I've updated the ray-casting processes accordingly so everyone that copy pastes goes to the correct code by default

@rubenzorrilla This is a clean up version of what we tried yesterday.

@pooyan-dadvand, @matekelemen This is the only solution we've found. I am still unable to pass variadric templates with class and values, ping you both because you both told me that there were ways, feel free to suggest changes if we can avoid the demangling by directly instantiating the class/value types.

P.s. I keept it in two different macros because the typeid(_).name() does not work with incomplete type while they are not templated in the basic version.

P.s.2: There is a non-null possibility that this fails on windows.

@roigcarlo roigcarlo requested a review from a team as a code owner September 9, 2025 09:34
Copy link
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

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

👍🏻

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.

3 participants