no need to save the reduced mass matrix because it's always diagonal

This commit is contained in:
jingyuc 2021-11-16 17:41:35 -05:00
parent 18f81dcaea
commit 2d08d4047a
3 changed files with 7 additions and 8 deletions

View File

@ -263,10 +263,10 @@ void btReducedSoftBody::updateReducedVelocity(btScalar solverdt)
// update reduced velocity
for (int r = 0; r < m_nReduced; ++r)
{
btScalar mass_inv = (m_Mr[r] == 0) ? 0 : 1.0 / m_Mr[r]; // TODO: this might be redundant, because Mr is identity
// the reduced mass is always identity!
btScalar delta_v = 0;
delta_v = solverdt * mass_inv * (m_reducedForceElastic[r] + m_reducedForceDamping[r]);
// delta_v = solverdt * mass_inv * (m_reducedForceElastic[r] + m_reducedForceDamping[r] + m_reducedForceExternal[r]);
delta_v = solverdt * (m_reducedForceElastic[r] + m_reducedForceDamping[r]);
// delta_v = solverdt * (m_reducedForceElastic[r] + m_reducedForceDamping[r] + m_reducedForceExternal[r]);
m_reducedVelocity[r] = m_reducedVelocityBuffer[r] + delta_v;
}
}
@ -669,8 +669,8 @@ void btReducedSoftBody::internalApplyFullSpaceImpulse(const btVector3& impulse,
// delta reduced velocity
for (int r = 0; r < m_nReduced; ++r)
{
btScalar mass_inv = (m_Mr[r] == 0) ? 0 : 1.0 / m_Mr[r]; // TODO: this might be redundant, because Mr is identity
m_internalDeltaReducedVelocity[r] += dt * mass_inv * (m_reducedForceDamping[r] + m_reducedForceExternal[r]);
// The reduced mass is always identity!
m_internalDeltaReducedVelocity[r] += dt * (m_reducedForceDamping[r] + m_reducedForceExternal[r]);
}
}

View File

@ -84,7 +84,6 @@ class btReducedSoftBody : public btSoftBody
tDenseArray m_reducedForceDamping; // reduced internal damping force
tDenseArray m_eigenvalues; // eigenvalues of the reduce deformable model
tDenseArray m_Kr; // reduced stiffness matrix
tDenseArray m_Mr; // reduced mass matrix //TODO: do we need this?
// full space
TVStack m_x0; // Rest position

View File

@ -160,8 +160,8 @@ void btReducedSoftBodyHelpers::readReducedDeformableInfoFromFiles(btReducedSoftB
std::string Kr_file = std::string(file_path) + "K_r_diag_mat.bin";
btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Kr, rsb->m_nReduced, Kr_file.c_str());
std::string Mr_file = std::string(file_path) + "M_r_diag_mat.bin";
btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Mr, rsb->m_nReduced, Mr_file.c_str());
// std::string Mr_file = std::string(file_path) + "M_r_diag_mat.bin";
// btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Mr, rsb->m_nReduced, Mr_file.c_str());
std::string modes_file = std::string(file_path) + "modes.bin";
btReducedSoftBodyHelpers::readBinaryMat(rsb->m_modes, rsb->m_nReduced, 3 * rsb->m_nFull, modes_file.c_str());