MFEM  v3.4
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
plinearform.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_PLINEARFORM
13 #define MFEM_PLINEARFORM
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 #include "pgridfunc.hpp"
20 #include "linearform.hpp"
21 
22 namespace mfem
23 {
24 
25 /// Class for parallel linear form
26 class ParLinearForm : public LinearForm
27 {
28 protected:
30 
31 public:
32  ParLinearForm() : LinearForm() { pfes = NULL; }
33 
35 
36  ParFiniteElementSpace *ParFESpace() const { return pfes; }
37 
38  void Update(ParFiniteElementSpace *pf = NULL);
39 
40  void Update(ParFiniteElementSpace *pf, Vector &v, int v_offset);
41 
42  /// Assemble the vector on the true dofs, i.e. P^t v.
43  void ParallelAssemble(Vector &tv);
44 
45  /// Returns the vector assembled on the true dofs, i.e. P^t v.
47 
48  /// Return the action of the ParLinearForm as a linear mapping.
49  /** Linear forms are linear functionals which map ParGridFunction%s to
50  the real numbers. This method performs this mapping which in
51  this case is equivalent as an inner product of the ParLinearForm
52  and ParGridFunction. */
53  double operator()(const ParGridFunction &gf) const
54  {
55  return InnerProduct(pfes->GetComm(), *this, gf);
56  }
57 };
58 
59 }
60 
61 #endif // MFEM_USE_MPI
62 
63 #endif
Abstract parallel finite element space.
Definition: pfespace.hpp:28
Class for parallel linear form.
Definition: plinearform.hpp:26
MPI_Comm GetComm() const
Definition: pfespace.hpp:235
ParFiniteElementSpace * ParFESpace() const
Definition: plinearform.hpp:36
double operator()(const ParGridFunction &gf) const
Return the action of the ParLinearForm as a linear mapping.
Definition: plinearform.hpp:53
Wrapper for hypre's parallel vector class.
Definition: hypre.hpp:73
HypreParVector * ParallelAssemble()
Returns the vector assembled on the true dofs, i.e. P^t v.
Definition: plinearform.cpp:39
double InnerProduct(HypreParVector *x, HypreParVector *y)
Definition: hypre.cpp:252
ParLinearForm(ParFiniteElementSpace *pf)
Definition: plinearform.hpp:34
ParFiniteElementSpace * pfes
Definition: plinearform.hpp:29
Vector data type.
Definition: vector.hpp:48
Class for linear form - Vector with associated FE space and LFIntegrators.
Definition: linearform.hpp:23
Class for parallel grid function.
Definition: pgridfunc.hpp:32