libMesh
Public Member Functions | Public Attributes | List of all members
libMesh::DirichletBoundary Class Reference

This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids and system variable ids. More...

#include <dirichlet_boundaries.h>

Public Member Functions

 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > *f_in, const FunctionBase< Gradient > *g_in=libmesh_nullptr)
 Constructor for a system-variable-order boundary using pointers-to-functors. More...
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > &f_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 Constructor for a boundary from reference-to-functor. More...
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const FunctionBase< Number > &f_in, const FunctionBase< Gradient > &g_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 Constructor for a system-variable-order boundary from references-to-functors. More...
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > *f_in, const FEMFunctionBase< Gradient > *g_in=libmesh_nullptr)
 Constructor for a system-variable-order boundary from pointers-to-fem-functors. More...
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > &f_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 Constructor for a system-variable-order boundary from reference-to-fem-functor. More...
 
 DirichletBoundary (const std::set< boundary_id_type > &b_in, const std::vector< unsigned int > &variables_in, const System &f_sys_in, const FEMFunctionBase< Number > &f_in, const FEMFunctionBase< Gradient > &g_in, VariableIndexing type=SYSTEM_VARIABLE_ORDER)
 Constructor for a system-variable-order boundary from references-to-fem-functors. More...
 
 DirichletBoundary (const DirichletBoundary &dirichlet_in)
 Copy constructor. More...
 
 ~DirichletBoundary ()
 Standard destructor. More...
 

Public Attributes

std::set< boundary_id_typeb
 
std::vector< unsigned intvariables
 
UniquePtr< FunctionBase< Number > > f
 
UniquePtr< FunctionBase< Gradient > > g
 
UniquePtr< FEMFunctionBase< Number > > f_fem
 
UniquePtr< FEMFunctionBase< Gradient > > g_fem
 
const Systemf_system
 

Detailed Description

This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids and system variable ids.

Dirichlet values must be supplied as the input function "f"; when using some specialized elements, gradient values must be supplied via the input function "g".

Dirichlet functions may be subclasses of FunctionBase or FEMFunctionBase; in the latter case the user must also supply a reference to the System on which the FEMFunctionBase will be evaluated.

Dirichlet functions are allowed to return NaN; if this is encountered, then the degree of freedom values in a patch around the location of the returned NaN will be left unconstrained. E.g. a NaN on a boundary edge in 3D would leave that edge and the two adjoining face interiors unconstrained, but would still permit the other edge and node DoFs around those faces to be constrained.

Author
Roy Stogner
Date
2012 Class for specifying Dirichlet boundary conditions as constraints.

Definition at line 88 of file dirichlet_boundaries.h.

Constructor & Destructor Documentation

libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > *  f_in,
const FunctionBase< Gradient > *  g_in = libmesh_nullptr 
)

Constructor for a system-variable-order boundary using pointers-to-functors.

Definition at line 34 of file dirichlet_boundary.C.

References f, g, and libMesh::libmesh_assert().

Referenced by DirichletBoundary().

37  :
38  b(b_in),
39  variables(variables_in),
40  f(f_in ? f_in->clone() : UniquePtr<FunctionBase<Number>>()),
41  g(g_in ? g_in->clone() : UniquePtr<FunctionBase<Gradient>>()),
42  f_fem(UniquePtr<FEMFunctionBase<Number>>()),
43  g_fem(UniquePtr<FEMFunctionBase<Gradient>>()),
45 {
46  libmesh_assert(f.get());
47  f->init();
48  if (g.get())
49  g->init();
50 }
UniquePtr< FunctionBase< Gradient > > g
const class libmesh_nullptr_t libmesh_nullptr
std::vector< unsigned int > variables
libmesh_assert(j)
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
virtual UniquePtr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > &  f_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a boundary from reference-to-functor.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 54 of file dirichlet_boundary.C.

References libMesh::CompositeFunction< Output >::attach_subfunction(), libMesh::FunctionBase< Output >::clone(), DirichletBoundary(), f, and libMesh::LOCAL_VARIABLE_ORDER.

