enabled mass preconditioner
This commit is contained in:
@@ -104,7 +104,9 @@ public:
|
||||
TVStack c;
|
||||
c.resize(a.size());
|
||||
for (int i = 0; i < a.size(); ++i)
|
||||
{
|
||||
c[i] = a[i] - b[i];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "btDeformableBackwardEulerObjective.h"
|
||||
#include "btPreconditioner.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
|
||||
btDeformableBackwardEulerObjective::btDeformableBackwardEulerObjective(btAlignedObjectArray<btSoftBody *>& softBodies, const TVStack& backup_v)
|
||||
@@ -22,7 +23,7 @@ btDeformableBackwardEulerObjective::btDeformableBackwardEulerObjective(btAligned
|
||||
, m_backupVelocity(backup_v)
|
||||
, m_implicit(false)
|
||||
{
|
||||
m_preconditioner = new DefaultPreconditioner();
|
||||
m_preconditioner = new MassPreconditioner(m_softBodies);
|
||||
}
|
||||
|
||||
btDeformableBackwardEulerObjective::~btDeformableBackwardEulerObjective()
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
btDeformableBodySolver::btDeformableBodySolver()
|
||||
: m_numNodes(0)
|
||||
, m_cg(50)
|
||||
, m_cg(20)
|
||||
, m_maxNewtonIterations(5)
|
||||
, m_newtonTolerance(1e-10)
|
||||
, m_newtonTolerance(1e-4)
|
||||
{
|
||||
m_objective = new btDeformableBackwardEulerObjective(m_softBodySet, m_backupVelocity);
|
||||
}
|
||||
|
||||
@@ -236,12 +236,14 @@ void btDeformableContactProjection::setConstraints()
|
||||
bool single_contact = true;
|
||||
if (single_contact)
|
||||
{
|
||||
constraints.m_contact[0]->m_cti.m_offset > cti.m_offset;
|
||||
constraints.replace(c);
|
||||
if (constraints.m_contact[0]->m_cti.m_offset > cti.m_offset)
|
||||
{
|
||||
constraints.replace(c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
constraints.append(c);
|
||||
constraints.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,9 @@ public:
|
||||
btAssert(b.size() == x.size());
|
||||
btAssert(m_inv_mass.size() == x.size());
|
||||
for (int i = 0; i < b.size(); ++i)
|
||||
{
|
||||
b[i] = x[i] * m_inv_mass[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user