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;
86void 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);
238 && logActive_ == rhs.logActive_
239 && (!logActive_ || (logCoeff_ == rhs.logCoeff_))
249 if (coeffs.
size() < poly.size())
256 coeffs[i] += poly[i];
268 if (coeffs.
size() < poly.size())
275 coeffs[i] -= poly[i];
313 poly.logActive_ =
false;
Macros for easy insertion into run-time selection tables.
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)....
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Polynomial function representation.
scalar logCoeff() const
The log coefficient.
scalar integrate(const scalar x1, const scalar x2) const
Integrate between two values.
polynomialFunction & operator/=(const scalar)
scalar value(const scalar x) const
Return polynomial value.
polynomialFunction & operator+=(const polynomialFunction &)
polynomialFunction()
Default construct as size 1 with coefficient == 0.
polynomialFunction & operator-=(const polynomialFunction &)
polynomialFunction & operator*=(const scalar)
bool logActive() const
True if the log term is active.
polynomialFunction integralMinus1(const scalar intConstant=0) const
Return integral coefficients when lowest order is -1.
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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))
dimensionedScalar log(const dimensionedScalar &ds)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
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.