Skip to content

Commit a79dcba

Browse files
committed
Fixed problem with "truss stretch" plot variable.
1 parent f815c24 commit a79dcba

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

FEBioMech/FEBioMechPlot.cpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ SOFTWARE.*/
6767
#include "FEStickyInterface.h"
6868
#include "FEReactiveVEMaterialPoint.h"
6969
#include "FELinearTrussDomain.h"
70+
#include "FEElasticTrussDomain.h"
7071
#include <FECore/FESurface.h>
7172
#include <FECore/FESurfaceLoad.h>
7273
#include <FECore/FETrussDomain.h>
@@ -4621,15 +4622,38 @@ bool FEPlotWeakBondDevSED::Save(FEDomain& dom, FEDataStream& a)
46214622
//-----------------------------------------------------------------------------
46224623
bool FEPlotTrussStretch::Save(FEDomain& dom, FEDataStream& a)
46234624
{
4624-
FETrussDomain* td = dynamic_cast<FETrussDomain*>(&dom);
4625-
if (td == nullptr) return false;
4625+
if (dynamic_cast<FELinearTrussDomain*>(&dom))
4626+
{
4627+
FELinearTrussDomain* td = dynamic_cast<FELinearTrussDomain*>(&dom);
4628+
for (int i = 0; i < td->Elements(); ++i)
4629+
{
4630+
FETrussElement& el = td->Element(i);
46264631

4627-
for (int i = 0; i < td->Elements(); ++i)
4632+
double lam = 0.0;
4633+
int nint = el.GaussPoints();
4634+
for (int n = 0; n < nint; ++n)
4635+
{
4636+
// get the material point
4637+
FEMaterialPoint& mp = *el.GetMaterialPoint(n);
4638+
FETrussMaterialPoint& pt = *(mp.ExtractData<FETrussMaterialPoint>());
4639+
lam += pt.m_lam;
4640+
}
4641+
lam /= (double)nint;
4642+
a << lam;
4643+
}
4644+
return true;
4645+
}
4646+
else if (dynamic_cast<FEElasticTrussDomain*>(&dom))
46284647
{
4629-
FETrussElement& el = td->Element(i);
4630-
a << el.m_lam;
4648+
FEElasticTrussDomain* td = dynamic_cast<FEElasticTrussDomain*>(&dom);
4649+
for (int i = 0; i < td->Elements(); ++i)
4650+
{
4651+
FETrussElement& el = td->Element(i);
4652+
a << el.m_lam;
4653+
}
4654+
return true;
46314655
}
4632-
return true;
4656+
return false;
46334657
}
46344658

46354659
//=============================================================================

0 commit comments

Comments
 (0)