30 #include <type_traits> 39 template<
class Form,
class Cmpt, direction Ncmpts>
44 template<
class Form,
class Cmpt, direction Ncmpts>
51 template<
class Form,
class Cmpt, direction Ncmpts>
52 template<
class Form2,
class Cmpt2>
62 template<
class Form,
class Cmpt, direction Ncmpts>
63 template<
class SubVector, direction BStart>
74 vsType::nComponents >= BStart + nComponents,
75 "Requested block size > VectorSpace size" 82 template<
class Form,
class Cmpt, direction Ncmpts>
89 template<
class Form,
class Cmpt, direction Ncmpts>
99 <<
"index out of range" 108 template<
class Form,
class Cmpt, direction Ncmpts>
118 <<
"index out of range" 127 template<
class Form,
class Cmpt, direction Ncmpts>
138 <<
"index out of range" 147 template<
class Form,
class Cmpt, direction Ncmpts>
158 <<
"index out of range" 167 template<
class Form,
class Cmpt, direction Ncmpts>
176 template<
class Form,
class Cmpt, direction Ncmpts>
177 template<
class SubVector, direction BStart>
179 ConstBlock<SubVector, BStart>
188 template<
class Form,
class Cmpt, direction Ncmpts>
189 inline const Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
198 <<
"index out of range" 207 template<
class Form,
class Cmpt, direction Ncmpts>
208 inline Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
217 <<
"index out of range" 226 template<
class Form,
class Cmpt, direction Ncmpts>
227 template<
class SubVector, direction BStart>
230 ConstBlock<SubVector, BStart>::operator[]
239 <<
"index out of range" 244 return vs_[BStart + i];
248 template<
class Form,
class Cmpt, direction Ncmpts>
249 template<
class SubVector, direction BStart>
262 <<
"index out of range" 274 return vs_[BStart + i];
278 template<
class Form,
class Cmpt, direction Ncmpts>
279 inline void VectorSpace<Form, Cmpt, Ncmpts>::operator+=
288 template<
class Form,
class Cmpt, direction Ncmpts>
289 inline void VectorSpace<Form, Cmpt, Ncmpts>::operator-=
298 template<
class Form,
class Cmpt, direction Ncmpts>
305 template<
class Form,
class Cmpt, direction Ncmpts>
306 inline void VectorSpace<Form, Cmpt, Ncmpts>::operator*=
315 template<
class Form,
class Cmpt, direction Ncmpts>
316 inline void VectorSpace<Form, Cmpt, Ncmpts>::operator/=
327 template<
class Form,
class Cmpt, direction Ncmpts>
338 template<
class Form,
class Cmpt, direction Ncmpts>
352 template<
class Form,
class Cmpt, direction Ncmpts>
364 template<
class Form,
class Cmpt, direction Ncmpts>
372 return static_cast<const Form&
>(v);
377 template<
class Form,
class Cmpt, direction Ncmpts>
385 return sqr(static_cast<const Form&>(v));
389 template<
class Form,
class Cmpt, direction Ncmpts>
401 template<
class Form,
class Cmpt, direction Ncmpts>
411 template<
class Form,
class Cmpt, direction Ncmpts>
417 const scalar magVs =
mag(vs);
418 return magVs > 0 ? vs/magVs :
Zero;
422 template<
class Form,
class Cmpt, direction Ncmpts>
435 template<
class Form,
class Cmpt, direction Ncmpts>
448 template<
class Form,
class Cmpt, direction Ncmpts>
461 template<
class Form,
class Cmpt, direction Ncmpts>
474 template<
class Form,
class Cmpt, direction Ncmpts>
480 Cmpt cMax = vs.
v_[0];
486 template<
class Form,
class Cmpt, direction Ncmpts>
492 Cmpt cMin = vs.
v_[0];
498 template<
class Form,
class Cmpt, direction Ncmpts>
510 template<
class Form,
class Cmpt, direction Ncmpts>
519 template<
class Form,
class Cmpt, direction Ncmpts>
525 Cmpt product = vs.
v_[0];
531 template<
class Form,
class Cmpt, direction Ncmpts>
543 template<
class Form,
class Cmpt, direction Ncmpts>
555 template<
class Form,
class Cmpt, direction Ncmpts>
568 template<
class Form,
class Cmpt, direction Ncmpts>
581 template<
class Form,
class Cmpt, direction Ncmpts>
595 inline Type
dot(
const scalar
s,
const Type& t)
602 inline Type
dot(
const Type& t,
const scalar
s)
610 class Form1,
class Cmpt1,
direction Ncmpts1,
611 class Form2,
class Cmpt2,
direction Ncmpts2
619 return static_cast<const Form1&
>(t1) & static_cast<const Form2&>(t2);
623 template<
class Form,
class Cmpt, direction Ncmpts>
629 index = vs[index] > vs[i] ? index : i;
635 template<
class Form,
class Cmpt, direction Ncmpts>
641 index = vs[index] < vs[i] ? index : i;
649 template<
class Form,
class Cmpt, direction Ncmpts>
650 inline Form
operator-
661 template<
class Form,
class Cmpt, direction Ncmpts>
662 inline Form
operator+
673 template<
class Form,
class Cmpt, direction Ncmpts>
674 inline Form
operator-
686 template<
class Form,
class Cmpt, direction Ncmpts>
687 inline Form
operator*
699 template<
class Form,
class Cmpt, direction Ncmpts>
700 inline Form
operator*
712 template<
class Form,
class Cmpt, direction Ncmpts>
713 inline Form
operator/
752 template<
class Form,
class Cmpt, direction Ncmpts>
753 inline Cmpt
operator&&
759 Cmpt ddProd = vs1.
v_[0]*vs2.
v_[0];
762 ddProd += vs1.
v_[i]*vs2.
v_[i];
768 template<
class Form,
class Cmpt, direction Ncmpts>
769 inline bool operator==
778 if (!(eq &= (
equal(vs1.
v_[i], vs2.
v_[i]))))
break;
784 template<
class Form,
class Cmpt, direction Ncmpts>
785 inline bool operator!=
791 return !(vs1 == vs2);
795 template<
class Form,
class Cmpt, direction Ncmpts>
796 inline bool operator>
805 if (!(gt &= vs1.
v_[i] > vs2.
v_[i]))
break;
811 template<
class Form,
class Cmpt, direction Ncmpts>
812 inline bool operator<
821 if (!(lt &= vs1.
v_[i] < vs2.
v_[i]))
break;
827 template<
class Form,
class Cmpt, direction Ncmpts>
828 inline bool operator>=
838 template<
class Form,
class Cmpt, direction Ncmpts>
839 inline bool operator<=
static void opVS(V &vs, const V1 &vs1, const S &s, Op o)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void eqOpS(V &vs, const S &s, EqOp eo)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Traits classes for inner and outer products of primitives.
VectorSpace()
Construct null.
Cmpt cmptSum(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Traits class for primitives.
Combination-Reduction operation for a parallel run.
label findMin(const ListType &, const label start=0)
Find index of min element (and less than given element).
void replace(const direction, const Cmpt &)
const dimensionedScalar & c
Speed of light in a vacuum.
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 > &)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
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))
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
static void SeqOp(S &s, const V &vs, EqOp eo)
void operator=(const Foam::zero)
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 > &)
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Scalar cmptSqr(const Scalar s)
static direction size()
Return the number of elements in the VectorSpace = Ncmpts.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
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)
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
bool equal(const T &s1, const T &s2)
static void opSV(V &vs, const S &s, const V1 &vs1, Op o)
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 used to avoid unnecessary manipulations for objects that are kn...
dimensioned< scalar > mag(const dimensioned< Type > &)
static void eqOp(V1 &vs1, const V2 &vs2, EqOp eo)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
static void op(V &vs, const V1 &vs1, const V1 &vs2, Op o)
label & setComponent(label &l, const direction)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 2 >::type type
Cmpt v_[Ncmpts]
The components of this vector space.