libMesh
Loading...
Searching...
No Matches
smoothness_estimator.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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_SMOOTHNESS_ESTIMATOR_H
21#define LIBMESH_SMOOTHNESS_ESTIMATOR_H
22
23// Local Includes
24#include "libmesh/point.h"
25#include "libmesh/elem_range.h"
26
27// C++ includes
28#include <cstddef>
29#include <vector>
30
31namespace libMesh
32{
33
34// Forward Declarations
35class ErrorVector;
36class System;
37class Elem;
38enum Order : int;
39
49{
50public:
51
56
65 virtual ~SmoothnessEstimator() = default;
66
75 virtual void estimate_smoothness (const System & system,
76 ErrorVector & smoothness_per_cell,
77 const NumericVector<Number> * solution_vector = nullptr);
78
86 void extra_quadrature_order (const int extraorder)
87 { _extra_order = extraorder; }
88
89protected:
90
94 static std::vector<Real> legepoly(const unsigned int dim,
95 const Order order,
96 const Point p,
97 const unsigned int matsize);
98
103
107 static Real compute_slope(int N, Real Sx, Real Sy, Real Sxx, Real Sxy);
108
109 void reduce_smoothness (std::vector<ErrorVectorReal> & error_per_cell,
110 const Parallel::Communicator & comm);
111
112private:
113
119 {
120 public:
122 const SmoothnessEstimator & ee,
123 ErrorVector & epc) :
124 system(sys),
127 {}
128
129 void operator()(const ConstElemRange & range) const;
130
131 private:
132 const System & system;
135 };
136
137 friend class EstimateSmoothness;
138};
139
140
141} // namespace libMesh
142
143
144#endif // LIBMESH_SMOOTHNESS_ESTIMATOR_H
unsigned int dim
void ErrorVector unsigned int
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
Class to compute the error contribution for a range of elements.
void operator()(const ConstElemRange &range) const
EstimateSmoothness(const System &sys, const SmoothnessEstimator &ee, ErrorVector &epc)
This class implements the Smoothness estimate.
static std::vector< Real > legepoly(const unsigned int dim, const Order order, const Point p, const unsigned int matsize)
virtual ~SmoothnessEstimator()=default
virtual void estimate_smoothness(const System &system, ErrorVector &smoothness_per_cell, const NumericVector< Number > *solution_vector=nullptr)
This function uses the Legendre expansion of solution to estimate coefficient decay to quantify the s...
void extra_quadrature_order(const int extraorder)
Increases or decreases the order of the quadrature rule used for numerical integration.
static Real compute_slope(int N, Real Sx, Real Sy, Real Sxx, Real Sxy)
Computes slop in a linear regression.
SmoothnessEstimator(const SmoothnessEstimator &)=default
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this c...
int _extra_order
Extra order to use for quadrature rule.
SmoothnessEstimator(SmoothnessEstimator &&)=default
SmoothnessEstimator & operator=(const SmoothnessEstimator &)=default
void reduce_smoothness(std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm)
The StoredRange class defines a contiguous, divisible set of objects.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition system.h:100
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real