16#ifndef BT_DEFORMABLE_LAGRANGIAN_FORCE_H
17#define BT_DEFORMABLE_LAGRANGIAN_FORCE_H
35 return low +
static_cast<double>(rand()) / RAND_MAX * (high - low);
139 for (
int i = 0;
i < dphi_dx.
size(); ++
i)
141 dphi_dx[
i].setZero();
161 for (
int i = 0;
i < dx.
size(); ++
i)
169 for (
int it = 0; it < 10; ++it)
171 for (
int i = 0;
i < dx.
size(); ++
i)
178 for (
int i = 0;
i < dx.
size(); ++
i)
180 dphi += dphi_dx[
i].dot(dx[
i]);
188 psb->
m_nodes[j].m_q =
x[counter] + dx[counter];
201 psb->
m_nodes[j].m_q =
x[counter] - dx[counter];
222 double error = f1 - f2 - 2 * dphi;
224 std::cout <<
"Iteration = " << it <<
", f1 = " << f1 <<
", f2 = " << f2 <<
", error = " <<
error << std::endl;
226 for (
int i = 1;
i < errors.
size(); ++
i)
228 std::cout <<
"Iteration = " <<
i <<
", ratio = " << errors[
i - 1] / errors[
i] << std::endl;
270 for (
int i = 0;
i < dx.
size(); ++
i)
278 for (
int it = 0; it < 10; ++it)
280 for (
int i = 0;
i < dx.
size(); ++
i)
286 for (
int i = 0;
i < df.
size(); ++
i)
301 psb->
m_nodes[j].m_q =
x[counter] + dx[counter];
316 psb->
m_nodes[j].m_q =
x[counter] - dx[counter];
339 for (
int i = 0;
i < df.
size(); ++
i)
342 error += error_vector.length2();
346 std::cout <<
"Iteration = " << it <<
", error = " <<
error << std::endl;
348 for (
int i = 1;
i < errors.
size(); ++
i)
350 std::cout <<
"Iteration = " <<
i <<
", ratio = " << errors[
i - 1] / errors[
i] << std::endl;
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
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())
SIMD_FORCE_INLINE void push_back(const T &_Val)
static void error(const char *str)