MFEM  v4.2.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
estimators.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, 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 #include "estimators.hpp"
13 
14 namespace mfem
15 {
16 
18 {
19  flux_space->Update(false);
20  // In parallel, 'flux' can be a GridFunction, as long as 'flux_space' is a
21  // ParFiniteElementSpace and 'solution' is a ParGridFunction.
23 
24  if (!anisotropic) { aniso_flags.SetSize(0); }
26  anisotropic ? &aniso_flags : NULL,
28  with_coeff);
29 
31 }
32 
33 
34 #ifdef MFEM_USE_MPI
35 
37 {
38  flux_space->Update(false);
39  smooth_flux_space->Update(false);
40 
41  // TODO: move these parameters in the class, and add Set* methods.
42  const double solver_tol = 1e-12;
43  const int solver_max_it = 200;
46  local_norm_p, solver_tol, solver_max_it);
47 
49 }
50 
51 #endif // MFEM_USE_MPI
52 
54 {
55  MFEM_VERIFY(coef != NULL || vcoef != NULL,
56  "LpErrorEstimator has no coefficient! Call SetCoef first.");
57 
59  if (coef)
60  {
62  }
63  else
64  {
66  }
68 }
69 
70 } // namespace mfem
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:30
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
Definition: fespace.cpp:2233
void ComputeEstimates()
Compute the element error estimates.
Definition: estimators.cpp:36
virtual void ComputeElementLpErrors(const double p, Coefficient &exsol, Vector &error, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL) const
Definition: gridfunc.cpp:3154
ParFiniteElementSpace * flux_space
Ownership based on the flag own_flux_fes. Its Update() method is called automatically by this class w...
Definition: estimators.hpp:221
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:459
VectorCoefficient * vcoef
Definition: estimators.hpp:336
virtual void Update(bool want_transform=true)
Definition: pfespace.cpp:2875
int GetNE() const
Returns number of elements.
Definition: mesh.hpp:737
GridFunction * sol
Definition: estimators.hpp:337
void ComputeEstimates()
Compute the element error estimates.
Definition: estimators.cpp:17
ParGridFunction * solution
Not owned.
Definition: estimators.hpp:219
long GetSequence() const
Definition: mesh.hpp:1227
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:314
GridFunction * solution
Not owned.
Definition: estimators.hpp:92
int local_norm_p
Local L_p norm to use, default is 1.
Definition: estimators.hpp:214
FiniteElementSpace * FESpace()
Definition: gridfunc.hpp:595
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition: array.hpp:654
double L2ZZErrorEstimator(BilinearFormIntegrator &flux_integrator, const ParGridFunction &x, ParFiniteElementSpace &smooth_flux_fes, ParFiniteElementSpace &flux_fes, Vector &errors, int norm_p, double solver_tol, int solver_max_it)
Definition: pgridfunc.cpp:1061
ParFiniteElementSpace * smooth_flux_space
Ownership based on the flag own_flux_fes. Its Update() method is called automatically by this class w...
Definition: estimators.hpp:224
double ZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, Vector &error_estimates, Array< int > *aniso_flags, int with_subdomains, bool with_coeff)
Definition: gridfunc.cpp:3699
FiniteElementSpace * flux_space
Ownership based on own_flux_fes. Its Update() method is called automatically by this class when neede...
Definition: estimators.hpp:94
BilinearFormIntegrator * integ
Not owned.
Definition: estimators.hpp:218
void ComputeEstimates()
Compute the element error estimates.
Definition: estimators.cpp:53
BilinearFormIntegrator * integ
Not owned.
Definition: estimators.hpp:91