add relative tolerance for linear solver and newton with line search

This commit is contained in:
Xuchen Han
2019-09-09 16:35:37 -07:00
committed by Xuchen Han
parent 36278edc00
commit 1bc75cc833
6 changed files with 167 additions and 15 deletions

View File

@@ -72,6 +72,24 @@ public:
{
return BT_GRAVITY_FORCE;
}
virtual double totalElasticEnergy()
{
double e = 0;
for (int i = 0; i<m_softBodies.size();++i)
{
btSoftBody* psb = m_softBodies[i];
for (int j = 0; j < psb->m_nodes.size(); ++j)
{
const btSoftBody::Node& node = psb->m_nodes[j];
if (node.m_im > 0)
{
e -= m_gravity.dot(node.m_q)/node.m_im;
}
}
}
return e;
}
};