57  :
58  b(b_in),
59  variables(variables_in),
60  f(UniquePtr<FunctionBase<Number>>()),
61  g(UniquePtr<FunctionBase<Gradient>>()),
62  f_fem(UniquePtr<FEMFunctionBase<Number>>()),
63  g_fem(UniquePtr<FEMFunctionBase<Gradient>>()),
65 {
66  if (type == LOCAL_VARIABLE_ORDER)
67  {
68  CompositeFunction<Number> * c =
69  new CompositeFunction<Number>();
70  c->attach_subfunction(f_in, variables_in);
71  f.reset(c);
72  }
73  else
74  {
75  f.reset(f_in.clone().release());
76  }
77  f->init();
78 }
UniquePtr< FunctionBase< Gradient > > g
const class libmesh_nullptr_t libmesh_nullptr
std::vector< unsigned int > variables
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
virtual UniquePtr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const FunctionBase< Number > &  f_in,
const FunctionBase< Gradient > &  g_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from references-to-functors.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 82 of file dirichlet_boundary.C.

References libMesh::CompositeFunction< Output >::attach_subfunction(), libMesh::FunctionBase< Output >::clone(), DirichletBoundary(), f, g, and libMesh::LOCAL_VARIABLE_ORDER.

86  :
87  b(b_in),
88  variables(variables_in),
89  f(UniquePtr<FunctionBase<Number>>()),
90  g(UniquePtr<FunctionBase<Gradient>>()),
91  f_fem(UniquePtr<FEMFunctionBase<Number>>()),
92  g_fem(UniquePtr<FEMFunctionBase<Gradient>>()),
94 {
95  if (type == LOCAL_VARIABLE_ORDER)
96  {
97  CompositeFunction<Number> * cf =
98  new CompositeFunction<Number>();
99  cf->attach_subfunction(f_in, variables_in);
100  f.reset(cf);
101  CompositeFunction<Gradient> * cg =
102  new CompositeFunction<Gradient>();
103  cg->attach_subfunction(g_in, variables_in);
104  g.reset(cg);
105  }
106  else
107  {
108  f.reset(f_in.clone().release());
109  g.reset(g_in.clone().release());
110  }
111 
112  f->init();
113  g->init();
114 }
UniquePtr< FunctionBase< Gradient > > g
const class libmesh_nullptr_t libmesh_nullptr
std::vector< unsigned int > variables
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
virtual UniquePtr< FunctionBase< Output > > clone() const =0
std::set< boundary_id_type > b
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > *  f_in,
const FEMFunctionBase< Gradient > *  g_in = libmesh_nullptr 
)

Constructor for a system-variable-order boundary from pointers-to-fem-functors.

Definition at line 118 of file dirichlet_boundary.C.

References DirichletBoundary(), f_fem, and libMesh::libmesh_assert().

122  :
123  b(b_in),
124  variables(variables_in),
125  f(UniquePtr<FunctionBase<Number>>()),
126  g(UniquePtr<FunctionBase<Gradient>>()),
127  f_fem(f_in ? f_in->clone() : UniquePtr<FEMFunctionBase<Number>>()),
128  g_fem(g_in ? g_in->clone() : UniquePtr<FEMFunctionBase<Gradient>>()),
129  f_system(&f_sys_in)
130 {
131  libmesh_assert(f_fem.get());
132 }
UniquePtr< FunctionBase< Gradient > > g
std::vector< unsigned int > variables
libmesh_assert(j)
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
std::set< boundary_id_type > b
virtual UniquePtr< FEMFunctionBase< Output > > clone() const =0
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > &  f_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from reference-to-fem-functor.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 136 of file dirichlet_boundary.C.

References libMesh::CompositeFEMFunction< Output >::attach_subfunction(), libMesh::FEMFunctionBase< Output >::clone(), DirichletBoundary(), f_fem, and libMesh::LOCAL_VARIABLE_ORDER.

140  :
141  b(b_in),
142  variables(variables_in),
143  f(UniquePtr<FunctionBase<Number>>()),
144  g(UniquePtr<FunctionBase<Gradient>>()),
145  f_fem(UniquePtr<FEMFunctionBase<Number>>()),
146  g_fem(UniquePtr<FEMFunctionBase<Gradient>>()),
147  f_system(&f_sys_in)
148 {
149  if (type == LOCAL_VARIABLE_ORDER)
150  {
151  CompositeFEMFunction<Number> * c = new CompositeFEMFunction<Number>();
152  c->attach_subfunction(f_in, variables_in);
153  f_fem.reset(c);
154  }
155  else
156  {
157  f_fem.reset(f_in.clone().release());
158  }
159 }
UniquePtr< FunctionBase< Gradient > > g
std::vector< unsigned int > variables
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
std::set< boundary_id_type > b
virtual UniquePtr< FEMFunctionBase< Output > > clone() const =0
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const std::set< boundary_id_type > &  b_in,
const std::vector< unsigned int > &  variables_in,
const System f_sys_in,
const FEMFunctionBase< Number > &  f_in,
const FEMFunctionBase< Gradient > &  g_in,
VariableIndexing  type = SYSTEM_VARIABLE_ORDER 
)

