16 #ifndef BT_LINEAR_ELASTICITY_H
17 #define BT_LINEAR_ELASTICITY_H
22 #define TETRA_FLAT_THRESHOLD 0.01
105 if (!psb->isActive())
117 size_t id0 = node0->
index;
118 size_t id1 = node1->
index;
119 size_t id2 = node2->
index;
120 size_t id3 = node3->
index;
128 btMatrix3x3 dP = (dF + dF.transpose()) * mu_damp +
I * ((dF[0][0] + dF[1][1] + dF[2][2]) * lambda_damp);
134 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
137 force[id0] -= scale1 * df_on_node0;
138 force[id1] -= scale1 * df_on_node123.getColumn(0);
139 force[id2] -= scale1 * df_on_node123.getColumn(1);
140 force[id3] -= scale1 * df_on_node123.getColumn(2);
145 size_t id =
node.index;
160 if (!psb->isActive())
182 if (!psb->isActive())
192 dampingForce.
resize(sz + 1);
193 for (
int i = 0; i < dampingForce.
size(); ++i)
202 energy -= dampingForce[
node.index].dot(
node.m_v) / dt;
226 if (!psb->isActive())
241 btScalar trPTP = (
P[0].length2() +
P[1].length2() +
P[2].length2());
242 if (trPTP > max_p * max_p)
247 sigma[0] =
btMin(sigma[0], max_p);
248 sigma[1] =
btMin(sigma[1], max_p);
249 sigma[2] =
btMin(sigma[2], max_p);
250 sigma[0] =
btMax(sigma[0], -max_p);
251 sigma[1] =
btMax(sigma[1], -max_p);
252 sigma[2] =
btMax(sigma[2], -max_p);
255 Sigma[0][0] = sigma[0];
256 Sigma[1][1] = sigma[1];
257 Sigma[2][2] = sigma[2];
258 P =
U * Sigma *
V.transpose();
264 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
270 size_t id0 = node0->
index;
271 size_t id1 = node1->
index;
272 size_t id2 = node2->
index;
273 size_t id3 = node3->
index;
277 force[id0] -= scale1 * force_on_node0;
278 force[id1] -= scale1 * force_on_node123.getColumn(0);
279 force[id2] -= scale1 * force_on_node123.getColumn(1);
280 force[id3] -= scale1 * force_on_node123.getColumn(2);
300 if (!psb->isActive())
312 size_t id0 = node0->
index;
313 size_t id1 = node1->
index;
314 size_t id2 = node2->
index;
315 size_t id3 = node3->
index;
323 btMatrix3x3 dP = (dF + dF.transpose()) * mu_damp +
I * ((dF[0][0] + dF[1][1] + dF[2][2]) * lambda_damp);
329 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
333 df[id0] -= scale1 * df_on_node0;
334 df[id1] -= scale1 * df_on_node123.getColumn(0);
335 df[id2] -= scale1 * df_on_node123.getColumn(1);
336 df[id3] -= scale1 * df_on_node123.getColumn(2);
341 size_t id =
node.index;
358 if (!psb->isActive())
369 size_t id0 = node0->
index;
370 size_t id1 = node1->
index;
371 size_t id2 = node2->
index;
372 size_t id3 = node3->
index;
378 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
382 df[id0] -= scale1 * df_on_node0;
383 df[id1] -= scale1 * df_on_node123.getColumn(0);
384 df[id2] -= scale1 * df_on_node123.getColumn(1);
385 df[id3] -= scale1 * df_on_node123.getColumn(2);
403 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
413 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
423 if (!psb->isActive())
433 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
void singularValueDecomposition(const btMatrix2x2 &A, GivensRotation &U, const btMatrix2x2 &Sigma, GivensRotation &V, const btScalar tol=64 *std::numeric_limits< btScalar >::epsilon())
2x2 SVD (singular value decomposition) A=USV'
void setZero()
Set the matrix to the identity.
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
static const btMatrix3x3 & getIdentity()
SIMD_FORCE_INLINE const T & btMin(const T &a, const T &b)
SIMD_FORCE_INLINE const T & btMax(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
static btMatrix3x3 OuterProduct(const btScalar *v1, const btScalar *v2, const btScalar *v3, const btScalar *u1, const btScalar *u2, const btScalar *u3, int ndof)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void resize(int newsize, const T &fillData=T())
btAlignedObjectArray< TetraScratch > m_tetraScratches
static const pxr::TfToken density("density", pxr::TfToken::Immortal)
btMatrix3x3 m_effectiveMass
btScalar m_element_measure
CCL_NAMESPACE_BEGIN struct Window V