UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PBDSoftsSolverParticles.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Chaos/Real.h"
5#include "Chaos/Vector.h"
9
10namespace Chaos::Softs
11{
12
18
19class FSolverParticles : public TDynamicParticles<FSolverReal, 3>
20{
21public:
23
25 : Base()
26 {
28 }
31 : Base(MoveTemp(Other)), MPAndInvM(MoveTemp(Other.MPAndInvM))
32 {
34 }
35
36 const FSolverVec3& P(const int32 index) const { return MPAndInvM[index].P; }
37 FSolverVec3& P(const int32 index) { return MPAndInvM[index].P; }
38 const FSolverVec3& X(const int32 index) const {
40 return Base::X(index);
42 }
48 const FSolverVec3& GetP(const int32 index) const { return MPAndInvM[index].P; }
49 void SetP(const int32 index, const FSolverVec3& InP) { MPAndInvM[index].P = InP; }
50 // When PBD is solving, V = last time step's V and we use the latest P to estimate velocity, (VelocityEstimate = (P - X)/Dt.
51 // After PBD (e.g., during implicit timestepping CG solve), V = current velocity estimate, VPrev = last time step's velocity
52 // Warning: VPrev and Acceleration use the same arrays as Acceleration is only used by PBD and VPrev is only used by the linear solver
53 const FSolverVec3& VPrev(const int32 Index) const { return Acceleration(Index); }
55
56 const FPAndInvM& PAndInvM(const int32 index) const { return MPAndInvM[index]; }
57 FPAndInvM& PAndInvM(const int32 index) { return MPAndInvM[index]; }
58
60 const TArrayCollectionArray<FPAndInvM>& GetPAndInvM() const { return MPAndInvM; }
61 // Warning: VPrev and Acceleration use the same arrays as Acceleration is only used by PBD and VPrev is only used by the linear solver
64
65 // Convenience method to match interface of FSolverParticlesRange
66 template<typename T>
68 template<typename T>
70
71private:
72 // Note that InvM is copied from TDynamicParticles to here during ApplyPreSimulationTransforms (when P is updated)
74
75};
76
77}
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
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition PBDSoftsSolverParticles.h:20
FSolverVec3 & X(const int32 index)
Definition PBDSoftsSolverParticles.h:43
const FPAndInvM & PAndInvM(const int32 index) const
Definition PBDSoftsSolverParticles.h:56
TArrayView< T > GetArrayView(const TArray< T > &Data)
Definition PBDSoftsSolverParticles.h:69
const FSolverVec3 & X(const int32 index) const
Definition PBDSoftsSolverParticles.h:38
FSolverParticles(FSolverParticles &&Other)
Definition PBDSoftsSolverParticles.h:30
TArrayCollectionArray< FPAndInvM > & GetPAndInvM()
Definition PBDSoftsSolverParticles.h:59
FSolverParticles()
Definition PBDSoftsSolverParticles.h:24
TArrayCollectionArray< FSolverVec3 > & GetVPrev()
Definition PBDSoftsSolverParticles.h:62
FSolverParticles(const FSolverParticles &Other)=delete
TDynamicParticles< FSolverReal, 3 > Base
Definition PBDSoftsSolverParticles.h:22
const FSolverVec3 & P(const int32 index) const
Definition PBDSoftsSolverParticles.h:36
FPAndInvM & PAndInvM(const int32 index)
Definition PBDSoftsSolverParticles.h:57
void SetP(const int32 index, const FSolverVec3 &InP)
Definition PBDSoftsSolverParticles.h:49
const TArrayCollectionArray< FSolverVec3 > & GetVPrev() const
Definition PBDSoftsSolverParticles.h:63
TConstArrayView< T > GetConstArrayView(const TArray< T > &Data) const
Definition PBDSoftsSolverParticles.h:67
FSolverVec3 & P(const int32 index)
Definition PBDSoftsSolverParticles.h:37
FSolverVec3 & VPrev(const int32 Index)
Definition PBDSoftsSolverParticles.h:54
const TArrayCollectionArray< FPAndInvM > & GetPAndInvM() const
Definition PBDSoftsSolverParticles.h:60
const FSolverVec3 & VPrev(const int32 Index) const
Definition PBDSoftsSolverParticles.h:53
const FSolverVec3 & GetP(const int32 index) const
Definition PBDSoftsSolverParticles.h:48
Definition ArrayCollectionArray.h:15
int32 AddArray(TArrayCollectionArrayBase *Array)
Definition ArrayCollection.h:36
Definition DynamicParticles.h:11
const TArrayCollectionArray< TVector< FSolverReal, d > > & GetAcceleration() const
Definition DynamicParticles.h:40
const TArrayCollectionArray< TVector< T, d > > & X() const
Definition Particles.h:117
Definition ArrayView.h:139
Definition Array.h:670
Definition CollectionEmbeddedSpringConstraintFacade.cpp:6
FRealSingle FSolverReal
Definition PBDSoftsEvolutionFwd.h:31
U16 Index
Definition radfft.cpp:71
Definition PBDSoftsSolverParticles.h:14
FSolverReal InvM
Definition PBDSoftsSolverParticles.h:16
FSolverVec3 P
Definition PBDSoftsSolverParticles.h:15
Definition CollectionMuscleActivationFacade.h:20