Constructor for a system-variable-order boundary from references-to-fem-functors.

Defaults to system variable indexing for backwards compatibility, but most users will prefer local indexing.

Definition at line 163 of file dirichlet_boundary.C.

References libMesh::CompositeFEMFunction< Output >::attach_subfunction(), libMesh::FEMFunctionBase< Output >::clone(), DirichletBoundary(), f_fem, g_fem, and libMesh::LOCAL_VARIABLE_ORDER.

168  :
169  b(b_in),
170  variables(variables_in),
171  f(UniquePtr<FunctionBase<Number>>()),
172  g(UniquePtr<FunctionBase<Gradient>>()),
173  f_fem(UniquePtr<FEMFunctionBase<Number>>()),
174  g_fem(UniquePtr<FEMFunctionBase<Gradient>>()),
175  f_system(&f_sys_in)
176 {
177  if (type == LOCAL_VARIABLE_ORDER)
178  {
179  CompositeFEMFunction<Number> * cf =
180  new CompositeFEMFunction<Number>();
181  cf->attach_subfunction(f_in, variables_in);
182  f_fem.reset(cf);
183  CompositeFEMFunction<Gradient> * cg =
184  new CompositeFEMFunction<Gradient>();
185  cg->attach_subfunction(g_in, variables_in);
186  g_fem.reset(cg);
187  }
188  else
189  {
190  f_fem.reset(f_in.clone().release());
191  g_fem.reset(g_in.clone().release());
192  }
193 }
UniquePtr< FunctionBase< Gradient > > g
std::vector< unsigned int > variables
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
std::set< boundary_id_type > b
virtual UniquePtr< FEMFunctionBase< Output > > clone() const =0
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::DirichletBoundary ( const DirichletBoundary dirichlet_in)

Copy constructor.

Deep copies (clones) functors; shallow copies any System reference

Definition at line 197 of file dirichlet_boundary.C.

References f, f_fem, f_system, g, g_fem, and libMesh::libmesh_assert().

197  :
198  b(dirichlet_in.b),
199  variables(dirichlet_in.variables),
200  f(dirichlet_in.f.get() ?
201  dirichlet_in.f->clone() : UniquePtr<FunctionBase<Number>>()),
202  g(dirichlet_in.g.get() ?
203  dirichlet_in.g->clone() : UniquePtr<FunctionBase<Gradient>>()),
204  f_fem(dirichlet_in.f_fem.get() ?
205  dirichlet_in.f_fem->clone() : UniquePtr<FEMFunctionBase<Number>>()),
206  g_fem(dirichlet_in.g_fem.get() ?
207  dirichlet_in.g_fem->clone() : UniquePtr<FEMFunctionBase<Gradient>>()),
208  f_system(dirichlet_in.f_system)
209 {
210  libmesh_assert(f.get() || f_fem.get());
211  libmesh_assert(!(f.get() && f_fem.get()));
212  libmesh_assert(!(f.get() && g_fem.get()));
213  libmesh_assert(!(f_fem.get() && g.get()));
214  libmesh_assert(!(f_fem.get() && !f_system));
215  if (f.get())
216  f->init();
217  if (g.get())
218  g->init();
219 }
UniquePtr< FunctionBase< Gradient > > g
std::vector< unsigned int > variables
libmesh_assert(j)
UniquePtr< FunctionBase< Number > > f
UniquePtr< FEMFunctionBase< Gradient > > g_fem
std::set< boundary_id_type > b
UniquePtr< FEMFunctionBase< Number > > f_fem
libMesh::DirichletBoundary::~DirichletBoundary ( )

Standard destructor.

Definition at line 222 of file dirichlet_boundary.C.

222 {}

Member Data Documentation

std::set<boundary_id_type> libMesh::DirichletBoundary::b
UniquePtr<FunctionBase<Number> > libMesh::DirichletBoundary::f
UniquePtr<FEMFunctionBase<Number> > libMesh::DirichletBoundary::f_fem
const System* libMesh::DirichletBoundary::f_system

Definition at line 182 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

UniquePtr<FunctionBase<Gradient> > libMesh::DirichletBoundary::g

Definition at line 177 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

UniquePtr<FEMFunctionBase<Gradient> > libMesh::DirichletBoundary::g_fem

Definition at line 180 of file dirichlet_boundaries.h.

Referenced by DirichletBoundary().

std::vector<unsigned int> libMesh::DirichletBoundary::variables

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