https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
HomogenizationInterface< T > Class Template Reference

Interface for objects that use the homogenization constraint. More...

#include <HomogenizationInterface.h>

Inheritance diagram for HomogenizationInterface< T >:
[legend]

Public Member Functions

 HomogenizationInterface (const InputParameters &parameters)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

const Homogenization::ConstraintMapcmap () const
 Get the constraint map.
 

Private Attributes

Homogenization::ConstraintMap _cmap
 Constraint map.
 

Detailed Description

template<class T>
class HomogenizationInterface< T >

Interface for objects that use the homogenization constraint.

Definition at line 37 of file HomogenizationInterface.h.

Constructor & Destructor Documentation

◆ HomogenizationInterface()

template<class T >
HomogenizationInterface< T >::HomogenizationInterface ( const InputParameters parameters)

Definition at line 69 of file HomogenizationInterface.h.

70 : T(parameters)
71{
72 // Constraint types
73 auto types = parameters.get<MultiMooseEnum>("constraint_types");
74 if (types.size() != Moose::dim * Moose::dim)
75 this->paramError("constraint_types",
76 "Number of constraint types must equal ",
78 ", but ",
79 types.size(),
80 " are provided.");
81
82 // Targets to hit
83 const std::vector<FunctionName> & fnames = parameters.get<std::vector<FunctionName>>("targets");
84
85 // Prepare the constraint map
86 unsigned int fcount = 0;
87 for (const auto j : make_range(Moose::dim))
88 for (const auto i : make_range(Moose::dim))
89 {
90 const auto idx = i + Moose::dim * j;
91 const auto ctype = static_cast<Homogenization::ConstraintType>(types.get(idx));
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 // Make sure there aren't unused targets
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.
const double T
for(PetscInt i=0;i< nvars;++i)
unsigned int dim
Homogenization::ConstraintMap _cmap
Constraint map.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
ConstraintType
Constraint type: stress/PK stress or strain/deformation gradient.
static constexpr std::size_t dim
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
IntRange< T > make_range(T beg, T end)

Member Function Documentation

◆ cmap()

template<class T >
const Homogenization::ConstraintMap & HomogenizationInterface< T >::cmap ( ) const
inlineprotected

Get the constraint map.

Definition at line 46 of file HomogenizationInterface.h.

46{ return _cmap; }

◆ validParams()

template<class T >
InputParameters HomogenizationInterface< T >::validParams ( )
static

Definition at line 55 of file HomogenizationInterface.h.

56{
57 InputParameters params = T::validParams();
59 "constraint_types",
61 "Type of each constraint: strain, stress, or none. The types are specified in the "
62 "column-major order, and there must be 9 entries in total.");
63 params.addRequiredParam<std::vector<FunctionName>>(
64 "targets", "Functions giving the targets to hit for constraint types that are not none.");
65 return params;
66}
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MultiMooseEnum constraintType("strain stress none")

Referenced by HomogenizedTotalLagrangianStressDivergence::validParams(), and ComputeHomogenizedLagrangianStrain::validParams().

Member Data Documentation

◆ _cmap

template<class T >
Homogenization::ConstraintMap HomogenizationInterface< T >::_cmap
private

The documentation for this class was generated from the following file: