|
SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
|
A class to provide a runtime view of an EOS model and its relations. This class is used to provide a uniform interface for evaluating relations and partial derivatives at runtime. More...
#include <views.hpp>
Public Member Functions | |
| template<typename EOS> requires RuntimeEOSModel<std::remove_cvref_t<EOS>> | |
| EOSView (const EOS &eos) noexcept | |
| Constructs an EOSView from a runtime EOS model. This constructor is used to create a view of the EOS model and its relations at runtime. | |
| template<typename EOS> requires RuntimeEOSModel<std::remove_cvref_t<EOS>> | |
| EOSView (const EOS &&)=delete | |
| Deleted constructor to prevent constructing an EOSView from an rvalue EOS model. This is to prevent dangling references and ensure that the EOS model instance outlives the EOSView. | |
| std::span< const dimensions::runtime::RuntimeRelationDescriptor > | relations () const noexcept |
| Returns a span of the runtime relation descriptors for the EOS model. | |
| bool | supports (const dimensions::runtime::ThermodynamicQuantityID outputQuantity, const std::span< const dimensions::runtime::ThermodynamicQuantityID > inputQuantities) const noexcept |
| Determines if the EOS model supports a relation with the given output quantity and input quantities at runtime. This is used to check if a relation can be evaluated at runtime. | |
| std::expected< dimensions::runtime::RuntimeQuantityValue, utils::errors::SERiFErrorCode > | try_evaluate (const dimensions::runtime::ThermodynamicQuantityID outputQuantity, const std::span< const dimensions::runtime::RuntimeQuantityValue > inputQuantities) const |
| Evaluates a relation with the given output quantity and input quantities at runtime. This is used to evaluate relations at runtime. | |
| template<dimensions::runtime::RuntimeIdentifiedThermodynamicQuantity OutputQuantity, dimensions::ThermodynamicQuantityValueType... InputValues> | |
| std::expected< dimensions::QuantityValue< OutputQuantity >, utils::errors::SERiFErrorCode > | try_evaluate (const InputValues... inputValues) const |
| Evaluates a relation with the given output quantity and input quantities at runtime. This is used to evaluate relations at runtime. | |
| std::expected< double, utils::errors::SERiFErrorCode > | try_partial_derivative (const dimensions::runtime::ThermodynamicQuantityID outputQuantity, const dimensions::runtime::ThermodynamicQuantityID withRespectTo, const std::span< const dimensions::runtime::RuntimeQuantityValue > inputValues) const |
| Evaluates a partial derivative of a relation with the given output quantity and input quantities at runtime. This is used to evaluate partial derivatives at runtime. | |
| template<dimensions::runtime::RuntimeIdentifiedThermodynamicQuantity OutputQuantity, dimensions::runtime::RuntimeIdentifiedThermodynamicQuantity InputQuantity, dimensions::QuantityValueType... InputValues> | |
| std::expected< dimensions::PartialDerivative< OutputQuantity, InputQuantity >, utils::errors::SERiFErrorCode > | try_partial_derivative (const InputValues... inputValues) const |
| Evaluates a partial derivative of a relation with the given output quantity and input quantities at runtime. This is used to evaluate partial derivatives at runtime. | |
Private Types | |
| using | RuntimeEvaluateFunction |
| A type alias for a function pointer to a runtime evaluation function. This is used to store the evaluation function for the EOS model. | |
| using | RuntimePartialDerivativeFunction |
| A type alias for a function pointer to a runtime partial derivative evaluation function. This is used to store the partial derivative evaluation function for the EOS model. | |
Private Member Functions | |
| const dimensions::runtime::RuntimeRelationDescriptor * | find_relation (const dimensions::runtime::ThermodynamicQuantityID outputQuantity, const std::span< const dimensions::runtime::ThermodynamicQuantityID > inputQuantities) const noexcept |
| Finds a relation with the given output quantity and input quantities at runtime. This is used to find relations at runtime. | |
| std::expected< const dimensions::runtime::RuntimeRelationDescriptor *, utils::errors::SERiFErrorCode > | validate_relation_request (const dimensions::runtime::ThermodynamicQuantityID outputQuantity, const std::span< const dimensions::runtime::RuntimeQuantityValue > inputValues) const |
| Validates a relation request with the given output quantity and input quantities at runtime. This is used to validate relations at runtime. | |
Static Private Member Functions | |
| template<typename Value> | |
| static std::expected< Value, utils::errors::SERiFErrorCode > | runtime_failure (const utils::errors::SERiFErrorCode code) |
| A helper function to handle runtime failures. This is used to simplify the usage of std::expected in the runtime system. | |
Private Attributes | |
| const void * | m_object |
| Type erased pointer to the EOS model instance. | |
| std::span< const dimensions::runtime::RuntimeRelationDescriptor > | m_relations |
| A span of the runtime relation descriptors for the EOS model. | |
| RuntimeEvaluateFunction | m_evaluate |
| A function pointer to the runtime evaluation function for the EOS model. | |
| RuntimePartialDerivativeFunction | m_partialDerivative |
| A function pointer to the runtime partial derivative evaluation function for the EOS model. | |
A class to provide a runtime view of an EOS model and its relations. This class is used to provide a uniform interface for evaluating relations and partial derivatives at runtime.
|
private |
A type alias for a function pointer to a runtime evaluation function. This is used to store the evaluation function for the EOS model.
A type alias for a function pointer to a runtime partial derivative evaluation function. This is used to store the partial derivative evaluation function for the EOS model.
|
inlineexplicitnoexcept |
Constructs an EOSView from a runtime EOS model. This constructor is used to create a view of the EOS model and its relations at runtime.
| EOS | The type of the EOS model to view. |
| eos | The EOS model instance to view. |
|
explicitdelete |
|
inlinenodiscardprivatenoexcept |
Finds a relation with the given output quantity and input quantities at runtime. This is used to find relations at runtime.
| outputQuantity | The output quantity to find the relation for. |
| inputQuantities | The input quantities to find the relation for. |
|
inlinenodiscardnoexcept |
Returns a span of the runtime relation descriptors for the EOS model.
|
inlinestaticnodiscardprivate |
A helper function to handle runtime failures. This is used to simplify the usage of std::expected in the runtime system.
| Value | The type of the value to return. |
| code | The SERiFErrorCode to return. |
|
inlinenodiscardnoexcept |
Determines if the EOS model supports a relation with the given output quantity and input quantities at runtime. This is used to check if a relation can be evaluated at runtime.
| outputQuantity | The output quantity to check. |
| inputQuantities | The input quantities to check. |
|
inlinenodiscard |
Evaluates a relation with the given output quantity and input quantities at runtime. This is used to evaluate relations at runtime.
| outputQuantity | The output quantity to evaluate. |
| inputQuantities | The input quantities to evaluate. |
|
inlinenodiscard |
Evaluates a relation with the given output quantity and input quantities at runtime. This is used to evaluate relations at runtime.
| OutputQuantity | The output quantity to evaluate. |
| InputValues | The input values to evaluate. |
|
inlinenodiscard |
Evaluates a partial derivative of a relation with the given output quantity and input quantities at runtime. This is used to evaluate partial derivatives at runtime.
| outputQuantity | The output quantity to evaluate. |
| withRespectTo | The input quantity with respect to which the partial derivative is taken. |
| inputValues | The input values to evaluate. |
|
inlinenodiscard |
Evaluates a partial derivative of a relation with the given output quantity and input quantities at runtime. This is used to evaluate partial derivatives at runtime.
| OutputQuantity | The output quantity to evaluate. |
| InputQuantity | The input quantity with respect to which the partial derivative is taken. |
| InputValues | The types of the input values. |
| inputValues | The input values to evaluate. |
|
inlinenodiscardprivate |
Validates a relation request with the given output quantity and input quantities at runtime. This is used to validate relations at runtime.
| outputQuantity | The output quantity to validate. |
| inputValues | The input values to validate. |
|
private |
A function pointer to the runtime evaluation function for the EOS model.
|
private |
Type erased pointer to the EOS model instance.
|
private |
A function pointer to the runtime partial derivative evaluation function for the EOS model.
|
private |
A span of the runtime relation descriptors for the EOS model.