libMesh
error_vector.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 
64  _mesh(mesh)
65  {}
66 
77 
81  virtual ErrorVectorReal minimum() const libmesh_override;
82 
87  virtual Real mean() const libmesh_override;
88 
96  virtual Real median() libmesh_override;
97 
103  virtual Real median() const libmesh_override;
104 
115  virtual Real variance() const libmesh_override
116  { return this->variance(this->mean()); }
117 
129  virtual Real variance(const Real mean) const libmesh_override;
130 
136  virtual std::vector<dof_id_type> cut_below(Real cut) const libmesh_override;
137 
143  virtual std::vector<dof_id_type> cut_above(Real cut) const libmesh_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
virtual Real variance() const libmesh_override
Definition: error_vector.h:115
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
const class libmesh_nullptr_t libmesh_nullptr
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
This is the MeshBase class.
Definition: mesh_base.h:68
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:208
virtual Real median() libmesh_override
Definition: error_vector.C:90
bool is_active_elem(dof_id_type i) const
Utility function to decide whether element i is active.
Definition: error_vector.C:195
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::vector< dof_id_type > cut_above(Real cut) const libmesh_override
Definition: error_vector.C:172
ErrorVector(dof_id_type i=0, MeshBase *mesh=libmesh_nullptr)
ErrorVector constructor; sets initial length to i.
Definition: error_vector.h:62
ErrorVector(dof_id_type i, ErrorVectorReal val)
ErrorVector constructor; sets initial length to i and initial values to val.
Definition: error_vector.h:75
virtual Real mean() const libmesh_override
Definition: error_vector.C:67
virtual std::vector< dof_id_type > cut_below(Real cut) const libmesh_override
Definition: error_vector.C:148
virtual ErrorVectorReal minimum() const libmesh_override
Definition: error_vector.C:44
uint8_t dof_id_type
Definition: id_types.h:64