PeriDyno 1.0.0
Loading...
Searching...
No Matches
PCGConstraintSolver.h
Go to the documentation of this file.
1
17
18#pragma once
19
22#include "Topology/DiscreteElements.h"
23#include "Collision/Attribute.h"
25
26namespace dyno
27{
28 template<typename TDataType>
30 {
32
33 public:
34 typedef typename TDataType::Real Real;
35 typedef typename TDataType::Coord Coord;
36 typedef typename TDataType::Matrix Matrix;
37
38 typedef typename ::dyno::Quat<Real> TQuat;
39 typedef typename ::dyno::TContactPair<Real> ContactPair;
40 typedef typename ::dyno::TConstraintPair<Real> Constraint;
41
42 typedef typename ::dyno::BallAndSocketJoint<Real> BallAndSocketJoint;
43 typedef typename ::dyno::SliderJoint<Real> SliderJoint;
44 typedef typename ::dyno::HingeJoint<Real> HingeJoint;
45 typedef typename ::dyno::FixedJoint<Real> FixedJoint;
46 typedef typename ::dyno::PointJoint<Real> PointJoint;
47
50
51 public:
52 DEF_VAR(bool, FrictionEnabled, true, "");
53
54 DEF_VAR(bool, GravityEnabled, true, "");
55
56 DEF_VAR(Real, GravityValue, 9.8, "");
57
58 DEF_VAR(Real, FrictionCoefficient, 10, "");
59
60 DEF_VAR(Real, Slop, 0.001, "");
61
62 DEF_VAR(Real, Frequency, 30, "");
63
64 DEF_VAR(Real, DampingRatio, 1.0, "");
65
66 DEF_VAR(uint, IterationNumberForVelocitySolverCG, 30, "");
67
68 DEF_VAR(uint, IterationNumberForVelocitySolverJacobi, 0, "");
69
71
72 DEF_VAR(Real, AngularDamping, 0.1, "");
73
74 DEF_VAR(Real, Tolerance, 0.00001, "");
75
76 public:
77 DEF_VAR_IN(Real, TimeStep, "Time step size");
78
79 DEF_ARRAY_IN(Real, Mass, DeviceType::GPU, "Mass of rigid bodies");
80
81 DEF_ARRAY_IN(Coord, Center, DeviceType::GPU, "Center of rigid bodies");
82
83 DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Velocity of rigid bodies");
84
85 DEF_ARRAY_IN(Coord, AngularVelocity, DeviceType::GPU, "Angular velocity of rigid bodies");
86
87 DEF_ARRAY_IN(Matrix, RotationMatrix, DeviceType::GPU, "Rotation matrix of rigid bodies");
88
89 DEF_ARRAY_IN(Matrix, Inertia, DeviceType::GPU, "Interial matrix");
90
91 DEF_ARRAY_IN(Matrix, InitialInertia, DeviceType::GPU, "Interial matrix");
92
93 DEF_ARRAY_IN(TQuat, Quaternion, DeviceType::GPU, "Quaternion");
94
95 DEF_ARRAY_IN(ContactPair, Contacts, DeviceType::GPU, "");
96
98
99 DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Rigid body attributes");
100
101 protected:
102 void constrain() override;
103
104 private:
106
107 private:
110
113
117
118
121
127
128 int cnt = 0;
130
131 std::vector<float> residuals;
132
133
135
139
143
146
147 int mJointSize = -1;
148
149 };
150}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
particle attribute 0x00000000: [31-30]material; [29]motion; [28]Dynamic; [27-8]undefined yet,...
Definition Attribute.h:26
A linear damping model.
::dyno::BallAndSocketJoint< Real > BallAndSocketJoint
DEF_VAR_IN(Real, TimeStep, "Time step size")
DEF_VAR(Real, LinearDamping, 0.1, "")
::dyno::SliderJoint< Real > SliderJoint
DEF_VAR(Real, AngularDamping, 0.1, "")
DEF_ARRAY_IN(Real, Mass, DeviceType::GPU, "Mass of rigid bodies")
DArray< ContactPair > mContactsInLocalFrame
::dyno::HingeJoint< Real > HingeJoint
::dyno::TContactPair< Real > ContactPair
DEF_ARRAY_IN(Coord, AngularVelocity, DeviceType::GPU, "Angular velocity of rigid bodies")
DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Rigid body attributes")
DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Velocity of rigid bodies")
DEF_VAR(Real, GravityValue, 9.8, "")
::dyno::FixedJoint< Real > FixedJoint
DEF_VAR(Real, Tolerance, 0.00001, "")
DEF_VAR(Real, FrictionCoefficient, 10, "")
DEF_VAR(Real, DampingRatio, 1.0, "")
DEF_ARRAY_IN(Coord, Center, DeviceType::GPU, "Center of rigid bodies")
DEF_VAR(Real, Frequency, 30, "")
::dyno::TConstraintPair< Real > Constraint
DEF_ARRAY_IN(ContactPair, Contacts, DeviceType::GPU, "")
DEF_ARRAY_IN(TQuat, Quaternion, DeviceType::GPU, "Quaternion")
DEF_ARRAY_IN(Matrix, RotationMatrix, DeviceType::GPU, "Rotation matrix of rigid bodies")
DArray< Constraint > mVelocityConstraints
DEF_VAR(uint, IterationNumberForVelocitySolverCG, 30, "")
DEF_ARRAY_IN(Matrix, Inertia, DeviceType::GPU, "Interial matrix")
DEF_VAR(uint, IterationNumberForVelocitySolverJacobi, 0, "")
std::vector< float > residuals
DEF_ARRAY_IN(Matrix, InitialInertia, DeviceType::GPU, "Interial matrix")
DEF_VAR(bool, GravityEnabled, true, "")
DEF_VAR(bool, FrictionEnabled, true, "")
DEF_VAR(Real, Slop, 0.001, "")
DEF_INSTANCE_IN(DiscreteElements< TDataType >, DiscreteElements, "")
void initializeJacobian(Real dt)
::dyno::PointJoint< Real > PointJoint
void constrain() override
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89
unsigned int uint
Definition VkProgram.h:14