27#include "neml2/tensors/Scalar.h"
31#include <unordered_map>
61template <std::
size_t N>
86 "Parameterization not found in the conversion table. This typically means that the "
87 "given combination of Lame parameters is not yet supported.");
95 for (std::size_t
i = 0;
i <
N; ++
i)
96 ret[
i] = _converters[
i](
input, _deriv_requested);
104 for (std::size_t
i = 0;
i <
N; ++
i)
112 return _converters[find_index(
p)](
input, _deriv_requested);
119 for (std::size_t
i = 0;
i <
N; ++
i)
128 for (std::size_t
i = 1;
i <
N; ++
i)
129 neml_assert(
static_cast<std::uint8_t
>(
ps[
i]) >
static_cast<std::uint8_t
>(
ps[
i - 1]),
130 "Internal error: ElasticityConverters only accept Lame parameters sorted in the "
131 "following order: LAME_LAMBDA, BULK_MODULUS, SHEAR_MODULUS, YOUNGS_MODULUS, "
132 "POISSONS_RATIO, P_WAVE_MODULUS.");
138 auto it = std::find(_output_parameterization.begin(), _output_parameterization.end(), p);
140 "Internal error: Lame parameter not found in the output parameterization.");
141 return std::distance(_output_parameterization.begin(), it);
151 std::array<ConverterType, N> _converters;
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:54
Base class for converters responsible for converting between different parameterizations of the linea...
Definition ElasticityConverter.h:63
std::array< Scalar, N > DerivativeType
Definition ElasticityConverter.h:68
ResultType convert(const InputPtrType &input) const
Convert input to independent elastic constants with derivatives.
Definition ElasticityConverter.h:101
ConversionType convert(const InputPtrType &input, const ElasticConstant p) const
Convert input to a single elastic constant with derivatives.
Definition ElasticityConverter.h:116
ElasticityConverter(const ConversionTableType &table, const ConverterKey &output_parameterization, const ConverterKey &input_parameterization, const DerivativeFlagType &deriv_requested)
Definition ElasticityConverter.h:76
std::array< const Scalar *, N > InputPtrType
Definition ElasticityConverter.h:66
std::array< Scalar, N > InputType
Definition ElasticityConverter.h:65
std::array< bool, N > DerivativeFlagType
Definition ElasticityConverter.h:67
ConversionType convert(const InputType &input, const ElasticConstant p) const
Convert input to a single elastic constant with derivatives.
Definition ElasticityConverter.h:110
std::array< ConversionType, N > ResultType
Definition ElasticityConverter.h:70
std::pair< Scalar, DerivativeType > ConversionType
Definition ElasticityConverter.h:69
ResultType convert(const InputType &input) const
Convert input to independent elastic constants with derivatives.
Definition ElasticityConverter.h:92
std::map< ConverterKey, std::array< ConverterType, N > > ConversionTableType
Definition ElasticityConverter.h:74
std::array< ElasticConstant, N > ConverterKey
Definition ElasticityConverter.h:72
Definition CrossRef.cxx:31
ElasticConstant
Definition ElasticityConverter.h:38
std::string name(ElasticConstant p)
Definition ElasticityConverter.cxx:30
void neml_assert(bool assertion, Args &&... args)
Definition error.h:64