PeriDyno 1.0.0
Loading...
Searching...
No Matches
PJSConstraintSolver.h
Go to the documentation of this file.
1
17
18#pragma once
21
22#include "Topology/DiscreteElements.h"
23#include "Collision/Attribute.h"
25
26namespace dyno
27{
28 template<typename TDataType>
30 {
32 public:
33 typedef typename TDataType::Real Real;
34 typedef typename TDataType::Coord Coord;
35 typedef typename TDataType::Matrix Matrix;
36
37 typedef typename ::dyno::Quat<Real> TQuat;
38 typedef typename ::dyno::TContactPair<Real> ContactPair;
39 typedef typename ::dyno::TConstraintPair<Real> Constraint;
40
41 typedef typename ::dyno::BallAndSocketJoint<Real> BallAndSocketJoint;
42 typedef typename ::dyno::SliderJoint<Real> SliderJoint;
43 typedef typename ::dyno::HingeJoint<Real> HingeJoint;
44 typedef typename ::dyno::FixedJoint<Real> FixedJoint;
45 typedef typename ::dyno::PointJoint<Real> PointJoint;
46
49
50 public:
51 DEF_VAR(bool, FrictionEnabled, true, "");
52
53 DEF_VAR(bool, GravityEnabled, true, "");
54
55 DEF_VAR(Real, GravityValue, 9.8, "");
56
57 DEF_VAR(Real, FrictionCoefficient, 100, "");
58
59 DEF_VAR(Real, Slop, 0.0001, "");
60
61 DEF_VAR(Real, BaumgarteRate, 0.2, "");
62
63 DEF_VAR(uint, IterationNumberForVelocitySolver, 300, "");
64
66
67 DEF_VAR(Real, AngularDamping, 0.1, "");
68
69 public:
70 DEF_VAR_IN(Real, TimeStep, "Time step size");
71
72 DEF_ARRAY_IN(Real, Mass, DeviceType::GPU, "Mass of rigid bodies");
73
74 DEF_ARRAY_IN(Coord, Center, DeviceType::GPU, "Center of rigid bodies");
75
76 DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Velocity of rigid bodies");
77
78 DEF_ARRAY_IN(Coord, AngularVelocity, DeviceType::GPU, "Angular velocity of rigid bodies");
79
80 DEF_ARRAY_IN(Matrix, RotationMatrix, DeviceType::GPU, "Rotation matrix of rigid bodies");
81
82 DEF_ARRAY_IN(Matrix, Inertia, DeviceType::GPU, "Interial matrix");
83
84 DEF_ARRAY_IN(Matrix, InitialInertia, DeviceType::GPU, "Interial matrix");
85
86 DEF_ARRAY_IN(TQuat, Quaternion, DeviceType::GPU, "Quaternion");
87
88 DEF_ARRAY_IN(ContactPair, Contacts, DeviceType::GPU, "");
89
91
92 DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Rigid body attributes");
93
94 DEF_ARRAY_IN(Real, FrictionCoefficients, DeviceType::GPU, "FrictionCoefficients of rigid bodies");
95
96 protected:
97 void constrain() override;
98
99 private:
102
103 private:
107
110
113
115
117
119
123
124 std::vector<float> errors;
125 int cnt = 0;
126
129
130 };
131}
#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.
DEF_VAR(Real, LinearDamping, 0.1, "")
DEF_ARRAY_IN(Real, Mass, DeviceType::GPU, "Mass of rigid bodies")
DArray< ContactPair > mContactsInLocalFrame
DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Velocity of rigid bodies")
::dyno::FixedJoint< Real > FixedJoint
DEF_VAR(Real, BaumgarteRate, 0.2, "")
DEF_ARRAY_IN(TQuat, Quaternion, DeviceType::GPU, "Quaternion")
::dyno::TConstraintPair< Real > Constraint
DArray< Constraint > mVelocityConstraints
::dyno::SliderJoint< Real > SliderJoint
DEF_ARRAY_IN(Matrix, RotationMatrix, DeviceType::GPU, "Rotation matrix of rigid bodies")
DEF_VAR(bool, FrictionEnabled, true, "")
DEF_ARRAY_IN(Matrix, Inertia, DeviceType::GPU, "Interial matrix")
::dyno::TContactPair< Real > ContactPair
DEF_VAR(Real, GravityValue, 9.8, "")
DEF_ARRAY_IN(Coord, Center, DeviceType::GPU, "Center of rigid bodies")
::dyno::BallAndSocketJoint< Real > BallAndSocketJoint
DEF_VAR(Real, FrictionCoefficient, 100, "")
DEF_VAR(Real, Slop, 0.0001, "")
::dyno::PointJoint< Real > PointJoint
DEF_INSTANCE_IN(DiscreteElements< TDataType >, DiscreteElements, "")
DEF_VAR(bool, GravityEnabled, true, "")
DEF_VAR(Real, AngularDamping, 0.1, "")
DEF_ARRAY_IN(Coord, AngularVelocity, DeviceType::GPU, "Angular velocity of rigid bodies")
DEF_ARRAY_IN(ContactPair, Contacts, DeviceType::GPU, "")
DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Rigid body attributes")
void initializeJacobian(Real dt)
void constrain() override
DEF_VAR_IN(Real, TimeStep, "Time step size")
DEF_VAR(uint, IterationNumberForVelocitySolver, 300, "")
DEF_ARRAY_IN(Real, FrictionCoefficients, DeviceType::GPU, "FrictionCoefficients of rigid bodies")
DEF_ARRAY_IN(Matrix, InitialInertia, DeviceType::GPU, "Interial matrix")
::dyno::HingeJoint< Real > HingeJoint
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