16template <
typename T,
typename ParticleType>
39 for (
int e = 0; e <
Mesh.Num(); e++)
43 for (
int r = 0; r < 3; r++) {
44 for (
int c = 0; c < 3; c++) {
67 for (
int32 i = 0; i < 4; i++)
77 for (
int i = 0; i < 3; i++) {
78 for (
int c = 0; c < 3; c++) {
89 for (
int i = 0; i < 3; i++) {
90 for (
int c = 0; c < 3; c++) {
100 for (
int i = 0; i < 3; i++) {
101 for (
int c = 0; c < 3; c++) {
120 for (
int r = 0; r < 3; r++) {
121 for (
int c = 0; c < 3; c++) {
128 template <
typename Func>
140 if (!IncidentElements) {
141 for (
int32 e = 0; e <
Mesh.Num() ; e++) {
150 for (
int32 c = 0; c < 3; c++) {
157 for (
int32 c = 0; c < 3; c++) {
158 for (
int32 h = 0; h < 3; h++) {
168 PMatrix<T, 3, 3> Fe = F(e, InParticles);
169 PMatrix<T, 3, 3> Pe(0.f);
171 PMatrix<T, 3, 3> g = -Measure[e] * (ElementDmInv(e).GetTransposed()) * Pe;
172 for (int32 ie = 0; ie < 3; ie++) {
173 for (int32 c = 0; c < 3; c++) {
174 ElementForces[4 * e + ie + 1][c] += g.GetAt(c, ie);
178 for (
int32 h = 0; h < 3; h++) {
189 for (int32 e = 0; e < (*IncidentElements)[i].Num(); e++) {
190 for (int32 c = 0; c < 3; c++) {
191 Force[Mesh[(*IncidentElements)[i][e][0]][(*IncidentElements)[i][e][1]]][c] += Scale * ElementForces[4* (*IncidentElements)[i][e][0]+ (*IncidentElements)[i][e][1]][c];
200 for (int32 e = 0; e < (*IncidentElements)[i].Num(); e++) {
201 for (int32 c = 0; c < 3; c++) {
202 Force[Mesh[(*IncidentElements)[i][e][0]][(*IncidentElements)[i][e][1]]][c] += Scale * ElementForces[4 * (*IncidentElements)[i][e][0] + (*IncidentElements)[i][e][1]][c] / (*NodalMass)[Mesh[(*IncidentElements)[i][e][0]][(*IncidentElements)[i][e][1]]];
210 template <
typename Func>
219 if (!IncidentElements) {
220 for (
int32 e = 0; e <
Mesh.Num() ; e++) {
226 for (
int32 c = 0; c < 3; c++) {
230 for (
int32 c = 0; c < 3; c++) {
231 for (
int32 h = 0; h < 3; h++) {
241 PMatrix<T, 3, 3> Fe = F(e, InParticles), dFe = F(e, DeltaParticles);
242 PMatrix<T, 3, 3> dPe;
244 PMatrix<T, 3, 3> dg = Measure[e] * (ElementDmInv(e).GetTransposed()) * dPe;
245 for (int32 ie = 0; ie < 3; ie++)
247 for (int32 c = 0; c < 3; c++)
249 ElementForces[4 * e + ie + 1][c] += dg.GetAt(c, ie);
253 for (
int32 h = 0; h < 3; h++) {
254 ElementForces[4 * e][c] -=
dg.GetAt(c, h);
260 for (
int32 i = 0; i <
int32(IncidentElements->Num()); ++i) {
261 for (
int32 e = 0; e < (*IncidentElements)[i].Num(); e++) {
262 for (
int32 c = 0; c < 3; c++) {
263 ndf[
Mesh[(*IncidentElements)[i][e][0]][(*IncidentElements)[i][e][1]]][c] += ElementForces[4 * (*IncidentElements)[i][e][0] + (*IncidentElements)[i][e][1]][c];
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
for(;InputBuffer< InputBufferEnd;BlockIndex++)
Definition binka_ue_decode_test.cpp:39
Definition NewtonElasticFEM.h:18
TArray< T > DmInverse
Definition NewtonElasticFEM.h:21
ElasticFEM(const ParticleType &InParticles, const TArray< TVector< int32, 4 > > &InMesh, const TArray< TArray< TVector< int32, 2 > > > &IncidentElementsIn)
Definition NewtonElasticFEM.h:28
TArray< TVector< T, 3 > > ElementForces
Definition NewtonElasticFEM.h:23
TArray< T > MNodalMass
Definition NewtonElasticFEM.h:25
TArray< T > Measure
Definition NewtonElasticFEM.h:22
PMatrix< T, 3, 3 > F(const int e, const TArray< TVector< T, 3 > > &InParticles) const
Definition NewtonElasticFEM.h:113
void AddNegativeInternalElasticForceDifferential(const ParticleType &InParticles, Func dP, const TArray< TVector< T, 3 > > &DeltaParticles, TArray< TVector< T, 3 > > &ndf, const TArray< TArray< TVector< int32, 2 > > > *IncidentElements=nullptr)
Definition NewtonElasticFEM.h:211
TArray< TArray< TVector< int32, 2 > > > MIncidentElements
Definition NewtonElasticFEM.h:26
const TArray< TVector< int32, 4 > > & Mesh
Definition NewtonElasticFEM.h:20
int32 Np
Definition NewtonElasticFEM.h:24
PMatrix< T, 3, 3 > Ds(const int e, const ParticleType &InParticles) const
Definition NewtonElasticFEM.h:86
PMatrix< T, 3, 3 > Ds(const int e, const TArray< TVector< T, 3 > > &InParticles) const
Definition NewtonElasticFEM.h:97
PMatrix< T, 3, 3 > ElementDmInv(const int e) const
Definition NewtonElasticFEM.h:117
PMatrix< T, 3, 3 > DsInit(const int e, const ParticleType &InParticles) const
Definition NewtonElasticFEM.h:74
void AddInternalElasticForce(const ParticleType &InParticles, Func P, TArray< TVector< T, 3 > > &Force, const TArray< TArray< TVector< int32, 2 > > > *IncidentElements=nullptr, T Scale=(T) 1., const TArray< T > *NodalMass=0)
Definition NewtonElasticFEM.h:129
PMatrix< T, 3, 3 > F(const int e, const ParticleType &InParticles) const
Definition NewtonElasticFEM.h:109
void ComputeNodalMass(const T Density)
Definition NewtonElasticFEM.h:61
int32 Num() const
Definition Vector.h:150
void Init(const ElementType &Element, SizeType Number)
Definition Array.h:3043
Definition CollectionEmbeddedSpringConstraintFacade.cpp:6
void CHAOS_API PhysicsParallelFor(int32 InNum, TFunctionRef< void(int32)> InCallable, bool bForceSingleThreaded=false)
Definition Parallel.cpp:55