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>
172 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
173 template<
class SubVector, Foam::direction BStart>
175 ConstBlock<SubVector, BStart>
184 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
191 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
198 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
205 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
208 return (
v_ + Ncmpts);
212 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
220 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
224 return (
v_ + Ncmpts);
228 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
236 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
240 return (
v_ + Ncmpts);
246 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
256 <<
"index out of range" 265 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
275 <<
"index out of range" 284 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
285 template<
class SubVector, Foam::direction BStart>
297 <<
"index out of range" 302 return vs_[BStart + d];
306 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
307 template<
class SubVector, Foam::direction BStart>
320 <<
"index " << i <<
" out of range" 327 <<
"index " << j <<
" != 0" 332 return vs_[BStart + i];
336 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
346 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
356 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
366 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
373 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
383 template<
class Form,
class Cmpt, Foam::direction Ncmpts>
400 template<
class Form,
class Cmpt, direction Ncmpts>
411 template<
class Form,
class Cmpt, direction Ncmpts>
414 const VectorSpace<Form, Cmpt, Ncmpts>& vs,
418 return vs.component(d);
425 template<
class Form,
class Cmpt, direction Ncmpts>
438 template<
class Form,
class Cmpt, direction Ncmpts>
441 const VectorSpace<Form, Cmpt, Ncmpts>& v,
446 return static_cast<const Form&
>(v);
451 template<
class Form,
class Cmpt, direction Ncmpts>
454 const VectorSpace<Form, Cmpt, Ncmpts>& v,
459 return sqr(static_cast<const Form&>(v));
463 template<
class Form,
class Cmpt, direction Ncmpts>
466 const VectorSpace<Form, Cmpt, Ncmpts>& vs
469 scalar ms =
magSqr(vs.v_[0]);
475 template<
class Form,
class Cmpt, direction Ncmpts>
478 const VectorSpace<Form, Cmpt, Ncmpts>& vs
487 template<
class Form,
class Cmpt, direction Ncmpts>
496 const scalar
s(
mag(vs));
497 return s < ROOTVSMALL ?
Zero : vs/
s;
501 template<
class Form,
class Cmpt, direction Ncmpts>
514 template<
class Form,
class Cmpt, direction Ncmpts>
527 template<
class Form,
class Cmpt, direction Ncmpts>
540 template<
class Form,
class Cmpt, direction Ncmpts>
553 template<
class Form,
class Cmpt, direction Ncmpts>
559 Cmpt cMax = vs.
v_[0];
565 template<
class Form,
class Cmpt, direction Ncmpts>
571 Cmpt cMin = vs.
v_[0];
577 template<
class Form,
class Cmpt, direction Ncmpts>
589 template<
class Form,
class Cmpt, direction Ncmpts>
599 template<
class Form,
class Cmpt, direction Ncmpts>
605 Cmpt product = vs.
v_[0];
611 template<
class Form,
class Cmpt, direction Ncmpts>
623 template<
class Form,
class Cmpt, direction Ncmpts>
635 template<
class Form,
class Cmpt, direction Ncmpts>
647 template<
class Form,
class Cmpt, direction Ncmpts>
660 template<
class Form,
class Cmpt, direction Ncmpts>
673 template<
class Form,
class Cmpt, direction Ncmpts>
687 inline Type
dot(
const scalar
s,
const Type& t)
694 inline Type
dot(
const Type& t,
const scalar
s)
703 class Form2,
class Cmpt2,
direction Ncmpts2
711 return static_cast<const Form1&
>(t1) & static_cast<const Form2&>(t2);
717 template<
class Form,
class Cmpt, direction Ncmpts>
718 inline Form
operator-
729 template<
class Form,
class Cmpt, direction Ncmpts>
730 inline Form
operator+
741 template<
class Form,
class Cmpt, direction Ncmpts>
742 inline Form
operator-
744 const VectorSpace<Form, Cmpt, Ncmpts>& vs1,
745 const VectorSpace<Form, Cmpt, Ncmpts>& vs2
754 template<
class Form,
class Cmpt, direction Ncmpts>
755 inline Form
operator*
767 template<
class Form,
class Cmpt, direction Ncmpts>
768 inline Form
operator*
780 template<
class Form,
class Cmpt, direction Ncmpts>
781 inline Form
operator/
820 template<
class Form,
class Cmpt, direction Ncmpts>
821 inline Cmpt
operator&&
827 Cmpt ddProd = vs1.v_[0]*vs2.
v_[0];
830 ddProd += vs1.v_[i]*vs2.
v_[i];
836 template<
class Form,
class Cmpt, direction Ncmpts>
837 inline bool operator==
845 if (!
equal(vs1.
v_[i], vs2.
v_[i]))
return false;
851 template<
class Form,
class Cmpt, direction Ncmpts>
852 inline bool operator!=
858 return !(vs1 == vs2);
862 template<
class Form,
class Cmpt, direction Ncmpts>
863 inline bool operator<
872 if (!(vs1.v_[i] < vs2.
v_[i]))
return false;
878 template<
class Form,
class Cmpt, direction Ncmpts>
879 inline bool operator<=
889 template<
class Form,
class Cmpt, direction Ncmpts>
890 inline bool operator>
900 template<
class Form,
class Cmpt, direction Ncmpts>
901 inline bool operator>=
const Cmpt * cdata() const noexcept
Return const pointer to the first data element.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
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 > &)
General looping form. Executing at index <I> with termination at <N>
Cmpt * data() noexcept
Return pointer to the first data element.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static void eqOpS(V &vs, const S &s, EqOp eo)
Traits classes for inner and outer products of primitives.
dimensionedScalar sqrt(const dimensionedScalar &ds)
A traits class, which is primarily used for primitives and vector-space.
static void opVS(V &vs, const V1 &vs1, const S &s, Op o)
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
iterator end() noexcept
Return an iterator to end of VectorSpace.
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
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)
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 > &)
const_iterator cend() const noexcept
Return const_iterator to end of VectorSpace.
void cmptMagSqr(Field< Type > &result, const UList< Type > &f1)
VectorSpace()=default
Default construct.
errorManip< error > abort(error &err)
Scalar cmptPow(const Scalar s1, const Scalar s2)
const ConstBlock< SubVector, BStart > block() const
const_iterator cbegin() const noexcept
Return const_iterator to begin of VectorSpace.
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)
static void op(V &vs, const V1 &vs1, const V1 &vs2, Op o)
Scalar cmptSqr(const Scalar s)
static void opSV(V &vs, const S &s, const V1 &vs1, Op o)
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)
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
const dimensionedScalar c
Speed of light in a vacuum.
iterator begin() noexcept
Return an iterator to begin of VectorSpace.
const Cmpt & component(const direction) const
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 constexpr const zero Zero
Global zero (0)