71{
72
75 this->paramError("constraint_types",
76 "Number of constraint types must equal ",
78 ", but ",
79 types.size(),
80 " are provided.");
81
82
83 const std::vector<FunctionName> & fnames = parameters.
get<std::vector<FunctionName>>(
"targets");
84
85
86 unsigned int fcount = 0;
89 {
93 {
94 if (fcount >= fnames.size())
95 this->paramError(
96 "targets",
97 "Number of target functions must equal the number of non-none constraint "
98 "types. Only ",
99 fnames.size(),
100 " are provided.");
101 const Function *
const f = &this->getFunctionByName(fnames[fcount++]);
102 _cmap[{i, j}] = {ctype,
f};
103 }
104 }
105
106
107 if (fcount != fnames.size())
108 this->paramError(
109 "targets",
110 "Number of target functions must equal the number of non-none constraint types. ",
111 fnames.size(),
112 " are provided, but ",
113 fcount,
114 " are used.");
115}
Real f(Real x)
Test function for Brents method.
for(PetscInt i=0;i< nvars;++i)
Homogenization::ConstraintMap _cmap
Constraint map.
ConstraintType
Constraint type: stress/PK stress or strain/deformation gradient.
static constexpr std::size_t dim
IntRange< T > make_range(T beg, T end)