34void Foam::Function1Types::Polynomial<Type>::checkCoefficients()
39 <<
"Invalid (empty) polynomial coefficients for "
44 for (
const auto& coeff : coeffs_)
46 if (
mag(coeff.second() + pTraits<Type>::one) < ROOTVSMALL)
48 canIntegrate_ =
false;
53 if (debug && !canIntegrate_)
56 <<
"Polynomial " << this->
name() <<
" cannot be integrated"
67 const word& entryName,
83 ITstream& is = eptr->stream();
84 if (is.peek().isWord())
89 dict.checkITstream(is, entryName);
97 dict.readEntry(
"coeffs", this->coeffs_);
100 this->checkCoefficients();
107 const word& entryName,
116 this->checkCoefficients();
124 coeffs_(poly.coeffs_),
125 canIntegrate_(poly.canIntegrate_)
136 Type value = coeffs_[i].first();
137 for (
direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
155 cmptPow(pTraits<Type>::one*
x, coeffs_[i].second())
Polynomial(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
virtual void writeData(Ostream &os) const
Write as primitive (inline) format.
virtual Type value(const scalar x) const
Return Polynomial value.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
virtual void userTimeToTime(const Time &t)
Convert time.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual void writeData(Ostream &os) const
Write in dictionary format.
Function1(const word &entryName, const objectRegistry *obrPtr=nullptr)
Construct from entry name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
virtual bool isStream() const noexcept
True if this entry is a stream.
Registry of regIOobjects.
A traits class, which is primarily used for primitives and vector-space.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Scalar cmptPow(const Scalar s1, const Scalar s2)
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components).
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.