44 const polynomialFunction& poly,
45 const scalar intConstant
50 newPoly[0] = intConstant;
53 newPoly[i+1] = poly[i]/(i + 1);
62 const polynomialFunction& poly,
63 const scalar intConstant
66 polynomialFunction newPoly(poly.size()+1);
70 newPoly.logActive_ =
true;
71 newPoly.logCoeff_ = poly[0];
74 newPoly[0] = intConstant;
75 for (label i=1; i < poly.size(); ++i)
77 newPoly[i] = poly[i]/i;
86 void Foam::polynomialFunction::checkSize()
const 91 <<
"polynomialFunction coefficients are invalid (empty)" 119 const std::initializer_list<scalar> coeffs
167 scalar val = coeffs[0];
171 for (label i=1; i<coeffs.
size(); ++i)
173 val += coeffs[i]*powX;
179 val += this->logCoeff_*
log(
x);
197 <<
"Cannot integrate polynomial with logarithmic coefficients" 205 scalar val = coeffs[0]*(powX2 - powX1);
206 for (label i=1; i<coeffs.size(); ++i)
208 val += coeffs[i]/(i + 1)*(powX2 - powX1);
220 return cloneIntegral(*
this, intConstant);
227 return cloneIntegralMinus1(*
this, intConstant);
237 scalarList::operator==(static_cast<const scalarList&>(rhs))
238 && logActive_ == rhs.logActive_
239 && (!logActive_ || (logCoeff_ == rhs.logCoeff_))
256 coeffs[i] += poly[i];
268 if (coeffs.size() < poly.size())
275 coeffs[i] -= poly[i];
313 poly.logActive_ =
false;
347 const polynomialFunction& p1,
348 const polynomialFunction& p2
359 const polynomialFunction& p1,
360 const polynomialFunction& p2
372 const polynomialFunction&
p 384 const polynomialFunction&
p 395 const polynomialFunction&
p,
407 const polynomialFunction&
p,
411 polynomialFunction poly(
p);
polynomialFunction & operator/=(const scalar)
List< scalar > scalarList
List of scalar.
polynomialFunction & operator+=(const polynomialFunction &)
void size(const label n)
Older name for setAddressableSize.
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
polynomialFunction()
Default construct as size 1 with coefficient == 0.
Begin list [isseparator].
polynomialFunction integralMinus1(const scalar intConstant=0) const
Return integral coefficients when lowest order is -1.
Macros for easy insertion into run-time selection tables.
scalar integrate(const scalar x1, const scalar x2) const
Integrate between two values.
#define forAll(list, i)
Loop across all elements in list.
polynomialFunction integral(const scalar intConstant=0) const
Return integral coefficients.
Istream & operator>>(Istream &, directionInfo &)
polynomialFunction & operator*=(const scalar)
Polynomial function representation.
scalar value(const scalar x) const
Return polynomial value.
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...
scalar logCoeff() const
The log coefficient.
bool operator==(const polynomialFunction &rhs) const
Equality of coefficients, and logCoeff (if active)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
bool logActive() const
True if the log term is active.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
polynomialFunction & operator-=(const polynomialFunction &)
void checkSize(const label size) const
Check size is within valid range [0,size].
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
static constexpr const zero Zero
Global zero (0)