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:
parent
dc14168e2f
commit
f06ee1b252
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user