libMesh
error_vector.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_ERROR_VECTOR_H
21 #define LIBMESH_ERROR_VECTOR_H
22 
23 // Local Includes
24 #include "libmesh/statistics.h"
25 
26 // C++ includes
27 #include <cstddef>
28 
29 namespace libMesh
30 {
31 
32 // Forward Declarations
33 class MeshBase;
34 class Mesh;
35 
50 class ErrorVector : public StatisticsVector<ErrorVectorReal>
51 {
52 public:
53 
62  ErrorVector(dof_id_type i=0, MeshBase * mesh = nullptr) :
64  _mesh(mesh)
65  {}
66 
77 
81  virtual ErrorVectorReal minimum() const override;
82 
87  virtual Real mean() const override;
88 
96  virtual Real median() override;
97 
103  virtual Real median() const override;
104 
115  virtual Real variance() const override
116  { return this->variance(this->mean()); }
117 
129  virtual Real variance(const Real mean) const override;
130 
136  virtual std::vector<dof_id_type> cut_below(Real cut) const override;
137 
143  virtual std::vector<dof_id_type> cut_above(Real cut) const override;
144 
150  void plot_error(const std::string & filename,
151  const MeshBase & mesh) const;
152 
153 protected:
157  bool is_active_elem (dof_id_type i) const;
158 
164 };
165 
166 } // namespace libMesh
167 
168 #endif // LIBMESH_ERROR_VECTOR_H
MeshBase * _mesh
Pointer to the mesh, which may be used to decide which elements are active.
Definition: error_vector.h:163
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
MeshBase & mesh
virtual Real variance() const override
Definition: error_vector.h:115
The StatisticsVector class is derived from the std::vector<> and therefore has all of its useful feat...
Definition: statistics.h:67
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef float ErrorVectorReal
virtual std::vector< dof_id_type > cut_above(Real cut) const override
Definition: error_vector.C:174
This is the MeshBase class.
Definition: mesh_base.h:74
virtual Real median() override
Definition: error_vector.C:92
void plot_error(const std::string &filename, const MeshBase &mesh) const
Plots a data file, of a type determined by looking at the file extension in filename, of the error values on the active elements of mesh.
Definition: error_vector.C:210
virtual std::vector< dof_id_type > cut_below(Real cut) const override
Definition: error_vector.C:150
virtual ErrorVectorReal minimum() const override
Definition: error_vector.C:46
ErrorVector(dof_id_type i=0, MeshBase *mesh=nullptr)
ErrorVector constructor; sets initial length to i.
Definition: error_vector.h:62
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ErrorVector(dof_id_type i, ErrorVectorReal val)
ErrorVector constructor; sets initial length to i and initial values to val.
Definition: error_vector.h:75
bool is_active_elem(dof_id_type i) const
Utility function to decide whether element i is active.
Definition: error_vector.C:197
uint8_t dof_id_type
Definition: id_types.h:67
virtual Real mean() const override
Definition: error_vector.C:69