MFEM  v3.3.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 
25 /// Parallel non-linear operator on the true dofs
27 {
28 protected:
29  mutable ParGridFunction X, Y;
31 
32 public:
34  : NonlinearForm(pf), X(pf), Y(pf), pGrad(Operator::Hypre_ParCSR)
35  { height = width = pf->TrueVSize(); }
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 
44  /// Compute the energy of a ParGridFunction
45  virtual double GetEnergy(const ParGridFunction &x) const;
46 
47  /// Compute the energy of a true-dof vector 'x'
48  virtual double GetEnergy(const Vector &x) const;
49 
50  virtual void Mult(const Vector &x, Vector &y) const;
51 
52  /// Return the local gradient matrix for the given true-dof vector x
53  const SparseMatrix &GetLocalGradient(const Vector &x) const;
54 
55  virtual Operator &GetGradient(const Vector &x) const;
56 
57  /// Set the operator type id for the parallel gradient matrix/operator.
59 
60  /// Get the parallel finite element space prolongation matrix
61  virtual const Operator *GetProlongation() const
62  { return ParFESpace()->GetProlongationMatrix(); }
63  /// Get the parallel finite element space restriction matrix
64  virtual const Operator *GetRestriction() const
65  { return ParFESpace()->GetRestrictionMatrix(); }
66 
67  virtual ~ParNonlinearForm() { }
68 };
69 
70 }
71 
72 #endif // MFEM_USE_MPI
73 
74 #endif
virtual const Operator * GetProlongationMatrix()
Definition: pfespace.cpp:632
void SetGradientType(Operator::Type tid)
Set the operator type id for the parallel gradient matrix/operator.
ParFiniteElementSpace * ParFESpace() const
Pointer to an Operator of a specified type.
Definition: handle.hpp:33
Parallel non-linear operator on the true dofs.
Abstract parallel finite element space.
Definition: pfespace.hpp:31
virtual const SparseMatrix * GetRestrictionMatrix()
Get the R matrix which restricts a local dof vector to true dof vector.
Definition: pfespace.hpp:250
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
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
virtual const Operator * GetProlongation() const
Get the parallel finite element space prolongation matrix.
virtual const Operator * GetRestriction() const
Get the parallel finite element space restriction matrix.
Type
Enumeration defining IDs for some classes derived from Operator.
Definition: operator.hpp:123
const SparseMatrix & GetLocalGradient(const Vector &x) const
Return the local gradient matrix for the given true-dof vector x.
int height
Dimension of the output / number of rows in the matrix.
Definition: operator.hpp:24
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
Class for parallel grid function.
Definition: pgridfunc.hpp:32
Abstract operator.
Definition: operator.hpp:21
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
Definition: handle.hpp:118
int width
Dimension of the input / number of columns in the matrix.
Definition: operator.hpp:25