4
4
// Modified by Kristian Oelgaard, 2007
6
6
// First added: 2007-04-10
7
// Last changed: 2008-05-18
7
// Last changed: 2008-05-21
9
// FIXME: This class needs some cleanup, in particular collecting
10
// FIXME: all data from different representations into a common
11
// FIXME: data structure (perhaps an Array<uint> with facet indices).
9
13
#ifndef __DIRICHLET_BC_H
10
14
#define __DIRICHLET_BC_H
26
30
class GenericMatrix;
27
31
class GenericVector;
29
33
/// The BCMethod variable may be used to specify the type of method
30
34
/// used to identify degrees of freedom on the boundary. Available
31
35
/// methods are: topological approach (default), geometrical approach,
49
53
/// where u is the solution to be computed, g is a function
50
54
/// and G is a sub domain of the mesh.
52
/// A DirichletBC is specified by a Function, a Mesh,
53
/// a MeshFunction<uint> over the facets of the mesh and
54
/// an integer sub_domain specifying the sub domain on which
55
/// the boundary condition is to be applied.
56
/// A DirichletBC is specified by the Function g, the Mesh,
57
/// and boundary indicators on (a subset of) the mesh boundary.
59
/// The boundary indicators may be specified in a number of
62
/// The simplest approach is to specify the boundary by a SubDomain
63
/// object, using the inside() function to specify on which facets
64
/// the boundary conditions should be applied.
66
/// Alternatively, the boundary may be specified by a MeshFunction
67
/// labeling all mesh facets together with a number that specifies
68
/// which facets should be included in the boundary.
70
/// The third option is to attach the boundary information to the
71
/// mesh. This is handled automatically when exporting a mesh from
57
74
/// For mixed systems (vector-valued and mixed elements), an
58
75
/// optional set of parameters may be used to specify for which sub
59
76
/// system the boundary condition should be specified.
61
78
class DirichletBC : public BoundaryCondition
72
89
DirichletBC(Function& g,
73
90
MeshFunction<uint>& sub_domains, uint sub_domain,
74
91
BCMethod method = topological);
93
/// Create boundary condition for boundary data included in the mesh
94
DirichletBC(Function& g,
97
BCMethod method = topological);
76
99
/// Create sub system boundary condition for sub domain
77
100
DirichletBC(Function& g,
87
110
const SubSystem& sub_system,
88
111
BCMethod method = topological);
90
/// Simple creation of boundary condition with given value on the entire boundary
113
/// Create sub system boundary condition for boundary data included in the mesh
91
114
DirichletBC(Function& g,
117
const SubSystem& sub_system,
93
118
BCMethod method = topological);
124
// Initialize sub domain markers
125
void init(SubDomain& sub_domain);
149
// Initialize sub domain markers from sub domain
150
void initFromSubDomain(SubDomain& sub_domain);
152
// Initialize sub domain markers from mesh
127
155
/// Apply boundary conditions
128
156
void apply(GenericMatrix& A, GenericVector& b,