MFEM  v3.3
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.
27 
28  /// Set of Domain Integrators to be assembled (added).
30 
31  mutable SparseMatrix *Grad;
32 
33  // A list of all essential vdofs
35 
36 public:
38  : Operator(f->GetVSize()) { fes = f; Grad = NULL; }
39 
40  /// Adds new Domain Integrator.
42  { dfi.Append(nlfi); }
43 
44  virtual void SetEssentialBC(const Array<int> &bdr_attr_is_ess,
45  Vector *rhs = NULL);
46 
47  void SetEssentialVDofs(const Array<int> &ess_vdofs_list)
48  {
49  ess_vdofs_list.Copy(ess_vdofs); // ess_vdofs_list --> ess_vdofs
50  }
51 
52  virtual double GetEnergy(const Vector &x) const;
53 
54  virtual void Mult(const Vector &x, Vector &y) const;
55 
56  virtual Operator &GetGradient(const Vector &x) const;
57 
58  virtual ~NonlinearForm();
59 };
60 
61 }
62 
63 #endif
void AddDomainIntegrator(NonlinearFormIntegrator *nlfi)
Adds new Domain Integrator.
void Copy(Array &copy) const
Create a copy of the current array.
Definition: array.hpp:160
FiniteElementSpace * fes
FE space on which the form lives.
Data type sparse matrix.
Definition: sparsemat.hpp:38
NonlinearForm(FiniteElementSpace *f)
Array< int > ess_vdofs
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Array< NonlinearFormIntegrator * > dfi
Set of Domain Integrators to be assembled (added).
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:36
SparseMatrix * Grad
virtual double GetEnergy(const Vector &x) const
void SetEssentialVDofs(const Array< int > &ess_vdofs_list)
Abstract operator.
Definition: operator.hpp:21