~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/fem/DirichletBC.h

  • Committer: Anders Logg
  • Date: 2008-05-21 22:42:48 UTC
  • mfrom: (2668.6.1 trunk)
  • mto: (2668.8.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 2670.
  • Revision ID: logg@simula.no-20080521224248-7baydkw3uy323fur
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Modified by Kristian Oelgaard, 2007
5
5
//
6
6
// First added:  2007-04-10
7
 
// Last changed: 2008-05-18
 
7
// Last changed: 2008-05-21
 
8
//
 
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).
8
12
 
9
13
#ifndef __DIRICHLET_BC_H
10
14
#define __DIRICHLET_BC_H
25
29
  class Form;
26
30
  class GenericMatrix;
27
31
  class GenericVector;
28
 
  
 
32
 
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.
51
55
  ///
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.
 
58
  ///
 
59
  /// The boundary indicators may be specified in a number of
 
60
  /// different ways.
 
61
  ///
 
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.
 
65
  ///
 
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.
 
69
  ///
 
70
  /// The third option is to attach the boundary information to the
 
71
  /// mesh. This is handled automatically when exporting a mesh from
 
72
  /// for example VMTK.
56
73
  ///
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.
60
 
  
 
77
 
61
78
  class DirichletBC : public BoundaryCondition
62
79
  {
63
80
  public:
72
89
    DirichletBC(Function& g,
73
90
                MeshFunction<uint>& sub_domains, uint sub_domain,
74
91
                BCMethod method = topological);
 
92
    
 
93
    /// Create boundary condition for boundary data included in the mesh
 
94
    DirichletBC(Function& g,
 
95
                Mesh& mesh,
 
96
                uint sub_domain,
 
97
                BCMethod method = topological);
75
98
 
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);
89
112
 
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,
92
115
                Mesh& mesh,
 
116
                uint sub_domain,
 
117
                const SubSystem& sub_system,
93
118
                BCMethod method = topological);
94
119
 
95
120
    /// Destructor
121
146
 
122
147
  private:
123
148
 
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);
 
151
 
 
152
    // Initialize sub domain markers from mesh
 
153
    void initFromMesh();
126
154
 
127
155
    /// Apply boundary conditions
128
156
    void apply(GenericMatrix& A, GenericVector& b,