Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/ASM/ASMs2Dmx.C
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ bool ASMs2Dmx::integrate (Integrand& integrand,
std::vector<Matrix> dNxdu(m_basis.size());
std::vector<Matrix3D> 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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/Utility/Tensor.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we already have the *= operator defined, this can be done better(?) just like this:
{
Tensor C(T);
return C *= c;
}

and use Real instead of double to be consistent with the rest of this class.

std::ostream& SymmTensor::print (std::ostream& os) const
{
switch (n) {
Expand Down
2 changes: 2 additions & 0 deletions src/Utility/Tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down