MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
pgridfunc.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_PGRIDFUNC
13#define MFEM_PGRIDFUNC
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_MPI
18
20#include "pfespace.hpp"
21#include "gridfunc.hpp"
22#include <iostream>
23#include <limits>
24
25namespace mfem
26{
27
28/// Compute a global Lp norm from the local Lp norms computed by each processor
29real_t GlobalLpNorm(const real_t p, real_t loc_norm, MPI_Comm comm);
30
31/// Class for parallel grid function
33{
34protected:
35 ParFiniteElementSpace *pfes; ///< Points to the same object as #fes
36
37 /** @brief Vector used to store data from face-neighbor processors,
38 initialized by ExchangeFaceNbrData(). */
40
41 /** @brief Vector used as an MPI buffer to send face-neighbor data
42 in ExchangeFaceNbrData() to neighboring processors. */
43 //TODO: Use temporary memory to avoid CUDA malloc allocation cost.
45
47 const Array<int> &attr);
48
49public:
50 ParGridFunction() { pfes = NULL; }
51
52 /// Copy constructor. The internal vector #face_nbr_data is not copied.
54 : GridFunction(orig), pfes(orig.pfes) { }
55
57
58 /// Construct a ParGridFunction using previously allocated array @a data.
59 /** The ParGridFunction does not assume ownership of @a data which is assumed
60 to be of size at least `pf->GetVSize()`. Similar to the GridFunction and
61 Vector constructors for externally allocated array, the pointer @a data
62 can be NULL. The data array can be replaced later using the method
63 SetData().
64 */
67
68 /** @brief Construct a ParGridFunction using previously allocated Vector
69 @a base starting at the given offset, @a base_offset. */
70 ParGridFunction(ParFiniteElementSpace *pf, Vector &base, int base_offset = 0)
71 : GridFunction(pf, base, base_offset), pfes(pf) { }
72
73 /// Construct a ParGridFunction using a GridFunction as external data.
74 /** The parallel space @a *pf and the space used by @a *gf should match. The
75 data from @a *gf is used as the local data of the ParGridFunction on each
76 processor. The ParGridFunction does not assume ownership of the data. */
78
79 /** @brief Creates grid function on (all) dofs from a given vector on the
80 true dofs, i.e. P tv. */
82
83 /** @brief Construct a local ParGridFunction from the given *global*
84 GridFunction. If @a partitioning is NULL (default), the data from @a gf
85 is NOT copied. */
86 ParGridFunction(ParMesh *pmesh, const GridFunction *gf,
87 const int *partitioning = NULL);
88
89 /** @brief Construct a ParGridFunction on a given ParMesh, @a pmesh, reading
90 from an std::istream.
91
92 In the process, a ParFiniteElementSpace and a FiniteElementCollection are
93 constructed. The new ParGridFunction assumes ownership of both. */
94 ParGridFunction(ParMesh *pmesh, std::istream &input);
95
96 /// Copy assignment. Only the data of the base class Vector is copied.
97 /** It is assumed that this object and @a rhs use ParFiniteElementSpace%s
98 that have the same size.
99
100 @note Defining this method overwrites the implicitly defined copy
101 assignment operator. */
103 { return operator=((const Vector &)rhs); }
104
105 /// Assign constant values to the ParGridFunction data.
107 { GridFunction::operator=(value); return *this; }
108
109 /// Copy the data from a Vector to the ParGridFunction data.
111 { GridFunction::operator=(v); return *this; }
112
114
115 void Update() override;
116
117 /// Associate a new FiniteElementSpace with the ParGridFunction.
118 /** The ParGridFunction is resized using the SetSize() method. The new space
119 @a f is expected to be a ParFiniteElementSpace. */
120 void SetSpace(FiniteElementSpace *f) override;
121
122 /// Associate a new parallel space with the ParGridFunction.
124
126
127 /** @brief Make the ParGridFunction reference external data on a new
128 FiniteElementSpace. */
129 /** This method changes the FiniteElementSpace associated with the
130 ParGridFunction and sets the pointer @a v as external data in the
131 ParGridFunction. The new space @a f is expected to be a
132 ParFiniteElementSpace. */
133 void MakeRef(FiniteElementSpace *f, real_t *v) override;
134
135 /** @brief Make the ParGridFunction reference external data on a new
136 ParFiniteElementSpace. */
137 /** This method changes the ParFiniteElementSpace associated with the
138 ParGridFunction and sets the pointer @a v as external data in the
139 ParGridFunction. */
141
142 /** @brief Make the ParGridFunction reference external data on a new
143 FiniteElementSpace. */
144 /** This method changes the FiniteElementSpace associated with the
145 ParGridFunction and sets the data of the Vector @a v (plus the @a
146 v_offset) as external data in the ParGridFunction. The new space @a f is
147 expected to be a ParFiniteElementSpace.
148 @note This version of the method will also perform bounds checks when
149 the build option MFEM_DEBUG is enabled. */
150 void MakeRef(FiniteElementSpace *f, Vector &v, int v_offset) override;
151
152 /** @brief Make the ParGridFunction reference external data on a new
153 ParFiniteElementSpace. */
154 /** This method changes the ParFiniteElementSpace associated with the
155 ParGridFunction and sets the data of the Vector @a v (plus the
156 @a v_offset) as external data in the ParGridFunction.
157 @note This version of the method will also perform bounds checks when
158 the build option MFEM_DEBUG is enabled. */
159 void MakeRef(ParFiniteElementSpace *f, Vector &v, int v_offset);
160
161 /** Set the grid function on (all) dofs from a given vector on the
162 true dofs, i.e. P tv. */
163 void Distribute(const Vector *tv);
164 void Distribute(const Vector &tv) { Distribute(&tv); }
165 void AddDistribute(real_t a, const Vector *tv);
166 void AddDistribute(real_t a, const Vector &tv) { AddDistribute(a, &tv); }
167
168 /// Set the GridFunction from the given true-dof vector.
169 void SetFromTrueDofs(const Vector &tv) override { Distribute(tv); }
170
171 /// Short semantic for Distribute()
173 { Distribute(&tv); return (*this); }
174
176
177 /// Returns the true dofs in a new HypreParVector
179
180 /// Returns the vector averaged on the true dofs.
181 void ParallelAverage(Vector &tv) const;
182
183 /// Returns the vector averaged on the true dofs.
184 void ParallelAverage(HypreParVector &tv) const;
185
186 /// Returns a new vector averaged on the true dofs.
188
189 /// Returns the vector restricted to the true dofs.
190 void ParallelProject(Vector &tv) const;
191
192 /// Returns the vector restricted to the true dofs.
193 void ParallelProject(HypreParVector &tv) const;
194
195 /// Returns a new vector restricted to the true dofs.
197
198 /// Returns the vector assembled on the true dofs.
199 void ParallelAssemble(Vector &tv) const;
200
201 /// Returns the vector assembled on the true dofs.
202 void ParallelAssemble(HypreParVector &tv) const;
203
204 /// Returns a new vector assembled on the true dofs.
206
207 void ExchangeFaceNbrData();
209 const Vector &FaceNbrData() const { return face_nbr_data; }
210
211 // Redefine to handle the case when i is a face-neighbor element
212 real_t GetValue(int i, const IntegrationPoint &ip,
213 int vdim = 1) const override;
216
217 // Redefine to handle the case when T describes a face-neighbor element
219 int comp = 0, Vector *tr = NULL) const override;
220
221 void GetVectorValue(int i, const IntegrationPoint &ip,
222 Vector &val) const override;
223
224 // Redefine to handle the case when T describes a face-neighbor element
226 const IntegrationPoint &ip,
227 Vector &val, Vector *tr = NULL) const override;
228
229 /** @brief For each vdof, counts how many elements contain the vdof,
230 as containment is determined by FiniteElementSpace::GetElementVDofs(). */
231 void CountElementsPerVDof(Array<int> &elem_per_vdof) const override;
232
233 /// Parallel version of GridFunction::GetDerivative(); see its documentation.
234 void GetDerivative(int comp, int der_comp, ParGridFunction &der);
235
236 /** Sets the output vector @a dof_vals to the values of the degrees of
237 freedom of element @a el. If @a el is greater than or equal to the number
238 of local elements, it will be interpreted as a shifted index of a face
239 neighbor element. */
240 void GetElementDofValues(int el, Vector &dof_vals) const override;
241
243 void ProjectCoefficient(Coefficient &coeff) override;
244
246 /** @brief Project a discontinuous vector coefficient as a grid function on
247 a continuous finite element space. The values in shared dofs are
248 determined from the element with maximal attribute. */
249 void ProjectDiscCoefficient(VectorCoefficient &coeff) override;
250
251 void ProjectDiscCoefficient(Coefficient &coeff, AvgType type) override;
252
253 void ProjectDiscCoefficient(VectorCoefficient &vcoeff, AvgType type) override;
254
256
258 const Array<int> &attr) override
259 { ProjectBdrCoefficient(NULL, &vcoeff, attr); }
260
262 const Array<int> &attr) override
263 { ProjectBdrCoefficient(coeff, NULL, attr); }
264
266 const Array<int> &bdr_attr) override;
267
269 const IntegrationRule *irs[] = NULL) const override
270 {
271 return GlobalLpNorm(1.0, GridFunction::ComputeL1Error(exsol, irs),
272 pfes->GetComm());
273 }
274
276 const IntegrationRule *irs[] = NULL) const override
277 { return ComputeLpError(1.0, exsol, NULL, irs); }
278
280 const IntegrationRule *irs[] = NULL) const override
281 { return ComputeLpError(1.0, exsol, NULL, NULL, irs); }
282
284 const IntegrationRule *irs[] = NULL,
285 const Array<int> *elems = NULL) const override
286 {
287 return GlobalLpNorm(2.0, GridFunction::ComputeL2Error(exsol, irs, elems),
288 pfes->GetComm());
289 }
290
292 const IntegrationRule *irs[] = NULL,
293 const Array<int> *elems = NULL) const override
294 {
295 return GlobalLpNorm(2.0, GridFunction::ComputeL2Error(exsol, irs, elems),
296 pfes->GetComm());
297 }
298
299
301 const IntegrationRule *irs[] = NULL,
302 const Array<int> *elems = NULL) const override
303 {
304 return GlobalLpNorm(2.0, GridFunction::ComputeL2Error(exsol, irs, elems),
305 pfes->GetComm());
306 }
307
308 /// Returns ||grad u_ex - grad u_h||_L2 for H1 or L2 elements
310 const IntegrationRule *irs[] = NULL) const override
311 {
312 return GlobalLpNorm(2.0, GridFunction::ComputeGradError(exgrad,irs),
313 pfes->GetComm());
314 }
315
316 /// Returns ||curl u_ex - curl u_h||_L2 for ND elements
318 const IntegrationRule *irs[] = NULL) const override
319 {
320 return GlobalLpNorm(2.0, GridFunction::ComputeCurlError(excurl,irs),
321 pfes->GetComm());
322 }
323
324 /// Returns ||div u_ex - div u_h||_L2 for RT elements
326 const IntegrationRule *irs[] = NULL) const override
327 {
328 return GlobalLpNorm(2.0, GridFunction::ComputeDivError(exdiv,irs),
329 pfes->GetComm());
330 }
331
332 /// Returns the Face Jumps error for L2 elements
334 Coefficient *ell_coeff,
335 JumpScaling jump_scaling,
336 const IntegrationRule *irs[]=NULL) const override;
337
338 /// Returns either the H1-seminorm or the DG Face Jumps error or both
339 /// depending on norm_type = 1, 2, 3
341 Coefficient *ell_coef, real_t Nu,
342 int norm_type) const override
343 {
344 return GlobalLpNorm(2.0,
345 GridFunction::ComputeH1Error(exsol,exgrad,ell_coef,
346 Nu, norm_type),
347 pfes->GetComm());
348 }
349
350 /// Returns the error measured in H1-norm for H1 elements or in "broken"
351 /// H1-norm for L2 elements
353 const IntegrationRule *irs[] = NULL) const override
354 {
355 return GlobalLpNorm(2.0, GridFunction::ComputeH1Error(exsol,exgrad,irs),
356 pfes->GetComm());
357 }
358
359 /// Returns the error measured H(div)-norm for RT elements
361 Coefficient *exdiv,
362 const IntegrationRule *irs[] = NULL) const override
363 {
364 return GlobalLpNorm(2.0, GridFunction::ComputeHDivError(exsol,exdiv,irs),
365 pfes->GetComm());
366 }
367
368 /// Returns the error measured H(curl)-norm for ND elements
370 VectorCoefficient *excurl,
371 const IntegrationRule *irs[] = NULL) const override
372 {
373 return GlobalLpNorm(2.0,
374 GridFunction::ComputeHCurlError(exsol,excurl,irs),
375 pfes->GetComm());
376 }
377
379 const IntegrationRule *irs[] = NULL) const override
380 {
381 return GlobalLpNorm(infinity(),
383 pfes->GetComm());
384 }
385
387 const IntegrationRule *irs[] = NULL) const override
388 {
389 return ComputeLpError(infinity(), exsol, NULL, irs);
390 }
391
393 const IntegrationRule *irs[] = NULL) const override
394 {
395 return ComputeLpError(infinity(), exsol, NULL, NULL, irs);
396 }
397
399 Coefficient *weight = NULL,
400 const IntegrationRule *irs[] = NULL,
401 const Array<int> *elems = NULL) const override
402 {
403 return GlobalLpNorm(p, GridFunction::ComputeLpError(p, exsol, weight, irs,
404 elems), pfes->GetComm());
405 }
406
407 /** When given a vector weight, compute the pointwise (scalar) error as the
408 dot product of the vector error with the vector weight. Otherwise, the
409 scalar error is the l_2 norm of the vector error. */
411 Coefficient *weight = NULL,
412 VectorCoefficient *v_weight = NULL,
413 const IntegrationRule *irs[] = NULL) const override
414 {
416 p, exsol, weight, v_weight, irs), pfes->GetComm());
417 }
418
420 GridFunction &flux,
421 bool wcoef = true, int subdomain = -1) override;
422
423 /** Save the local portion of the ParGridFunction. This differs from the
424 serial GridFunction::Save in that it takes into account the signs of
425 the local dofs. */
426 void Save(std::ostream &out) const override;
427
428 /// Save the ParGridFunction to a single file (written using MPI rank 0). The
429 /// given @a precision will be used for ASCII output.
430 void SaveAsOne(const char *fname, int precision=16) const;
431
432 /// Save the ParGridFunction to files (one for each MPI rank). The files will
433 /// be given suffixes according to the MPI rank. The given @a precision will
434 /// be used for ASCII output.
435 void Save(const char *fname, int precision=16) const override;
436
437 /// Returns a GridFunction on MPI rank @a save_rank that does not have any
438 /// duplication of vertices/nodes at processor boundaries.
439 /// serial_mesh is obtained using ParMesh::GetSerialMesh(save_rank).
440 /// Note that the @ save_rank argument must match for the
441 /// ParMesh::GetSerialMesh and GetSerialGridFunction method.
442 GridFunction GetSerialGridFunction(int save_rank, Mesh &serial_mesh) const;
443
444 /// Write the serial GridFunction a single file (written using MPI rank 0).
445 /// The given @a precision will be used for ASCII output.
446 void SaveAsSerial(const char *fname, int precision=16, int save_rank=0) const;
447
448#ifdef MFEM_USE_ADIOS2
449 /** Save the local portion of the ParGridFunction. This differs from the
450 serial GridFunction::Save in that it takes into account the signs of
451 the local dofs. */
452 void Save(
453 adios2stream &out, const std::string &variable_name,
455 override;
456#endif
457
458 /// Merge the local grid functions
459 void SaveAsOne(std::ostream &out = mfem::out) const;
460
461 virtual ~ParGridFunction() = default;
462};
463
464
465/** Performs a global L2 projection (through a HypreBoomerAMG solve) of flux
466 from supplied discontinuous space into supplied smooth (continuous, or at
467 least conforming) space, and computes the Lp norms of the differences
468 between them on each element. This is one approach to handling conforming
469 and non-conforming elements in parallel. Returns the total error estimate. */
471 const ParGridFunction &x,
472 ParFiniteElementSpace &smooth_flux_fes,
473 ParFiniteElementSpace &flux_fes,
474 Vector &errors, int norm_p = 2, real_t solver_tol = 1e-12,
475 int solver_max_it = 200);
476
477}
478
479#endif // MFEM_USE_MPI
480
481#endif
Abstract base class BilinearFormIntegrator.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
const IntegrationPoint & GetIntPoint()
Get a const reference to the currently set integration point. This will return NULL if no integration...
Definition eltrans.hpp:98
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Class for grid function - Vector with associated FE space.
Definition gridfunc.hpp:31
virtual real_t ComputeL1Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const
Definition gridfunc.hpp:590
virtual real_t ComputeHCurlError(VectorCoefficient *exsol, VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const
Returns the error measured in H(curl)-norm for ND elements.
virtual real_t ComputeH1Error(Coefficient *exsol, VectorCoefficient *exgrad, Coefficient *ell_coef, real_t Nu, int norm_type) const
virtual real_t ComputeMaxError(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
Definition gridfunc.hpp:575
virtual void MakeRef(FiniteElementSpace *f, real_t *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
Definition gridfunc.cpp:203
virtual real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
virtual real_t ComputeLpError(const real_t p, Coefficient &exsol, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void ProjectDiscCoefficient(VectorCoefficient &coeff, Array< int > &dof_attr)
virtual real_t ComputeCurlError(VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const
Returns ||curl u_ex - curl u_h||_L2 for ND elements.
virtual real_t ComputeHDivError(VectorCoefficient *exsol, Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const
Returns the error measured in H(div)-norm for RT elements.
GridFunction & operator=(const GridFunction &rhs)
Copy assignment. Only the data of the base class Vector is copied.
Definition gridfunc.hpp:116
virtual real_t ComputeDivError(Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const
Returns ||div u_ex - div u_h||_L2 for RT elements.
void GetTrueDofs(Vector &tv) const
Extract the true-dofs from the GridFunction.
Definition gridfunc.cpp:366
virtual real_t ComputeGradError(VectorCoefficient *exgrad, const IntegrationRule *irs[]=NULL) const
Returns ||grad u_ex - grad u_h||_L2 for H1 or L2 elements.
void ProjectBdrCoefficient(Coefficient &coeff, const Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
Definition gridfunc.hpp:469
Wrapper for hypre's parallel vector class.
Definition hypre.hpp:206
Class for integration point with weight.
Definition intrules.hpp:35
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
Mesh data type.
Definition mesh.hpp:56
Abstract parallel finite element space.
Definition pfespace.hpp:29
MPI_Comm GetComm() const
Definition pfespace.hpp:273
Class for parallel grid function.
Definition pgridfunc.hpp:33
void CountElementsPerVDof(Array< int > &elem_per_vdof) const override
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
real_t ComputeMaxError(VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL) const override
ParGridFunction(ParFiniteElementSpace *pf, Vector &base, int base_offset=0)
Construct a ParGridFunction using previously allocated Vector base starting at the given offset,...
Definition pgridfunc.hpp:70
HypreParVector * ParallelAverage() const
Returns a new vector averaged on the true dofs.
real_t ComputeH1Error(Coefficient *exsol, VectorCoefficient *exgrad, Coefficient *ell_coef, real_t Nu, int norm_type) const override
real_t ComputeDGFaceJumpError(Coefficient *exsol, Coefficient *ell_coeff, JumpScaling jump_scaling, const IntegrationRule *irs[]=NULL) const override
Returns the Face Jumps error for L2 elements.
void Save(std::ostream &out) const override
real_t ComputeL1Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const override
ParGridFunction(ParFiniteElementSpace *pf, real_t *data)
Construct a ParGridFunction using previously allocated array data.
Definition pgridfunc.hpp:65
real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
void ProjectDiscCoefficient(VectorCoefficient &coeff) override
Project a discontinuous vector coefficient as a grid function on a continuous finite element space....
real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const override
real_t ComputeH1Error(Coefficient *exsol, VectorCoefficient *exgrad, const IntegrationRule *irs[]=NULL) const override
void ProjectBdrCoefficient(VectorCoefficient &vcoeff, const Array< int > &attr) override
Project a VectorCoefficient on the GridFunction, modifying only DOFs on the boundary associated with ...
const Vector & FaceNbrData() const
HypreParVector * GetTrueDofs() const
Returns the true dofs in a new HypreParVector.
ParGridFunction(const ParGridFunction &orig)
Copy constructor. The internal vector face_nbr_data is not copied.
Definition pgridfunc.hpp:53
real_t ComputeLpError(const real_t p, Coefficient &exsol, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
void AddDistribute(real_t a, const Vector &tv)
real_t ComputeLpError(const real_t p, VectorCoefficient &exsol, Coefficient *weight=NULL, VectorCoefficient *v_weight=NULL, const IntegrationRule *irs[]=NULL) const override
void SetFromTrueDofs(const Vector &tv) override
Set the GridFunction from the given true-dof vector.
void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &flux, bool wcoef=true, int subdomain=-1) override
ParGridFunction & operator=(real_t value)
Assign constant values to the ParGridFunction data.
ParGridFunction & operator=(const HypreParVector &tv)
Short semantic for Distribute()
void ProjectBdrCoefficient(Coefficient *coeff[], VectorCoefficient *vcoeff, const Array< int > &attr)
real_t ComputeMaxError(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const override
real_t ComputeHDivError(VectorCoefficient *exsol, Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const override
Returns the error measured H(div)-norm for RT elements.
void ProjectBdrCoefficient(Coefficient *coeff[], const Array< int > &attr) override
Project a set of Coefficients on the components of the GridFunction, modifying only DOFs on the bound...
ParFiniteElementSpace * pfes
Points to the same object as fes.
Definition pgridfunc.hpp:35
real_t ComputeL1Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const override
Vector send_data
Vector used as an MPI buffer to send face-neighbor data in ExchangeFaceNbrData() to neighboring proce...
Definition pgridfunc.hpp:44
HypreParVector * ParallelProject() const
Returns a new vector restricted to the true dofs.
HypreParVector * ParallelAssemble() const
Returns a new vector assembled on the true dofs.
void Distribute(const Vector &tv)
real_t ComputeL1Error(VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL) const override
ParFiniteElementSpace * ParFESpace() const
real_t ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
Returns ||u_ex - u_h||_L2 for H1 or L2 elements.
virtual ~ParGridFunction()=default
void AddDistribute(real_t a, const Vector *tv)
void MakeRef(FiniteElementSpace *f, real_t *v) override
Make the ParGridFunction reference external data on a new FiniteElementSpace.
void GetDerivative(int comp, int der_comp, ParGridFunction &der)
Parallel version of GridFunction::GetDerivative(); see its documentation.
void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const override
real_t ComputeL2Error(VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
real_t ComputeGradError(VectorCoefficient *exgrad, const IntegrationRule *irs[]=NULL) const override
Returns ||grad u_ex - grad u_h||_L2 for H1 or L2 elements.
real_t ComputeDivError(Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const override
Returns ||div u_ex - div u_h||_L2 for RT elements.
void SaveAsSerial(const char *fname, int precision=16, int save_rank=0) const
ParGridFunction(ParFiniteElementSpace *pf)
Definition pgridfunc.hpp:56
Vector face_nbr_data
Vector used to store data from face-neighbor processors, initialized by ExchangeFaceNbrData().
Definition pgridfunc.hpp:39
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void SaveAsOne(const char *fname, int precision=16) const
GridFunction GetSerialGridFunction(int save_rank, Mesh &serial_mesh) const
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
Definition pgridfunc.cpp:90
real_t ComputeMaxError(Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const override
void SetSpace(FiniteElementSpace *f) override
Associate a new FiniteElementSpace with the ParGridFunction.
Definition pgridfunc.cpp:96
real_t ComputeHCurlError(VectorCoefficient *exsol, VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const override
Returns the error measured H(curl)-norm for ND elements.
void Distribute(const Vector *tv)
void GetElementDofValues(int el, Vector &dof_vals) const override
ParGridFunction & operator=(const Vector &v)
Copy the data from a Vector to the ParGridFunction data.
real_t ComputeCurlError(VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const override
Returns ||curl u_ex - curl u_h||_L2 for ND elements.
void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const Array< int > &bdr_attr) override
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
real_t GetValue(ElementTransformation &T)
ParGridFunction & operator=(const ParGridFunction &rhs)
Copy assignment. Only the data of the base class Vector is copied.
Class for parallel meshes.
Definition pmesh.hpp:34
Base class for vector Coefficients that optionally depend on time and space.
Vector data type.
Definition vector.hpp:80
Memory< real_t > data
Definition vector.hpp:83
real_t a
Definition lissajous.cpp:41
real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
Definition vector.hpp:45
real_t L2ZZErrorEstimator(BilinearFormIntegrator &flux_integrator, const ParGridFunction &x, ParFiniteElementSpace &smooth_flux_fes, ParFiniteElementSpace &flux_fes, Vector &errors, int norm_p, real_t solver_tol, int solver_max_it)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Definition globals.hpp:66
real_t GlobalLpNorm(const real_t p, real_t loc_norm, MPI_Comm comm)
Compute a global Lp norm from the local Lp norms computed by each processor.
float real_t
Definition config.hpp:43
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30
real_t p(const Vector &x, real_t t)