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

admmpd_solver.h « src « softbody « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 584f54be43c86788983c52718ff9ffe232dcc3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright Matt Overby 2020.
// Distributed under the MIT License.

#ifndef ADMMPD_SOLVER_H_
#define ADMMPD_SOLVER_H_

#include "admmpd_types.h"
#include "admmpd_collision.h"
#include "admmpd_pin.h"

namespace admmpd {

class Solver {
public:
    // Initialies solver data. If a per-vertex
    // variable is resized it is initialized to zero.
    // Returns true on success
    bool init(
        const Eigen::MatrixXd &V, // vertices
        const Eigen::MatrixXi &T, // tets
        const Eigen::VectorXd &m, // per-vert masses
        const Options *options,
        SolverData *data);

    // Solve a single time step.
    // Returns number of iterations.
    // Collision ptr can be null.
    // Pin ptr can be null
    int solve(
        const Options *options,
        SolverData *data,
        Collision *collision,
        Pin *pin);

protected:

    void linearize_collision_constraints(
        const Options *options,
        SolverData *data,
        Collision *collision);

    void init_solve(
        const Options *options,
        SolverData *data,
        Collision *collision,
        Pin *pin);

	void solve_local_step(
        const Options *options,
        SolverData *data);

    bool compute_matrices(
        const Options *options,
        SolverData *data);

	void append_energies(
		const Options *options,
		SolverData *data,
		std::vector<Eigen::Triplet<double> > &D_triplets);

}; // class ADMMPD_solver

} // namespace admmpd

#endif // ADMMPD_SOLVER_H_