33 #include <type_traits> 37 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
44 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
54 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
55 template<
class Form2,
class Cmpt2>
65 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
66 template<
class SubVector, Foam::direction BStart>
78 "Requested block size > VectorSpace size" 85 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
95 <<
"index out of range" 104 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
114 <<
"index out of range" 123 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
134 <<
"index out of range" 143 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
154 <<
"index out of range" 163 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
170 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
179 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
180 template<
class SubVector, Foam::direction BStart>
182 ConstBlock<SubVector, BStart>
191 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
201 <<
"index out of range" 210 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
220 <<
"index out of range" 229 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
230 template<
class SubVector, Foam::direction BStart>
242 <<
"index out of range" 247 return vs_[BStart + d];
251 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
252 template<
class SubVector, Foam::direction BStart>
265 <<
"index " << i <<
" out of range" 272 <<
"index " << j <<
" != 0" 277 return vs_[BStart + i];
281 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
291 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
292 inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator+=
301 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
311 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
318 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
328 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
345 template<
class Form,
class Cmpt, direction Ncmpts>
356 template<
class Form,
class Cmpt, direction Ncmpts>
359 const VectorSpace<Form, Cmpt, Ncmpts>& vs,
363 return vs.component(d);
370 template<
class Form,
class Cmpt, direction Ncmpts>
383 template<
class Form,
class Cmpt, direction Ncmpts>
386 const VectorSpace<Form, Cmpt, Ncmpts>& v,
391 return static_cast<const Form&
>(v);
396 template<
class Form,
class Cmpt, direction Ncmpts>
399 const VectorSpace<Form, Cmpt, Ncmpts>& v,
404 return sqr(static_cast<const Form&>(v));
408 template<
class Form,
class Cmpt, direction Ncmpts>
411 const VectorSpace<Form, Cmpt, Ncmpts>& vs
414 scalar ms =
magSqr(vs.v_[0]);
420 template<
class Form,
class Cmpt, direction Ncmpts>
423 const VectorSpace<Form, Cmpt, Ncmpts>& vs
432 template<
class Form,
class Cmpt, direction Ncmpts>
441 const scalar
s(
mag(vs));
442 return s < ROOTVSMALL ?
Zero : vs/
s;
446 template<
class Form,
class Cmpt, direction Ncmpts>
459 template<
class Form,
class Cmpt, direction Ncmpts>
472 template<
class Form,
class Cmpt, direction Ncmpts>
485 template<
class Form,
class Cmpt, direction Ncmpts>
498 template<
class Form,
class Cmpt, direction Ncmpts>
504 Cmpt cMax = vs.
v_[0];
510 template<
class Form,
class Cmpt, direction Ncmpts>
516 Cmpt cMin = vs.
v_[0];
522 template<
class Form,
class Cmpt, direction Ncmpts>
534 template<
class Form,
class Cmpt, direction Ncmpts>
544 template<
class Form,
class Cmpt, direction Ncmpts>
550 Cmpt product = vs.
v_[0];
556 template<
class Form,
class Cmpt, direction Ncmpts>
568 template<
class Form,
class Cmpt, direction Ncmpts>
580 template<
class Form,
class Cmpt, direction Ncmpts>
592 template<
class Form,
class Cmpt, direction Ncmpts>
605 template<
class Form,
class Cmpt, direction Ncmpts>
618 template<
class Form,
class Cmpt, direction Ncmpts>
632 inline Type
dot(
const scalar
s,
const Type& t)
639 inline Type
dot(
const Type& t,
const scalar
s)
648 class Form2,
class Cmpt2,
direction Ncmpts2
656 return static_cast<const Form1&
>(t1) & static_cast<const Form2&>(t2);
662 template<
class Form,
class Cmpt, direction Ncmpts>
663 inline Form
operator-
674 template<
class Form,
class Cmpt, direction Ncmpts>
675 inline Form
operator+
686 template<
class Form,
class Cmpt, direction Ncmpts>
687 inline Form
operator-
689 const VectorSpace<Form, Cmpt, Ncmpts>& vs1,
690 const VectorSpace<Form, Cmpt, Ncmpts>& vs2
699 template<
class Form,
class Cmpt, direction Ncmpts>
700 inline Form
operator*
712 template<
class Form,
class Cmpt, direction Ncmpts>
713 inline Form
operator*
725 template<
class Form,
class Cmpt, direction Ncmpts>
726 inline Form
operator/
765 template<
class Form,
class Cmpt, direction Ncmpts>
766 inline Cmpt
operator&&
772 Cmpt ddProd = vs1.v_[0]*vs2.
v_[0];
775 ddProd += vs1.v_[i]*vs2.
v_[i];
781 template<
class Form,
class Cmpt, direction Ncmpts>
782 inline bool operator==
790 if (!
equal(vs1.
v_[i], vs2.
v_[i]))
return false;
796 template<
class Form,
class Cmpt, direction Ncmpts>
797 inline bool operator!=
803 return !(vs1 == vs2);
807 template<
class Form,
class Cmpt, direction Ncmpts>
808 inline bool operator<
817 if (!(vs1.v_[i] < vs2.
v_[i]))
return false;
823 template<
class Form,
class Cmpt, direction Ncmpts>
824 inline bool operator<=
834 template<
class Form,
class Cmpt, direction Ncmpts>
835 inline bool operator>
845 template<
class Form,
class Cmpt, direction Ncmpts>
846 inline bool operator>=
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Cmpt cmptSum(const SphericalTensor< Cmpt > &st)
Return the sum of components of a SphericalTensor.
bool equal(const T &a, const T &b)
Compare two values for equality.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void operator=(const VectorSpace< Form, Cmpt, Ncmpts > &)
Recursive execution. Terminating at <N>, starting at index <I>
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static void eqOpS(V &vs, const S &s, EqOp eo)
Apply the binary assignment operation to each vector-space component.
Traits classes for inner and outer products of primitives.
iterator begin() noexcept
Return an iterator (pointer) to begin of VectorSpace.
dimensionedScalar sqrt(const dimensionedScalar &ds)
static void op(V &vs, const V1 &vs1, const V1 &vs2, BinaryOp bop)
Apply the binary operation between two vector-space data and assign the result.
A traits class, which is primarily used for primitives and vector-space.
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
static void copy_n(Input input, Output result)
Somewhat equivalent to std::copy_n() but with templated loops.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
void replace(const direction, const Cmpt &)
static void SeqOp(S &s, const V &vs, EqOp eo)
Apply the inplace binary reduction operation.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void cmptMagSqr(Field< Type > &result, const UList< Type > &f1)
const_iterator cbegin() const noexcept
Return const_iterator (const pointer) to begin of VectorSpace.
VectorSpace()=default
Default construct.
errorManip< error > abort(error &err)
Scalar cmptPow(const Scalar s1, const Scalar s2)
const ConstBlock< SubVector, BStart > block() const
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
static constexpr direction nComponents
Number of components in this vector space.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Scalar cmptSqr(const Scalar s)
friend Ostream & operator(Ostream &, const VectorSpace< Form, Cmpt, Ncmpts > &)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Scalar minMod(const Scalar s1, const Scalar s2)
void fill(const Cmpt &s)
Assign all components to given value.
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
Apply the inplace binary assignment operation to the components.
static void opSV(V &vs, const S &s, const V1 &vs1, BinaryOp bop)
Apply the binary operation between scalar and vector-space data and assign the result.
const dimensionedScalar c
Speed of light in a vacuum.
const Cmpt & component(const direction) const
static void fill_n(Output result, const T &val)
Somewhat equivalent to std::fill_n() but with templated loops.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
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))
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 2 >::type type
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Cmpt v_[Ncmpts]
The components of this vector space.
static const direction nComponents
Number of components in this vector space.
static void opVS(V &vs, const V1 &vs1, const S &s, BinaryOp bop)
Apply the binary operation between vector-space and scalar data and assign the result.
static constexpr const zero Zero
Global zero (0)