Kratos icon indicating copy to clipboard operation
Kratos copied to clipboard

[Core] Add Accessor for Table Derivatives

Open matekelemen opened this issue 1 year ago • 7 comments

Add an Accessor that fetches the derivatives from a table instead of the values. Example use case is getting stiffnesses from a displacement-force table.

matekelemen avatar Jun 20 '24 08:06 matekelemen

Do you think that we can generalize the original Table accessor to include your case? @RiccardoRossi

AlejandroCornejo avatar Jun 21 '24 07:06 AlejandroCornejo

Hi, i am not sure about how to achieve this without inducing a performance penalty...

@matekelemen how would you achieve that?

RiccardoRossi avatar Jun 21 '24 10:06 RiccardoRossi

Hi, i am not sure about how to achieve this without inducing a performance penalty...

@matekelemen how would you achieve that?

to answer myself, maybe we could template it in a "option" to be either get_value or get_derivative

RiccardoRossi avatar Jun 21 '24 10:06 RiccardoRossi

Hi, i am not sure about how to achieve this without inducing a performance penalty... @matekelemen how would you achieve that?

to answer myself, maybe we could template it in a "option" to be either get_value or get_derivative

like

template <SizeType DerivativeOrder = 0>
GetValue()
{
    if constexpr (DerivativeOrder  == 0) {
        return table.GetValue();
    } else if constexpr  (DerivativeOrder  == 1)
     return table.GetFirstDerivative();
}

(disregard notation errors, just to get the point) ?

AlejandroCornejo avatar Jun 23 '24 09:06 AlejandroCornejo

Hi, i am not sure about how to achieve this without inducing a performance penalty... @matekelemen how would you achieve that?

to answer myself, maybe we could template it in a "option" to be either get_value or get_derivative

like

template <SizeType DerivativeOrder = 0>
GetValue()
{
    if constexpr (DerivativeOrder  == 0) {
        return table.GetValue();
    } else if constexpr  (DerivativeOrder  == 1)
     return table.GetFirstDerivative();
}

(disregard notation errors, just to get the point) ?

This will result in different GetValue methods when exporting to Python.

rubenzorrilla avatar Jun 24 '24 11:06 rubenzorrilla

Hi, i am not sure about how to achieve this without inducing a performance penalty... @matekelemen how would you achieve that?

to answer myself, maybe we could template it in a "option" to be either get_value or get_derivative

like

template <SizeType DerivativeOrder = 0>
GetValue()
{
    if constexpr (DerivativeOrder  == 0) {
        return table.GetValue();
    } else if constexpr  (DerivativeOrder  == 1)
     return table.GetFirstDerivative();
}

(disregard notation errors, just to get the point) ?

This will result in different GetValue methods when exporting to Python.

yes indeed

AlejandroCornejo avatar Jun 24 '24 12:06 AlejandroCornejo

Looks ok to me

El lun, 24 jun 2024, 14:40, Alejandro Cornejo @.***> escribió:

Hi, i am not sure about how to achieve this without inducing a performance penalty... @matekelemen https://github.com/matekelemen how would you achieve that?

to answer myself, maybe we could template it in a "option" to be either get_value or get_derivative

like

template <SizeType DerivativeOrder = 0>GetValue() { if constexpr (DerivativeOrder == 0) { return table.GetValue(); } else if constexpr (DerivativeOrder == 1) return table.GetFirstDerivative(); }

(disregard notation errors, just to get the point) ?

This will result in different GetValue methods when exporting to Python.

yes indeed

— Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/pull/12472#issuecomment-2186485529, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5PWENOYTAVY2C3NIZ5NJTZJAHSDAVCNFSM6AAAAABJTOMCXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGQ4DKNJSHE . You are receiving this because you were mentioned.Message ID: @.***>

RiccardoRossi avatar Jun 24 '24 12:06 RiccardoRossi