16#ifndef BT_PRECONDITIONER_H
17#define BT_PRECONDITIONER_H
34 for (
int i = 0; i < b.
size(); ++i)
115 for (
int d = 0; d < 3; ++d)
126 for (
int d = 0; d < 3; ++d)
148 printf(
"implicit not implemented\n");
151 for (
int i = 0; i <
m_lf.
size(); ++i)
154 m_lf[i]->buildDampingForceDifferentialDiagonal(-
m_dt,
diagA);
166 for (
int j = 0;
j <
lm.m_num_constraints; ++
j)
168 for (
int i = 0; i <
lm.m_num_nodes; ++i)
170 for (
int d = 0; d < 3; ++d)
172 t[
j] +=
inv_A[
lm.m_indices[i]][d] *
lm.m_dirs[
j][d] *
lm.m_dirs[
j][d] *
lm.m_weights[i] *
lm.m_weights[i];
179#ifndef USE_FULL_PRECONDITIONER
213 for (
int d = 0; d <
lm.m_num_constraints; ++d)
215 for (
int i = 0; i <
lm.m_num_nodes; ++i)
217 b[
offset + c][d] +=
lm.m_weights[i] * b[
lm.m_indices[i]].dot(
lm.m_dirs[d]);
236 for (
int i = 0; i <
lm.m_num_nodes; ++i)
238 for (
int j = 0;
j <
lm.m_num_constraints; ++
j)
240 b[
lm.m_indices[i]] += b[
offset + c][
j] *
lm.m_weights[i] *
lm.m_dirs[
j];
247 b[i] = (x[i] - b[i]) *
m_inv_A[i];
264 for (
int i = 0; i <
lm.m_num_nodes; ++i)
266 for (
int j = 0;
j <
lm.m_num_constraints; ++
j)
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...
virtual void operator()(const TVStack &x, TVStack &b)
virtual void reinitialize(bool nodeUpdated)
virtual ~DefaultPreconditioner()
KKTPreconditioner(const btAlignedObjectArray< btSoftBody * > &softBodies, const btDeformableContactProjection &projections, const btAlignedObjectArray< btDeformableLagrangianForce * > &lf, const btScalar &dt, const bool &implicit)
void buildDiagonalA(TVStack &diagA) const
const btAlignedObjectArray< btSoftBody * > & m_softBodies
const btDeformableContactProjection & m_projections
virtual void reinitialize(bool nodeUpdated)
void buildDiagonalS(const TVStack &inv_A, TVStack &diagS)
const btAlignedObjectArray< btDeformableLagrangianForce * > & m_lf
virtual void operator()(const TVStack &x, TVStack &b)
const btAlignedObjectArray< btSoftBody * > & m_softBodies
virtual void reinitialize(bool nodeUpdated)
MassPreconditioner(const btAlignedObjectArray< btSoftBody * > &softBodies)
virtual void operator()(const TVStack &x, TVStack &b)
btAlignedObjectArray< btScalar > m_inv_mass
virtual void reinitialize(bool nodeUpdated)=0
btAlignedObjectArray< btVector3 > TVStack
virtual ~Preconditioner()
virtual void operator()(const TVStack &x, TVStack &b)=0
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void push_back(const T &_Val)
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
btVector3 can be used to represent 3D points and vectors.