3 #include <Caribou/config.h>
4 #include <sofa/core/objectmodel/BaseObject.h>
5 #include <sofa/core/behavior/MechanicalState.h>
8 namespace SofaCaribou::material {
10 template<
class DataTypes>
12 static constexpr
auto Dimension = DataTypes::spatial_dimensions;
13 using Coord =
typename DataTypes::Coord;
14 using Real =
typename Coord::value_type;
41 virtual Eigen::Matrix<Real, Dimension, Dimension>
42 PK2_stress(
const Real & J,
const Eigen::Matrix<Real, Dimension, Dimension> & C)
const = 0;
52 virtual Eigen::Matrix<Real, 6, 6>
60 return DataTypes::Name();
71 std::string requested_data_type = arg->getAttribute(
"template",
"");
74 if (requested_data_type == this_data_type) {
78 if (not requested_data_type.empty()) {
79 arg->logError(
"Requested data type ('" +requested_data_type +
"') is not '"+this_data_type+
"'.");
83 if (
dynamic_cast<sofa::core::behavior::MechanicalState<DataTypes>*
>(context->getMechanicalState()) !=
nullptr) {
87 arg->logError(
"Cannot deduce the data type from the current context. Set the argument 'template=\""+this_data_type+
"\"' to correct this.");