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-23 02:45:38 +0300
committerover0219 <over0219@umn.edu>2020-06-23 02:45:38 +0300
commit50e2c479cc22d0efd1d744720df64311d8fefb80 (patch)
treee365a96638e2bf2f347db8a3f85802bedee4ef42 /extern/softbody/src/admmpd_solver.h
parentc214acce20b6066dd8b0f70dfa16a597059358a6 (diff)
changed up interface for lattice a bit
Diffstat (limited to 'extern/softbody/src/admmpd_solver.h')
-rw-r--r--extern/softbody/src/admmpd_solver.h65
1 files changed, 1 insertions, 64 deletions
diff --git a/extern/softbody/src/admmpd_solver.h b/extern/softbody/src/admmpd_solver.h
index e61ddfeb82e..229411ae340 100644
--- a/extern/softbody/src/admmpd_solver.h
+++ b/extern/softbody/src/admmpd_solver.h
@@ -4,75 +4,12 @@
#ifndef ADMMPD_SOLVER_H_
#define ADMMPD_SOLVER_H_
-#include <Eigen/Geometry>
-#include <Eigen/Sparse>
-#include <Eigen/SparseCholesky>
-#include <vector>
+#include "admmpd_types.h"
namespace admmpd {
-struct Options {
- double timestep_s; // TODO: Figure out delta time from blender api
- int max_admm_iters;
- 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 // TODO variable per-tet
- double poisson; // Poisson ratio // TODO variable per-tet
- Eigen::Vector3d grav;
- Options() :
- timestep_s(1.0/100.0),
- max_admm_iters(20),
- max_cg_iters(10),
- mult_k(1.0),
- min_res(1e-4),
- density_kgm3(1100),
- youngs(100000000),
- poisson(0.399),
- grav(0,0,-9.8)
- {}
-};
-
-// TODO template type for float/double
-struct Data {
- // Set from input
- Eigen::MatrixXi tets; // elements t x 4
- Eigen::MatrixXd x; // vertices, n x 3
- 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
- Eigen::MatrixXd z; // ADMM z variable
- Eigen::MatrixXd u; // ADMM u aug lag with W inv
- Eigen::MatrixXd M_xbar; // M*(x + dt v)
- Eigen::MatrixXd Dx; // D * x
- 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> 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;
- 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
- std::vector<double> weights; // per-energy weights
-};
-
class Solver {
public:
-
// Initialies solver data. If a per-vertex
// variable is resized it is initialized to zero.
// Returns true on success