libMesh
|
The ErrorVector
is a specialization of the StatisticsVector
for error data computed on a finite element mesh.
More...
#include <error_vector.h>
Public Member Functions | |
ErrorVector (dof_id_type i=0, MeshBase *mesh=nullptr) | |
ErrorVector constructor; sets initial length to i . More... | |
ErrorVector (dof_id_type i, ErrorVectorReal val) | |
ErrorVector constructor; sets initial length to i and initial values to val . More... | |
virtual ErrorVectorReal | minimum () const override |
virtual Real | mean () const override |
virtual Real | median () override |
virtual Real | median () const override |
A const version of the median function. More... | |
virtual Real | variance () const override |
virtual Real | variance (const Real mean) const override |
virtual std::vector< dof_id_type > | cut_below (Real cut) const override |
virtual std::vector< dof_id_type > | cut_above (Real cut) const override |
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 . More... | |
virtual Real | l2_norm () const |
virtual ErrorVectorReal | maximum () const |
virtual Real | stddev () const |
virtual Real | stddev (const Real known_mean) const |
void | normalize () |
Divides all entries by the largest entry and stores the result. More... | |
virtual void | histogram (std::vector< dof_id_type > &bin_members, unsigned int n_bins=10) |
virtual void | histogram (std::vector< dof_id_type > &bin_members, unsigned int n_bins=10) const |
A const version of the histogram function. More... | |
void | plot_histogram (const processor_id_type my_procid, const std::string &filename, unsigned int n_bins) |
Generates a Matlab/Octave style file which can be used to make a plot of the histogram having the desired number of bins. More... | |
Protected Member Functions | |
bool | is_active_elem (dof_id_type i) const |
Utility function to decide whether element i is active. More... | |
Protected Attributes | |
MeshBase * | _mesh |
Pointer to the mesh, which may be used to decide which elements are active. More... | |
The ErrorVector
is a specialization of the StatisticsVector
for error data computed on a finite element mesh.
In general, when computing the error on a mesh only the active elements are considered, but the ErrorVector
is sized according to the total number of elements in the mesh. The ErrorVector
is thus padded with zeros for all the inactive elements, and this must be taken into account when calculating the statistics. Since the error is a positive quantity this class assumes it contains positive data (i.e. min_val >= 0.).
Definition at line 50 of file error_vector.h.
|
inline |
ErrorVector constructor; sets initial length to i
.
If mesh is not null, MeshBase::elem() and Elem::is_active() will be used to distinguish active and inactive elements. If mesh is null, ErrorVector will assume that all 0.0 error values correspond to inactive elements and all non-zero error values correspond to active elements.
Definition at line 62 of file error_vector.h.
|
inline |
ErrorVector constructor; sets initial length to i
and initial values to val
.
If mesh is not null, MeshBase::elem() and Elem::is_active() will be used to distinguish active and inactive elements. If mesh is null, ErrorVector will assume that all 0.0 error values correspond to inactive elements and all non-zero error values correspond to active elements.
Definition at line 75 of file error_vector.h.
|
overridevirtual |
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 174 of file error_vector.C.
References is_active_elem().
|
overridevirtual |
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 150 of file error_vector.C.
References is_active_elem().
|
virtualinherited |
For simplicity, the bins are assumed to be of uniform size. Upon return, the bin_members vector will contain unsigned integers which give the number of members in each bin. WARNING: This non-const function sorts the vector, changing its order. Source: GNU Scientific Library.
Definition at line 179 of file statistics.C.
References libMesh::index_range(), libMesh::libmesh_assert(), libMesh::out, and libMesh::Real.
|
virtualinherited |
A const version of the histogram function.
Definition at line 328 of file statistics.C.
References libMesh::StatisticsVector< T >::histogram().
|
protected |
Utility function to decide whether element i is active.
Definition at line 197 of file error_vector.C.
References _mesh, libMesh::Elem::active(), and libMesh::MeshBase::elem_ptr().
Referenced by cut_above(), cut_below(), mean(), median(), minimum(), and variance().
|
virtualinherited |
Definition at line 37 of file statistics.C.
References libMesh::Real, and std::sqrt().
|
virtualinherited |
Definition at line 62 of file statistics.C.
|
overridevirtual |
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 69 of file error_vector.C.
References is_active_elem(), and libMesh::Real.
Referenced by libMesh::MeshRefinement::flag_elements_by_mean_stddev(), main(), and variance().
|
overridevirtual |
This function modifies the original data by sorting, so it can't be called on const objects. Source: GNU Scientific Library
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 92 of file error_vector.C.
References is_active_elem(), and libMesh::StatisticsVector< T >::median().
Referenced by median().
|
overridevirtual |
A const version of the median function.
Requires twice the memory of original data set but does not change the original.
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 116 of file error_vector.C.
References median().
|
overridevirtual |
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 46 of file error_vector.C.
References libMesh::ErrorVectorReal, and is_active_elem().
|
inherited |
Divides all entries by the largest entry and stores the result.
Definition at line 165 of file statistics.C.
References libMesh::Real.
void libMesh::ErrorVector::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 at line 210 of file error_vector.C.
References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::clone(), libMesh::CONSTANT, libMesh::Elem::DO_NOTHING, libMesh::DofMap::dof_indices(), libMesh::ENCODE, libMesh::err, libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), mesh, libMesh::MONOMIAL, libMesh::System::solution, libMesh::WRITE, libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), libMesh::ExodusII_IO::write(), libMesh::EquationSystems::write(), libMesh::EquationSystems::WRITE_ADDITIONAL_DATA, libMesh::EquationSystems::WRITE_DATA, libMesh::GMVIO::write_discontinuous_gmv(), libMesh::Nemesis_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data(), and libMesh::MeshOutput< MT >::write_equation_systems().
Referenced by libMesh::AdjointResidualErrorEstimator::estimate_error(), and main().
|
inherited |
Generates a Matlab/Octave style file which can be used to make a plot of the histogram having the desired number of bins.
Uses the histogram(...) function in this class WARNING: The histogram(...) function is non-const, and changes the order of the vector.
Definition at line 285 of file statistics.C.
References libMesh::index_range(), and libMesh::Real.
|
inlinevirtualinherited |
Definition at line 154 of file statistics.h.
References std::sqrt(), and libMesh::StatisticsVector< T >::variance().
|
inlinevirtualinherited |
This method can be used for efficiency when the mean
has already been computed.
Definition at line 164 of file statistics.h.
References std::sqrt(), and libMesh::StatisticsVector< T >::variance().
|
inlineoverridevirtual |
Uses a recurrence relation to prevent data overflow for large sums.
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 115 of file error_vector.h.
References mean().
Referenced by libMesh::MeshRefinement::flag_elements_by_mean_stddev(), and main().
mean
.This is useful for efficiency when you have already calculated the mean. Uses a recurrence relation to prevent data overflow for large sums.
Reimplemented from libMesh::StatisticsVector< ErrorVectorReal >.
Definition at line 126 of file error_vector.C.
References is_active_elem(), and libMesh::Real.
|
protected |
Pointer to the mesh, which may be used to decide which elements are active.
Definition at line 163 of file error_vector.h.
Referenced by is_active_elem().