Commit 763a8458 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Streamline setup of the hessianSpecP and hessianSpecM variables

It is not worth doing this change for the efficiency gain alone
(it is not measurable).  But the new code is simpler, too.
parent 5571eb88
Pipeline #8671 passed with stage
in 4 minutes and 19 seconds
......@@ -232,24 +232,25 @@ public:
auto damagedSigSpec = Gradient::damagedSigSpec(state,eigen,eigenV, sigP, sigM);
// psi,{eps eps} in spectral space
FieldMatrix<double, dim,dim> hessianSpecP(0.0);
FieldMatrix<double, dim,dim> hessianSpecM(0.0);
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = f__->traceEps(state);
if (trEps>0) {
hessianSpecP = f__->lambda_;
hessianSpecM = 0;
} else {
hessianSpecP = 0.0;
hessianSpecM = f__->lambda_;
}
for (std::size_t i=0;i < dim; ++i)
{
for (std::size_t j=0;j < dim; ++j)
{
if (trEps>0)
hessianSpecP[i][j] = f__->lambda_;
else
hessianSpecM[i][j] = f__->lambda_;
if (eigen[i]>0 )
hessianSpecP[i][j] += 2.0*f__->mu_*(i==j);
else
hessianSpecM[i][j] += 2.0*f__->mu_*(i==j);
}
}
{
if (eigen[i]>0 )
hessianSpecP[i][i] += 2.0*f__->mu_;
else
hessianSpecM[i][i] += 2.0*f__->mu_;
}
// degrade only tensile part
FieldMatrix<double, dim,dim> hessianSpec = hessianSpecP * f__->degradation(state)
......@@ -335,23 +336,24 @@ public:
auto damagedSigSpec = Gradient::damagedSigSpec(jet,eigen,eigenV);
// psi,{eps eps} in spectral space
FieldMatrix<double, dim,dim> hessianSpecP(0.0);
FieldMatrix<double, dim,dim> hessianSpecM(0.0);
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = f__->traceEps(jet);
if (trEps>0) {
hessianSpecP = f__->lambda_;
hessianSpecM = 0;
} else {
hessianSpecP = 0.0;
hessianSpecM = f__->lambda_;
}
for (std::size_t i=0;i < dim; ++i)
{
for (std::size_t j=0;j < dim; ++j)
{
if (trEps>0)
hessianSpecP[i][j] = f__->lambda_;
else
hessianSpecM[i][j] = f__->lambda_;
if (eigen[i]>0 )
hessianSpecP[i][j] += 2.0*f__->mu_*(i==j);
hessianSpecP[i][i] += 2.0*f__->mu_;
else
hessianSpecM[i][j] += 2.0*f__->mu_*(i==j);
}
hessianSpecM[i][i] += 2.0*f__->mu_;
}
// degrade only tensile part
......
Supports Markdown
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