Commit a78a46e7 authored by Henry's avatar Henry
Browse files

symmTensor: Corrected symmTensor & symmTensor dot-product

parent 29d4f2ff
......@@ -50,10 +50,14 @@ int main()
<< (t1 & t7 & t1.T()) << " " << transform(t1, t7) << endl;
symmTensor st1(1, 2, 3, 4, 5, 6);
symmTensor st2(7, 8, 9, 10, 11, 12);
Info<< "Check symmetric transformation "
<< transform(t1, st1) << endl;
Info<< "Check for dot product of symmetric tensors "
<< (st1 & st2) << endl;
vector v1(1, 2, 3);
Info<< sqr(v1) << endl;
......
......@@ -55,6 +55,9 @@ UNARY_FUNCTION(symmTensor, symmTensor, inv)
UNARY_OPERATOR(vector, symmTensor, *, hdual)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -65,6 +65,9 @@ UNARY_FUNCTION(symmTensor, symmTensor, inv)
UNARY_OPERATOR(vector, symmTensor, *, hdual)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -164,6 +164,9 @@ tmp<Field<symmTensor> > transformFieldMask<symmTensor>
UNARY_OPERATOR(vector, symmTensor, *, hdual)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -39,6 +39,7 @@ SourceFiles
#include "vectorField.H"
#include "sphericalTensor.H"
#include "symmTensor.H"
#include "tensor.H"
#define TEMPLATE
#include "FieldFunctionsM.H"
......@@ -69,6 +70,9 @@ UNARY_FUNCTION(symmTensor, symmTensor, inv)
UNARY_OPERATOR(vector, symmTensor, *, hdual)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -53,6 +53,9 @@ UNARY_FUNCTION(symmTensor, symmTensor, inv, inv)
UNARY_OPERATOR(vector, symmTensor, *, hdual, transform)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, '&', dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, '&', dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -65,6 +65,10 @@ UNARY_FUNCTION(symmTensor, symmTensor, inv, inv)
UNARY_OPERATOR(vector, symmTensor, *, hdual, transform)
BINARY_OPERATOR(tensor, symmTensor, symmTensor, &, '&', dot)
BINARY_TYPE_OPERATOR(tensor, symmTensor, symmTensor, &, '&', dot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "Vector.H"
#include "Tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -184,18 +185,21 @@ inline Vector<Cmpt> operator*(const SymmTensor<Cmpt>& st)
//- Inner-product between two symmetric tensors
template <class Cmpt>
inline SymmTensor<Cmpt>
inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const SymmTensor<Cmpt>& st2)
{
return SymmTensor<Cmpt>
return Tensor<Cmpt>
(
st1.xx()*st2.xx() + st1.xy()*st2.xy() + st1.xz()*st2.xz(),
st1.xx()*st2.xy() + st1.xy()*st2.yy() + st1.xz()*st2.yz(),
st1.xx()*st2.xz() + st1.xy()*st2.yz() + st1.xz()*st2.zz(),
st1.xy()*st2.xx() + st1.yy()*st2.xy() + st1.yz()*st2.xz(),
st1.xy()*st2.xy() + st1.yy()*st2.yy() + st1.yz()*st2.yz(),
st1.xy()*st2.xz() + st1.yy()*st2.yz() + st1.yz()*st2.zz(),
st1.xz()*st2.xx() + st1.yz()*st2.xy() + st1.zz()*st2.xz(),
st1.xz()*st2.xy() + st1.yz()*st2.yy() + st1.zz()*st2.yz(),
st1.xz()*st2.xz() + st1.yz()*st2.yz() + st1.zz()*st2.zz()
);
}
......
......@@ -40,13 +40,15 @@ SourceFiles
#include "Vector.H"
#include "SphericalTensor.H"
#include "SymmTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Cmpt>
class SymmTensor;
/*---------------------------------------------------------------------------*\
Class Tensor Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "SymmTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment