33 const unitConversions&
units,
37 unitConversion unitsXPowI(
units.x);
40 coeffs[i] =
units.value.toStandard(unitsXPowI.toUser(coeffs[i]));
41 unitsXPowI.reset(
units.x*unitsXPowI);
50 const unitConversions&
units,
54 unitConversion unitsXPowI(
units.x);
57 coeffs[i] =
units.value.toUser(unitsXPowI.toStandard(coeffs[i]));
58 unitsXPowI.reset(
units.x*unitsXPowI);
89 << typeName.capitalise() <<
' ' <<
name
90 <<
" must have at least one coefficient"
105 coeffs_(convertRead(
units, is))
110 << typeName.capitalise() <<
' ' <<
name
111 <<
" must have at least one coefficient"
121 coeffs_(poly.coeffs_)
137 Type
y = coeffs_[coeffs_.size() - 1];
139 for (
label i = coeffs_.size() - 2; i >= 0; i --)
141 y =
y*
x + coeffs_[i];
155 Type Sy1 = coeffs_[coeffs_.size() - 1]/coeffs_.size(), Sy2 = Sy1;
157 for (
label i = coeffs_.size() - 2; i >= 0; i --)
159 Sy1 = Sy1*x1 + coeffs_[i]/(i + 1);
160 Sy2 = Sy2*x2 + coeffs_[i]/(i + 1);
163 return x2*Sy2 - x1*Sy1;
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return the name of the entry.
Arbitrary order polynomial Function1.
virtual Type integral(const scalar x1, const scalar x2) const
Integrate between two scalar fields.
Polynomial(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
virtual void write(Ostream &os, const unitConversions &units) const
Write in dictionary format.
virtual ~Polynomial()
Destructor.
virtual Type value(const scalar x) const
Return Polynomial value as a function of scalar x.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by any number of values (e....
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void writeEntry(Ostream &os, const omega &a)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const bool)
Return a word representation of a bool.
const HashTable< unitConversion > & units()
Get the table of unit conversions.