From 3c48d7c054663417805b80d54ef6dae335b7fdec Mon Sep 17 00:00:00 2001 From: timovanopstal Date: Wed, 11 May 2016 15:06:37 +0200 Subject: [PATCH 1/2] add: expected behavior of double*Tensor --- src/Utility/Tensor.C | 12 ++++++++++++ src/Utility/Tensor.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/Utility/Tensor.C b/src/Utility/Tensor.C index 2d3489067..0f977a907 100644 --- a/src/Utility/Tensor.C +++ b/src/Utility/Tensor.C @@ -710,6 +710,18 @@ Tensor operator* (const Tensor& A, const Tensor& B) } +Tensor operator*(const double c, const Tensor& T) +{ + Tensor C(T.n); + + for (int i = 1; i <= C.n; ++i) + for (int j = 1; j <= C.n; ++j) + C(i,j) = c*T(i,j); + + return C; +} + + std::ostream& SymmTensor::print (std::ostream& os) const { switch (n) { diff --git a/src/Utility/Tensor.h b/src/Utility/Tensor.h index 0fc0e3757..d5b8f9173 100644 --- a/src/Utility/Tensor.h +++ b/src/Utility/Tensor.h @@ -150,6 +150,8 @@ class Tensor friend Vec3 operator*(const Vec3& v, const Tensor& T); //! \brief Multiplication between two tensors. friend Tensor operator*(const Tensor& A, const Tensor& B); + //! \brief Scaling of a tensor. + friend Tensor operator*(const double c, const Tensor& T); //! \brief Output stream operator. friend std::ostream& operator<<(std::ostream& os, const Tensor& T) From 789de76e89ab95e0fa3a63057a186e3499755c8c Mon Sep 17 00:00:00 2001 From: timovanopstal Date: Wed, 11 May 2016 15:07:57 +0200 Subject: [PATCH 2/2] add: hessian computation mixed --- src/ASM/ASMs2Dmx.C | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ASM/ASMs2Dmx.C b/src/ASM/ASMs2Dmx.C index 1d7cd3256..522d06801 100644 --- a/src/ASM/ASMs2Dmx.C +++ b/src/ASM/ASMs2Dmx.C @@ -537,6 +537,7 @@ bool ASMs2Dmx::integrate (Integrand& integrand, std::vector dNxdu(m_basis.size()); std::vector d2Nxdu2(m_basis.size()); Matrix3D Hess; + double dXidu[2]; Matrix Xnod, Jac; Vec4 X; for (size_t i = 0; i < threadGroups[g][t].size() && ok; ++i) @@ -566,6 +567,13 @@ bool ASMs2Dmx::integrate (Integrand& integrand, if (useElmVtx) this->getElementCorners(i1-1,i2-1,fe.XC); + if (integrand.getIntegrandType() & Integrand::G_MATRIX) + { + // Element size in parametric space + dXidu[0] = surf->knotSpan(0,i1-1); + dXidu[1] = surf->knotSpan(1,i2-1); + } + // Initialize element quantities LocalIntegral* A = integrand.getLocalIntegral(elem_sizes,fe.iel,false); if (!integrand.initElement(MNPC[iel-1],elem_sizes,nb,*A)) @@ -613,11 +621,15 @@ bool ASMs2Dmx::integrate (Integrand& integrand, fe.grad(geoBasis), true)) ok = false; for (size_t b = 0; b < m_basis.size() && ok; ++b) - if ((int)b != geoBasis && !utl::Hessian(Hess,fe.hess(b+1),Jac,Xnod,d2Nxdu2[b], - fe.grad(b+1), false)) - ok = false; + if ((int)b != geoBasis) + if (!utl::Hessian(Hess,fe.hess(b+1),Jac,Xnod,d2Nxdu2[b], fe.grad(b+1), false)) + ok = false; } + // Compute G-matrix + if (integrand.getIntegrandType() & Integrand::G_MATRIX) + utl::getGmat(Jac,dXidu,fe.G); + if (fe.detJxW == 0.0) continue; // skip singular points // Cartesian coordinates of current integration point