MFEM  v3.3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
nonlinearform.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_NONLINEARFORM
13 #define MFEM_NONLINEARFORM
14 
15 #include "../config/config.hpp"
16 #include "nonlininteg.hpp"
17 #include "fespace.hpp"
18 
19 namespace mfem
20 {
21 
22 class NonlinearForm : public Operator
23 {
24 protected:
25  /// FE space on which the form lives.
26  FiniteElementSpace *fes; // not owned
27 
28  /// Set of Domain Integrators to be assembled (added).
30 
31  /// Set of interior face Integrators to be assembled (added).
33 
34  /// Set of boundary face Integrators to be assembled (added).
37 
38  mutable SparseMatrix *Grad; // owned
39 
40  // A list of all essential vdofs
42 
43 public:
45  : Operator(f->GetVSize()) { fes = f; Grad = NULL; }
46 
48  const FiniteElementSpace *FESpace() const { return fes; }
49 
50  /// Adds new Domain Integrator.
52  { dnfi.Append(nlfi); }
53 
54  /// Adds new Interior Face Integrator.
56  { fnfi.Append(nlfi); }
57 
58  /// Adds new Boundary Face Integrator.
60  { bfnfi.Append(nlfi); bfnfi_marker.Append(NULL); }
61 
62  /** @brief Adds new Boundary Face Integrator, restricted to specific boundary
63  attributes. */
65  Array<int> &bdr_marker)
66  { bfnfi.Append(nfi); bfnfi_marker.Append(&bdr_marker); }
67 
68  virtual void SetEssentialBC(const Array<int> &bdr_attr_is_ess,
69  Vector *rhs = NULL);
70 
71  void SetEssentialVDofs(const Array<int> &ess_vdofs_list)
72  {
73  ess_vdofs_list.Copy(ess_vdofs); // ess_vdofs_list --> ess_vdofs
74  }
75 
76  virtual double GetEnergy(const Vector &x) const;
77 
78  virtual void Mult(const Vector &x, Vector &y) const;
79 
80  virtual Operator &GetGradient(const Vector &x) const;
81 
82  virtual ~NonlinearForm();
83 };
84 
85 }
86 
87 #endif
Array< NonlinearFormIntegrator * > dnfi
Set of Domain Integrators to be assembled (added).
const FiniteElementSpace * FESpace() const
void AddDomainIntegrator(NonlinearFormIntegrator *nlfi)
Adds new Domain Integrator.
void Copy(Array &copy) const
Create a copy of the current array.
Definition: array.hpp:161
void AddBdrFaceIntegrator(NonlinearFormIntegrator *nfi, Array< int > &bdr_marker)
Adds new Boundary Face Integrator, restricted to specific boundary attributes.
Array< NonlinearFormIntegrator * > bfnfi
Set of boundary face Integrators to be assembled (added).
FiniteElementSpace * fes
FE space on which the form lives.
void AddInteriorFaceIntegrator(NonlinearFormIntegrator *nlfi)
Adds new Interior Face Integrator.
void AddBdrFaceIntegrator(NonlinearFormIntegrator *nlfi)
Adds new Boundary Face Integrator.
Data type sparse matrix.
Definition: sparsemat.hpp:38
Array< NonlinearFormIntegrator * > fnfi
Set of interior face Integrators to be assembled (added).
NonlinearForm(FiniteElementSpace *f)
Array< int > ess_vdofs
Array< Array< int > * > bfnfi_marker
FiniteElementSpace * FESpace()
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
virtual Operator & GetGradient(const Vector &x) const
Evaluate the gradient operator at the point x. The default behavior in class Operator is to generate ...
virtual void SetEssentialBC(const Array< int > &bdr_attr_is_ess, Vector *rhs=NULL)
Vector data type.
Definition: vector.hpp:41
SparseMatrix * Grad
virtual double GetEnergy(const Vector &x) const
void SetEssentialVDofs(const Array< int > &ess_vdofs_list)
Abstract operator.
Definition: operator.hpp:21