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;
94 "polynomialFunction::polynomialFunction(const label order)" 95 ) <<
"polynomialFunction coefficients are invalid (empty)" 104 logActive_(poly.logActive_),
105 logCoeff_(poly.logCoeff_)
119 "polynomialFunction::polynomialFunction(const UList<scalar>&)" 120 ) <<
"polynomialFunction coefficients are invalid (empty)" 136 "polynomialFunction::polynomialFunction(Istream&)" 137 ) <<
"polynomialFunction coefficients are invalid (empty)" 166 scalar val = coeffs[0];
172 val += coeffs[i]*powX;
178 val += this->logCoeff_*
log(x);
197 "scalar polynomialFunction::integrate" 202 ) <<
"Cannot integrate polynomial with logarithmic coefficients" 210 scalar val = coeffs[0]*(powX2 - powX1);
213 val += coeffs[i]/(i + 1)*(powX2 - powX1);
225 return cloneIntegral(*
this, intConstant);
232 return cloneIntegralMinus1(*
this, intConstant);
247 coeffs[i] += poly[i];
256 coeffs[i] += poly[i];
273 coeffs[i] -= poly[i];
282 coeffs[i] -= poly[i];
325 for (
int i=0; i<poly.
size()-1; i++)
335 os.
check(
"operator<<(Ostream&, const polynomialFunction&)");
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 ))
bool empty() const
Return true if the UList is empty (ie, size() is zero).
T & last()
Return the last element of the list.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
bool logActive() const
Return true if the log term is active.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & operator<<(Ostream &, const edgeMesh &)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
scalar value(const scalar x) const
Return polynomial value.
dimensionedScalar log(const dimensionedScalar &ds)
scalar logCoeff() const
Return the log coefficient.
void setSize(const label)
Reset size of List.
Polynomial function representation.
polynomialFunction & operator/=(const scalar)
Macros for easy insertion into run-time selection tables.
polynomialFunction(const label)
Construct a particular size, with all coefficients = 0.0.
polynomialFunction & operator+=(const polynomialFunction &)
errorManip< error > abort(error &err)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
polynomialFunction & operator*=(const scalar)
virtual ~polynomialFunction()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
polynomialFunction integralMinus1(const scalar intConstant=0.0) const
Return integral coefficients when lowest order is -1.
polynomialFunction integral(const scalar intConstant=0.0) const
Return integral coefficients.
polynomialFunction & operator-=(const polynomialFunction &)
scalar integrate(const scalar x1, const scalar x2) const
Integrate between two values.
defineTypeNameAndDebug(combustionModel, 0)