42 const polynomialFunction& poly,
43 const scalar intConstant
46 polynomialFunction newPoly(poly.size()+1);
48 newPoly[0] = intConstant;
51 newPoly[i+1] = poly[i]/(i + 1);
60 const polynomialFunction& poly,
61 const scalar intConstant
64 polynomialFunction newPoly(poly.size()+1);
68 newPoly.logActive_ =
true;
69 newPoly.logCoeff_ = poly[0];
72 newPoly[0] = intConstant;
73 for (
label i=1; i < poly.size(); ++i)
75 newPoly[i] = poly[i]/i;
93 <<
"polynomialFunction coefficients are invalid (empty)" 102 logActive_(poly.logActive_),
103 logCoeff_(poly.logCoeff_)
116 <<
"polynomialFunction coefficients are invalid (empty)" 131 <<
"polynomialFunction coefficients are invalid (empty)" 160 scalar val = coeffs[0];
166 val += coeffs[i]*powX;
172 val += this->logCoeff_*
log(x);
190 <<
"Cannot integrate polynomial with logarithmic coefficients" 198 scalar val = coeffs[0]*(powX2 - powX1);
201 val += coeffs[i]/(i + 1)*(powX2 - powX1);
213 return cloneIntegral(*
this, intConstant);
220 return cloneIntegralMinus1(*
this, intConstant);
235 coeffs[i] += poly[i];
244 coeffs[i] += poly[i];
261 coeffs[i] -= poly[i];
270 coeffs[i] -= poly[i];
313 for (
int i=0; i<poly.
size()-1; i++)
323 os.
check(
"operator<<(Ostream&, const polynomialFunction&)");
polynomialFunction & operator/=(const scalar)
polynomialFunction & operator+=(const polynomialFunction &)
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar value(const scalar x) const
Return polynomial value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
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.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Macros for easy insertion into run-time selection tables.
polynomialFunction(const label)
Construct a particular size, with all coefficients = 0.0.
scalar integrate(const scalar x1, const scalar x2) const
Integrate between two values.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
scalar logCoeff() const
Return the log coefficient.
polynomialFunction & operator*=(const scalar)
Polynomial function representation.
polynomialFunction integral(const scalar intConstant=0.0) const
Return integral coefficients.
polynomialFunction integralMinus1(const scalar intConstant=0.0) const
Return integral coefficients when lowest order is -1.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool logActive() const
Return true if the log term is active.
defineTypeNameAndDebug(combustionModel, 0)
void setSize(const label)
Reset size of List.
polynomialFunction & operator-=(const polynomialFunction &)
Ostream & operator<<(Ostream &, const ensightPart &)
virtual ~polynomialFunction()
Destructor.
T & last()
Return the last element of the list.