mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cmptProduct function, i.e. cmptProduct(vector(a, b, c)) = a*b*c.
This commit is contained in:
@ -27,7 +27,11 @@ int main()
|
|||||||
Info<< magSqr(d) << endl;
|
Info<< magSqr(d) << endl;
|
||||||
|
|
||||||
vector d2(0.5, 0.51, -0.5);
|
vector d2(0.5, 0.51, -0.5);
|
||||||
Info<< cmptMax(d2) << " " << cmptSum(d2) << " " << cmptMag(d2) << endl;
|
Info<< cmptMax(d2) << " "
|
||||||
|
<< cmptSum(d2) << " "
|
||||||
|
<< cmptProduct(d2) << " "
|
||||||
|
<< cmptMag(d2)
|
||||||
|
<< endl;
|
||||||
Info<< min(d, d2) << endl;
|
Info<< min(d, d2) << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -406,6 +406,17 @@ inline Cmpt cmptAv
|
|||||||
return cmptSum(vs)/nCmpt;
|
return cmptSum(vs)/nCmpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Form, class Cmpt, int nCmpt>
|
||||||
|
inline Cmpt cmptProduct
|
||||||
|
(
|
||||||
|
const VectorSpace<Form, Cmpt, nCmpt>& vs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Cmpt product = vs.v_[0];
|
||||||
|
VectorSpaceOps<nCmpt,1>::SeqOp(product, vs, multiplyEqOp<Cmpt>());
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Form, class Cmpt, int nCmpt>
|
template<class Form, class Cmpt, int nCmpt>
|
||||||
inline Form cmptMag
|
inline Form cmptMag
|
||||||
|
|||||||
Reference in New Issue
Block a user