UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GaussSeidelNeohookeanConstraints.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
6#include "ChaosStats.h"
12
13
14namespace Chaos::Softs
15{
16 template <typename T, typename ParticleType>
18 {
32 using Base::Measure;
33 using Base::DmInverse;
37
38 public:
60
62
63 protected:
64
66 {
67 ComputeStress = [](const Chaos::PMatrix<T, 3, 3>& Fe, const T mu, const T lambda, Chaos::PMatrix<T, 3, 3>& P)
68 {
70 };
71 ComputeHessianHelper = [](const Chaos::PMatrix<T, 3, 3>& Fe, const Chaos::PMatrix<T, 3, 3>& DmInv, const T mu, const T lambda, const int32 local_index, const T Coeff, Chaos::PMatrix<T, 3, 3>& final_hessian)
72 {
73 T LambdaHat = mu + lambda;
75 JFinvT.SetAt(0, 0, Fe.GetAt(1, 1) * Fe.GetAt(2, 2) - Fe.GetAt(2, 1) * Fe.GetAt(1, 2));
76 JFinvT.SetAt(0, 1, Fe.GetAt(2, 0) * Fe.GetAt(1, 2) - Fe.GetAt(1, 0) * Fe.GetAt(2, 2));
77 JFinvT.SetAt(0, 2, Fe.GetAt(1, 0) * Fe.GetAt(2, 1) - Fe.GetAt(2, 0) * Fe.GetAt(1, 1));
78 JFinvT.SetAt(1, 0, Fe.GetAt(2, 1) * Fe.GetAt(0, 2) - Fe.GetAt(0, 1) * Fe.GetAt(2, 2));
79 JFinvT.SetAt(1, 1, Fe.GetAt(0, 0) * Fe.GetAt(2, 2) - Fe.GetAt(2, 0) * Fe.GetAt(0, 2));
80 JFinvT.SetAt(1, 2, Fe.GetAt(2, 0) * Fe.GetAt(0, 1) - Fe.GetAt(0, 0) * Fe.GetAt(2, 1));
81 JFinvT.SetAt(2, 0, Fe.GetAt(0, 1) * Fe.GetAt(1, 2) - Fe.GetAt(1, 1) * Fe.GetAt(0, 2));
82 JFinvT.SetAt(2, 1, Fe.GetAt(1, 0) * Fe.GetAt(0, 2) - Fe.GetAt(0, 0) * Fe.GetAt(1, 2));
83 JFinvT.SetAt(2, 2, Fe.GetAt(0, 0) * Fe.GetAt(1, 1) - Fe.GetAt(1, 0) * Fe.GetAt(0, 1));
84
85 Chaos::PMatrix<T, 3, 3> JFinv = JFinvT.GetTransposed();
86
87 if (local_index == 0) {
88 T DmInvsum = T(0);
89 for (int32 nu = 0; nu < 3; nu++) {
90 T localDmsum = T(0);
91 for (int32 k = 0; k < 3; k++) {
92 localDmsum += DmInv.GetAt(k, nu);
93 }
95 }
96 for (int32 alpha = 0; alpha < 3; alpha++) {
97 final_hessian.SetAt(alpha, alpha, final_hessian.GetAt(alpha, alpha) + Coeff * mu * DmInvsum);
98 }
99
101 Chaos::TVector<T, 3> l((T)0.);
102 for (int32 alpha = 0; alpha < 3; alpha++) {
103 for (int32 k = 0; k < 3; k++) {
104 l[alpha] += DmInvJFinv.GetAt(k, alpha);
105 }
106 }
107 for (int32 alpha = 0; alpha < 3; alpha++)
108 {
109 final_hessian.SetRow(alpha, final_hessian.GetRow(alpha) + Coeff * LambdaHat * l[alpha] * l);
110 }
111
112 }
113 else {
114 T DmInvsum = T(0);
115 for (int32 nu = 0; nu < 3; nu++)
116 {
117 DmInvsum += DmInv.GetAt(local_index - 1, nu) * DmInv.GetAt(local_index - 1, nu);
118 }
119 for (int32 alpha = 0; alpha < 3; alpha++)
120 {
121 final_hessian.SetAt(alpha, alpha, final_hessian.GetAt(alpha, alpha) + Coeff * mu * DmInvsum);
122 }
123
125 Chaos::TVector<T, 3> l((T)0.);
126 for (int32 alpha = 0; alpha < 3; alpha++) {
127 l[alpha] = DmInvJFinv.GetAt(local_index - 1, alpha);
128 }
129 for (int32 alpha = 0; alpha < 3; alpha++)
130 {
131 final_hessian.SetRow(alpha, final_hessian.GetRow(alpha) + Coeff * LambdaHat * l[alpha] * l);
132 }
133 }
134 };
135 }
136
137 };
138
139}// End namespace Chaos::Softs
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition Matrix.h:21
Definition GaussSeidelCorotatedConstraints.h:18
TArray< int32 > Particle2Incident
Definition GaussSeidelCorotatedConstraints.h:388
int32 ParticleStartIndex
Definition GaussSeidelCorotatedConstraints.h:393
TFunction< void(const Chaos::PMatrix< T, 3, 3 > &, const Chaos::PMatrix< T, 3, 3 > &, const T, const T, const int32, const T, Chaos::PMatrix< T, 3, 3 > &)> ComputeHessianHelper
Definition GaussSeidelCorotatedConstraints.h:404
TFunction< void(const Chaos::PMatrix< T, 3, 3 > &, const T, const T, Chaos::PMatrix< T, 3, 3 > &)> ComputeStress
Definition GaussSeidelCorotatedConstraints.h:403
T LocalNewtonTol
Definition GaussSeidelCorotatedConstraints.h:391
TArray< TArray< int32 > > IncidentElements
Definition GaussSeidelCorotatedConstraints.h:389
TArray< TArray< int32 > > ParticlesPerColor
Definition GaussSeidelCorotatedConstraints.h:392
bool bDoQuasistatics
Definition GaussSeidelCorotatedConstraints.h:398
TArray< TArray< int32 > > IncidentElementsLocal
Definition GaussSeidelCorotatedConstraints.h:390
Definition GaussSeidelNeohookeanConstraints.h:18
virtual ~FGaussSeidelNeohookeanConstraints()
Definition GaussSeidelNeohookeanConstraints.h:61
FGaussSeidelNeohookeanConstraints(const ParticleType &InParticles, const TArray< TVector< int32, 4 > > &InMesh, const TArray< T > &EMeshArray, const TArray< T > &NuMeshArray, TArray< T > &&AlphaJMeshArray, TArray< TArray< int32 > > &&IncidentElementsIn, TArray< TArray< int32 > > &&IncidentElementsLocalIn, const int32 ParticleStartIndexIn, const int32 ParticleEndIndexIn, const bool bDoQuasistaticsIn=false, const bool bDoSORIn=true, const T InOmegaSOR=(T) 1.6, const FDeformableXPBDCorotatedParams &InParams=FDeformableXPBDCorotatedParams(), const T &NuMesh=(T).3, const bool bRecordMetricIn=false)
Definition GaussSeidelNeohookeanConstraints.h:39
void InitializeNeohookeanLambdas()
Definition GaussSeidelNeohookeanConstraints.h:65
Definition XPBDCorotatedConstraints.h:20
TArray< T > LambdaArray
Definition XPBDCorotatedConstraints.h:637
TArray< TVector< int32, 4 > > MeshConstraints
Definition XPBDCorotatedConstraints.h:654
TArray< T > Measure
Definition XPBDCorotatedConstraints.h:655
FDeformableXPBDCorotatedParams CorotatedParams
Definition XPBDCorotatedConstraints.h:641
TArray< T > DmInverse
Definition XPBDCorotatedConstraints.h:638
TArray< T > MuElementArray
Definition XPBDCorotatedConstraints.h:646
TArray< T > LambdaElementArray
Definition XPBDCorotatedConstraints.h:647
Definition Vector.h:41
Definition Array.h:670
Definition CollectionEmbeddedSpringConstraintFacade.cpp:6
void PNeohookeanMM(const Chaos::PMatrix< T, 3, 3 > &Fe, const T mu, const T lambda, Chaos::PMatrix< T, 3, 3 > &P)
Definition NeohookeanModel.cpp:22
Definition ChaosDeformableSolverTypes.h:219