bugfixes in SymmTensor/scalar multiplication operator and in evaluation of basis2-fields in mixed splines framework

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@928 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2011-05-05 17:17:42 +00:00 committed by Knut Morten Okstad
parent dc14168e2f
commit f06ee1b252
4 changed files with 48 additions and 32 deletions

View File

@ -759,10 +759,11 @@ bool ASMs2Dmx::evalSolution (Matrix& sField, const Vector& locSol,
if (nc2 > 0)
{
ip.clear();
scatterInd(m1,m2,q1,q2,spline1[i].left_idx,ip);
scatterInd(m1,m2,q1,q2,spline2[i].left_idx,ip);
utl::gather(ip,nc2,locSol,Xtmp,nc1*nb1);
Xtmp.multiply(spline2[i].basisValues,Ztmp);
Ytmp.insert(Ytmp.end(),Ztmp.begin(),Ztmp.end());
}
sField.fillColumn(1+i,Ytmp);

View File

@ -833,10 +833,11 @@ bool ASMs3Dmx::evalSolution (Matrix& sField, const Vector& locSol,
if (nc2 > 0)
{
ip.clear();
scatterInd(m1,m2,m3,q1,q2,q3,spline1[i].left_idx,ip);
scatterInd(m1,m2,m3,q1,q2,q3,spline2[i].left_idx,ip);
utl::gather(ip,nc2,locSol,Xtmp,nc1*nb1);
Xtmp.multiply(spline2[i].basisValues,Ztmp);
Ytmp.insert(Ytmp.end(),Ztmp.begin(),Ztmp.end());
}
sField.fillColumn(1+i,Ytmp);

View File

@ -515,7 +515,7 @@ SymmTensor& SymmTensor::rightCauchyGreen (const Tensor& F)
case 1:
v[0] = F(1,1)*F(1,1);
break;
case 2:
v[0] = F(1,1)*F(1,1) + F(2,1)*F(2,1);
v[1] = F(1,2)*F(1,2) + F(2,2)*F(2,2);
@ -573,16 +573,9 @@ real SymmTensor::vonMises () const
}
SymmTensor operator* (real a, const SymmTensor& T)
{
SymmTensor S(T.dim());
for (Tensor::t_ind i = 0; i < T.v.size(); i++)
S.v[i] = a*T.v[i];
return S;
}
/*!
\brief Adding a scaled unit tensor to a symmetric tensor.
*/
SymmTensor operator+ (const SymmTensor& T, real a)
{
@ -598,6 +591,10 @@ SymmTensor operator+ (const SymmTensor& T, real a)
}
/*!
\brief Subtracting a scaled unit tensor from a symmetric tensor.
*/
SymmTensor operator- (const SymmTensor& T, real a)
{
SymmTensor S(T);
@ -612,6 +609,21 @@ SymmTensor operator- (const SymmTensor& T, real a)
}
/*!
\brief Multiplication between a scalar and a symmetric tensor.
*/
SymmTensor operator* (real a, const SymmTensor& T)
{
SymmTensor S(T.dim(), T.v.size() == 4);
for (Tensor::t_ind i = 0; i < T.v.size(); i++)
S.v[i] = a*T.v[i];
return S;
}
SymmTensor4::SymmTensor4 (const std::vector<real>& x, t_ind nsd)
: n(nsd), m(0), v(x)
{

View File

@ -204,33 +204,35 @@ public:
// Global operators
//! \brief Multiplication between a scalar and a symmetric tensor.
friend SymmTensor operator*(real a, const SymmTensor& T);
//! \brief Inner-product of two symmetric tensors.
friend real operator*(const SymmTensor& A, const SymmTensor& B)
{
return A.innerProd(B);
}
//! \brief Adding a scaled unit tensor to a symmetric tensor.
friend SymmTensor operator+(const SymmTensor& T, real a);
//! \brief Subtracting a scaled unit tensor from a symmetric tensor.
friend SymmTensor operator-(const SymmTensor& T, real a);
//! \brief Adding two symmetric tensors.
friend SymmTensor operator+(const SymmTensor& A, const SymmTensor& B)
{
SymmTensor C(A); C += B; return C;
}
//! \brief Subtracting two symmetric tensors.
friend SymmTensor operator-(const SymmTensor& A, const SymmTensor& B)
{
SymmTensor C(A); C -= B; return C;
}
//! \brief Multiplication between a scalar and a symmetric tensor.
friend SymmTensor operator*(real a, const SymmTensor& T);
};
//! \brief Adding two symmetric tensors.
inline SymmTensor operator+(const SymmTensor& A, const SymmTensor& B)
{
SymmTensor C(A); C += B; return C;
}
//! \brief Subtracting two symmetric tensors.
inline SymmTensor operator-(const SymmTensor& A, const SymmTensor& B)
{
SymmTensor C(A); C -= B; return C;
}
//! \brief Inner-product of two symmetric tensors.
inline real operator*(const SymmTensor& A, const SymmTensor& B)
{
return A.innerProd(B);
}
/*!
\brief Simple class for representing a symmetric fourth-order tensor.
*/