26 #include "libmesh/zero_function.h" 30 init(
const libMesh::boundary_id_type bid,
31 const std::vector<unsigned int>& constrained_vars,
33 libMesh::VariableIndexing index,
34 unsigned int n_sys_vars) {
39 std::set<libMesh::boundary_id_type> bid_set;
45 std::unique_ptr<libMesh::FunctionBase<Real> >
46 function(
new libMesh::ZeroFunction<Real>);
56 if (index == libMesh::SYSTEM_VARIABLE_ORDER)
57 libmesh_assert_greater(n_sys_vars, 0);
61 class FunctionWrapper:
public libMesh::FunctionBase<Real> {
64 libMesh::VariableIndexing index,
65 unsigned int n_constrained_vars,
66 unsigned int n_sys_vars):
67 libMesh::FunctionBase<Real>(),
70 _n_constrained_vars(n_constrained_vars),
71 _n_sys_vars(n_sys_vars) {
73 if (_index == libMesh::SYSTEM_VARIABLE_ORDER)
74 libmesh_assert_greater(n_sys_vars, 0);
78 FunctionWrapper(
const FunctionWrapper& f):
79 libMesh::FunctionBase<Real>(),
82 _n_constrained_vars(f._n_constrained_vars),
83 _n_sys_vars(f._n_sys_vars) { }
85 virtual ~FunctionWrapper() {}
87 virtual std::unique_ptr<libMesh::FunctionBase<Real>> clone ()
const {
89 std::unique_ptr<libMesh::FunctionBase<Real>> f;
90 f.reset(
new FunctionWrapper(*
this));
100 virtual Real operator() (
const libMesh::Point & p,
101 const Real time = 0.) {
106 virtual void operator() (
const libMesh::Point & p,
108 libMesh::DenseVector<Real>& output) {
113 if (_index == libMesh::SYSTEM_VARIABLE_ORDER) {
114 libmesh_assert_equal_to(v.size(), _n_sys_vars);
115 output.resize(_n_sys_vars);
116 for (
unsigned int i=0; i<_n_sys_vars; i++) output(i) = v(i);
118 else if (_index == libMesh::LOCAL_VARIABLE_ORDER) {
120 libmesh_assert_equal_to(v.size(), _n_constrained_vars);
121 output.resize(_n_constrained_vars);
122 for (
unsigned int i=0; i<_n_constrained_vars; i++) output(i) = v(i);
129 libMesh::VariableIndexing _index;
130 unsigned int _n_constrained_vars;
131 unsigned int _n_sys_vars;
134 std::unique_ptr<libMesh::FunctionBase<Real>>
135 function(
new FunctionWrapper(*f_val,
137 constrained_vars.size(),
std::unique_ptr< libMesh::DirichletBoundary > _dirichlet_boundary
Dirichlet boundary function for this boundary.
Matrix< Real, Dynamic, 1 > RealVectorX
void init(const libMesh::boundary_id_type bid, const std::vector< unsigned int > &constrained_vars, MAST::FieldFunction< RealVectorX > *f_val=nullptr, libMesh::VariableIndexing index=libMesh::SYSTEM_VARIABLE_ORDER, unsigned int n_sys_vars=0)
initializes the object for the specified domain id (either boundary, or subdomain), for the displacement components initialized using a bitwise operator.