www.mooseframework.org
PolynomialFit.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "LeastSquaresFitBase.h"
13 
20 {
21 public:
22  /* Constructor, Takes two vectors of points for which to apply the fit. One should be of the
23  * independent variable while the other should be of the dependent variable. These values should
24  * correspond to one and other in the same position. The third parameter is the requested
25  * polynomial order and the forth parameter tells the class whether or not it should truncate
26  * the order if there are not enough points for which to apply the polynomial fit.
27  */
28  PolynomialFit(const std::vector<Real> & x,
29  const std::vector<Real> & y,
30  unsigned int order,
31  bool truncate_order = false);
32 
33  virtual Real sample(Real x) override;
34 
35 protected:
36  virtual void fillMatrix() override;
38  unsigned int _order;
42  static int _file_number;
43 };
virtual void fillMatrix() override
Helper function that creates the matrix necessary for the least squares algorithm.
Definition: PolynomialFit.C:41
virtual Real sample(Real x) override
This function will take an independent variable input and will return the dependent variable based on...
Definition: PolynomialFit.C:53
static int _file_number
File number.
Definition: PolynomialFit.h:42
Base class for linear least squares fit method.
Least squares polynomial fit.
Definition: PolynomialFit.h:19
bool _truncate_order
Flag to implement a truncated polynomial.
Definition: PolynomialFit.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PolynomialFit(const std::vector< Real > &x, const std::vector< Real > &y, unsigned int order, bool truncate_order=false)
Definition: PolynomialFit.C:21
unsigned int _order
Order of the polynomial.
Definition: PolynomialFit.h:38