Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorover0219 <over0219@umn.edu>2020-06-10 22:46:02 +0300
committerover0219 <over0219@umn.edu>2020-06-10 22:46:02 +0300
commit2ace45220db036c448c223286926e1526165fc5d (patch)
treed12a297087cddbc846cb1feeaa3ec545b308f0e3 /extern/softbody/src/admmpd_solver.h
parent5df366870579a86edf975f97f4afa197d4071d47 (diff)
cache working but lots of copies
Diffstat (limited to 'extern/softbody/src/admmpd_solver.h')
-rw-r--r--extern/softbody/src/admmpd_solver.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/extern/softbody/src/admmpd_solver.h b/extern/softbody/src/admmpd_solver.h
index 970cbfb6368..0305d535f39 100644
--- a/extern/softbody/src/admmpd_solver.h
+++ b/extern/softbody/src/admmpd_solver.h
@@ -17,6 +17,9 @@ struct Options {
int max_cg_iters;
double mult_k; // stiffness multiplier for constraints
double min_res; // min residual for CG solver
+ double density_kgm3; // unit-volume density
+ double youngs; // Young's modulus
+ double poisson; // Poisson ratio
Eigen::Vector3d grav;
Options() :
timestep_s(1.0/100.0), // TODO: Figure out delta time from blender api
@@ -24,18 +27,21 @@ struct Options {
max_cg_iters(10),
mult_k(1.0),
min_res(1e-4),
+ density_kgm3(1100),
+ youngs(10000000),
+ poisson(0.399),
grav(0,0,-9.8)
{}
};
struct Data {
- // Input:
+ // Set from input
Eigen::MatrixXi tets; // elements t x 4
Eigen::MatrixXd x; // vertices, n x 3
- Eigen::MatrixXd v; // velocity, n x 3 TODO: from cache
+ Eigen::MatrixXd v; // velocity, n x 3
// Set in compute_matrices:
Eigen::MatrixXd x_start; // x at beginning of timestep, n x 3
- Eigen::VectorXd m; // masses, n x 1 TODO: from BodyPoint
+ Eigen::VectorXd m; // masses, n x 1
Eigen::MatrixXd z; // ADMM z variable
Eigen::MatrixXd u; // ADMM u aug lag with W inv
Eigen::MatrixXd M_xbar; // M*(x + dt v)
@@ -43,13 +49,20 @@ struct Data {
Eigen::MatrixXd b; // M xbar + DtW2(z-u)
template <typename T> using RowSparseMatrix = Eigen::SparseMatrix<T,Eigen::RowMajor>;
RowSparseMatrix<double> D; // reduction matrix
- RowSparseMatrix<double> Dt; // transpose reduction matrix
RowSparseMatrix<double> DtW2; // D'W^2
RowSparseMatrix<double> A; // M + D'W^2D
RowSparseMatrix<double> K[3]; // constraint Jacobian
Eigen::VectorXd l; // constraint rhs (Kx=l)
+ double spring_k; // constraint stiffness
Eigen::SimplicialLDLT<Eigen::SparseMatrix<double> > ldltA;
- double spring_k;
+ struct CGData { // Temporaries used in conjugate gradients
+ RowSparseMatrix<double> A[3]; // (M + D'W^2D) + k * Kt K
+ Eigen::MatrixXd b; // M xbar + DtW2(z-u) + Kt l
+ Eigen::MatrixXd r; // residual
+ Eigen::MatrixXd z;
+ Eigen::MatrixXd p;
+ Eigen::MatrixXd Ap; // A * p
+ } cgdata;
// Set in append_energies:
std::vector<Eigen::Vector2i> indices; // per-energy index into D (row, num rows)
std::vector<double> rest_volumes; // per-energy rest volume