MFEM  v3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pnonlinearform.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_PNONLINEARFORM
13 #define MFEM_PNONLINEARFORM
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 #include "pgridfunc.hpp"
20 #include "nonlinearform.hpp"
21 
22 namespace mfem
23 {
24 
27 {
28 protected:
29  mutable ParGridFunction X, Y;
31 
32 public:
34  : NonlinearForm(pf), X(pf), Y(pf)
35  { height = width = pf->TrueVSize(); pGrad = NULL; }
36 
38  { return (ParFiniteElementSpace *)fes; }
39 
40  // Here, rhs is a true dof vector
41  virtual void SetEssentialBC(const Array<int> &bdr_attr_is_ess,
42  Vector *rhs = NULL);
43 
45  virtual double GetEnergy(const ParGridFunction &x) const;
46 
48  virtual double GetEnergy(const Vector &x) const;
49 
50  virtual void Mult(const Vector &x, Vector &y) const;
51 
53  const SparseMatrix &GetLocalGradient(const Vector &x) const;
54 
55  virtual Operator &GetGradient(const Vector &x) const;
56 
57  virtual ~ParNonlinearForm() { delete pGrad; }
58 };
59 
60 }
61 
62 #endif // MFEM_USE_MPI
63 
64 #endif
ParFiniteElementSpace * ParFESpace() const
Parallel non-linear operator on the true dofs.
Abstract parallel finite element space.
Definition: pfespace.hpp:28
FiniteElementSpace * fes
FE space on which the form lives.
ParNonlinearForm(ParFiniteElementSpace *pf)
virtual double GetEnergy(const ParGridFunction &x) const
Compute the energy of a ParGridFunction.
Data type sparse matrix.
Definition: sparsemat.hpp:38
HypreParMatrix * pGrad
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
const SparseMatrix & GetLocalGradient(const Vector &x) const
Return the local gradient matrix for the given true-dof vector x.
virtual Operator & GetGradient(const Vector &x) const
Evaluate the gradient operator at the point x.
virtual void SetEssentialBC(const Array< int > &bdr_attr_is_ess, Vector *rhs=NULL)
Vector data type.
Definition: vector.hpp:33
Class for parallel grid function.
Definition: pgridfunc.hpp:31
Abstract operator.
Definition: operator.hpp:21
Wrapper for hypre&#39;s ParCSR matrix class.
Definition: hypre.hpp:150