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