Loading...
Searching...
No Matches
CubbyFlow::MPMTransferSystemData< N > Class Template Reference

Shared N-D material point method particle-grid transfer state. More...

#include <Core/Particle/MPM/MPMSystemData.hpp>

Inheritance diagram for CubbyFlow::MPMTransferSystemData< N >:
CubbyFlow::ParticleSystemData< N > CubbyFlow::Serializable CubbyFlow::MPMFluidSystemData< N > CubbyFlow::MPMSystemData< N >

Public Types

using Base = ParticleSystemData< N >
 
- Public Types inherited from CubbyFlow::ParticleSystemData< N >
using ScalarData = Array1< double >
 Scalar data chunk.
 
using VectorData = Array1< Vector< double, N > >
 Vector data chunk.
 

Public Member Functions

 MPMTransferSystemData (const Vector< size_t, N > &resolution=Vector< size_t, N >::MakeConstant(1), const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1.0), const Vector< double, N > &gridOrigin=Vector< double, N >{}, size_t numberOfParticles=0)
 Constructs transfer state with a vertex-centered background grid.
 
void Resize (size_t newNumberOfParticles) override
 Resizes particle state, initializing new transfer attributes.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes inherited particle state and resets transfer state.
 
void Set (const ParticleSystemData< N > &other) override
 Copies inherited particle state and resets transfer state.
 
void ResizeGrid (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin)
 Resizes the background grid without changing particle state.
 
ConstArrayView1< doubleParticleMasses () const
 Returns per-particle masses.
 
ArrayView1< doubleParticleMasses ()
 Returns per-particle masses.
 
ConstArrayView1< doubleInitialVolumes () const
 Returns per-particle initial volumes.
 
ArrayView1< doubleInitialVolumes ()
 Returns per-particle initial volumes.
 
const VertexCenteredScalarGrid< N > & GridMass () const
 Returns grid mass.
 
VertexCenteredScalarGrid< N > & GridMass ()
 Returns grid mass.
 
const VertexCenteredVectorGrid< N > & GridVelocities () const
 Returns current grid velocities.
 
VertexCenteredVectorGrid< N > & GridVelocities ()
 Returns current grid velocities.
 
const VertexCenteredVectorGrid< N > & GridVelocitiesBeforeUpdate () const
 Returns grid velocities before the grid update.
 
VertexCenteredVectorGrid< N > & GridVelocitiesBeforeUpdate ()
 Returns grid velocities before the grid update.
 
double FLIPBlendingFactor () const
 Returns the FLIP fraction used for grid-to-particle transfer.
 
void SetFLIPBlendingFactor (double factor)
 Sets the FLIP fraction used for grid-to-particle transfer.
 
void TransferFromParticlesToGrid ()
 
- Public Member Functions inherited from CubbyFlow::ParticleSystemData< N >
 ParticleSystemData ()
 Default constructor.
 
 ParticleSystemData (size_t numberOfParticles)
 Constructs particle system data with given number of particles.
 
 ~ParticleSystemData () override=default
 Default virtual destructor.
 
 ParticleSystemData (const ParticleSystemData &other)
 Copy constructor.
 
 ParticleSystemData (ParticleSystemData &&other) noexcept
 Move constructor.
 
ParticleSystemDataoperator= (const ParticleSystemData &other)
 Copy assignment operator.
 
ParticleSystemDataoperator= (ParticleSystemData &&other) noexcept
 Move assignment operator.
 
size_t NumberOfParticles () const
 Returns the number of particles.
 
size_t AddScalarData (double initialVal=0.0)
 Adds a scalar data layer and returns its index.
 
size_t AddVectorData (const Vector< double, N > &initialVal=Vector< double, N >{})
 Adds a vector data layer and returns its index.
 
double Radius () const
 Returns the radius of the particles.
 
virtual void SetRadius (double newRadius)
 Sets the radius of the particles.
 
double Mass () const
 Returns the mass of the particles.
 
virtual void SetMass (double newMass)
 Sets the mass of the particles.
 
ConstArrayView1< Vector< double, N > > Positions () const
 Returns the position array (immutable).
 
ArrayView1< Vector< double, N > > Positions ()
 Returns the position array (mutable).
 
ConstArrayView1< Vector< double, N > > Velocities () const
 Returns the velocity array (immutable).
 
ArrayView1< Vector< double, N > > Velocities ()
 Returns the velocity array (mutable).
 
ConstArrayView1< Vector< double, N > > Forces () const
 Returns the force array (immutable).
 
ArrayView1< Vector< double, N > > Forces ()
 Returns the force array (mutable).
 
ConstArrayView1< doubleScalarDataAt (size_t idx) const
 Returns custom scalar data layer at given index (immutable).
 
ArrayView1< doubleScalarDataAt (size_t idx)
 Returns custom scalar data layer at given index (mutable).
 
ConstArrayView1< Vector< double, N > > VectorDataAt (size_t idx) const
 Returns custom vector data layer at given index (immutable).
 
ArrayView1< Vector< double, N > > VectorDataAt (size_t idx)
 Returns custom vector data layer at given index (mutable).
 
void AddParticle (const Vector< double, N > &newPosition, const Vector< double, N > &newVelocity=Vector< double, N >(), const Vector< double, N > &newForce=Vector< double, N >())
 Adds a particle to the data structure.
 
void AddParticles (const ConstArrayView1< Vector< double, N > > &newPositions, const ConstArrayView1< Vector< double, N > > &newVelocities=ConstArrayView1< Vector< double, N > >(), const ConstArrayView1< Vector< double, N > > &newForces=ConstArrayView1< Vector< double, N > >())
 Adds particles to the data structure.
 
const std::shared_ptr< PointNeighborSearcher< N > > & NeighborSearcher () const
 Returns neighbor searcher.
 
void SetNeighborSearcher (const std::shared_ptr< PointNeighborSearcher< N > > &newNeighborSearcher)
 Sets neighbor searcher.
 
const Array1< Array1< size_t > > & NeighborLists () const
 Returns neighbor lists.
 
void BuildNeighborSearcher (double maxSearchRadius)
 Builds neighbor searcher with given search radius.
 
void BuildNeighborLists (double maxSearchRadius)
 Builds neighbor lists with given search radius.
 
void Serialize (std::vector< uint8_t > *buffer) const override
 Serializes this particle system data to the buffer.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes this particle system data from the buffer.
 
- Public Member Functions inherited from CubbyFlow::Serializable
 Serializable ()=default
 Default constructor.
 
 Serializable (const Serializable &)=default
 Default copy constructor.
 
 Serializable (Serializable &&) noexcept=default
 Default move constructor.
 
virtual ~Serializable ()=default
 Default virtual destructor.
 
Serializableoperator= (const Serializable &)=default
 Default copy assignment operator.
 
Serializableoperator= (Serializable &&) noexcept=default
 Default move assignment operator.
 

Protected Member Functions

void TransferFromGridToParticles ()
 
void ValidateGridState () const
 
void ValidateGridToParticleState () const
 
void TransferFromGridToParticlesUnchecked ()
 
Matrix< double, N, NComputeVelocityGradient (size_t particleIndex) const
 

Static Protected Member Functions

static Vector< size_t, NClampIndex (const Vector< ssize_t, N > &index, const Vector< size_t, N > &dataSize)
 
static bool IsFinite (const Vector< double, N > &value)
 
static void ValidateGridParameters (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin)
 
- Static Protected Member Functions inherited from CubbyFlow::ParticleSystemData< N >
template<size_t M = N>
static std::enable_if_t< M==2, voidSerialize (const ParticleSystemData< 2 > &particles, flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData2 > *fbsParticleSystemData)
 
template<size_t M = N>
static std::enable_if_t< M==3, voidSerialize (const ParticleSystemData< 3 > &particles, flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData3 > *fbsParticleSystemData)
 
template<size_t M = N>
static std::enable_if_t< M==2, voidDeserialize (const fbs::ParticleSystemData2 *fbsParticleSystemData, ParticleSystemData< 2 > &particles)
 
template<size_t M = N>
static std::enable_if_t< M==3, voidDeserialize (const fbs::ParticleSystemData3 *fbsParticleSystemData, ParticleSystemData< 3 > &particles)
 

Detailed Description

template<size_t N>
class CubbyFlow::MPMTransferSystemData< N >

Shared N-D material point method particle-grid transfer state.

Note
Serialization preserves only the inherited particle-system state; transfer-specific particle and grid state is reset after deserialization.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ MPMTransferSystemData()

template<size_t N>
CubbyFlow::MPMTransferSystemData< N >::MPMTransferSystemData ( const Vector< size_t, N > &  resolution = Vector<size_tN>::MakeConstant(1),
const Vector< double, N > &  gridSpacing = Vector<doubleN>::MakeConstant(1.0),
const Vector< double, N > &  gridOrigin = Vector<doubleN>{},
size_t  numberOfParticles = 0 
)
explicit

Constructs transfer state with a vertex-centered background grid.

Member Function Documentation

◆ ClampIndex()

template<size_t N>
Vector< size_t, N > CubbyFlow::MPMTransferSystemData< N >::ClampIndex ( const Vector< ssize_t, N > &  index,
const Vector< size_t, N > &  dataSize 
)
staticprotected

◆ ComputeVelocityGradient()

template<size_t N>
Matrix< double, N, N > CubbyFlow::MPMTransferSystemData< N >::ComputeVelocityGradient ( size_t  particleIndex) const
protected

◆ Deserialize()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::Deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Deserializes inherited particle state and resets transfer state.

Implements CubbyFlow::Serializable.

◆ FLIPBlendingFactor()

template<size_t N>
double CubbyFlow::MPMTransferSystemData< N >::FLIPBlendingFactor ( ) const

Returns the FLIP fraction used for grid-to-particle transfer.

◆ GridMass() [1/2]

Returns grid mass.

◆ GridMass() [2/2]

template<size_t N>
const VertexCenteredScalarGrid< N > & CubbyFlow::MPMTransferSystemData< N >::GridMass ( ) const

Returns grid mass.

◆ GridVelocities() [1/2]

template<size_t N>
VertexCenteredVectorGrid< N > & CubbyFlow::MPMTransferSystemData< N >::GridVelocities ( )

Returns current grid velocities.

◆ GridVelocities() [2/2]

template<size_t N>
const VertexCenteredVectorGrid< N > & CubbyFlow::MPMTransferSystemData< N >::GridVelocities ( ) const

Returns current grid velocities.

◆ GridVelocitiesBeforeUpdate() [1/2]

template<size_t N>
VertexCenteredVectorGrid< N > & CubbyFlow::MPMTransferSystemData< N >::GridVelocitiesBeforeUpdate ( )

Returns grid velocities before the grid update.

◆ GridVelocitiesBeforeUpdate() [2/2]

template<size_t N>
const VertexCenteredVectorGrid< N > & CubbyFlow::MPMTransferSystemData< N >::GridVelocitiesBeforeUpdate ( ) const

Returns grid velocities before the grid update.

◆ InitialVolumes() [1/2]

template<size_t N>
ArrayView1< double > CubbyFlow::MPMTransferSystemData< N >::InitialVolumes ( )

Returns per-particle initial volumes.

◆ InitialVolumes() [2/2]

template<size_t N>
ConstArrayView1< double > CubbyFlow::MPMTransferSystemData< N >::InitialVolumes ( ) const

Returns per-particle initial volumes.

◆ IsFinite()

template<size_t N>
bool CubbyFlow::MPMTransferSystemData< N >::IsFinite ( const Vector< double, N > &  value)
staticprotected

◆ ParticleMasses() [1/2]

template<size_t N>
ArrayView1< double > CubbyFlow::MPMTransferSystemData< N >::ParticleMasses ( )

Returns per-particle masses.

◆ ParticleMasses() [2/2]

template<size_t N>
ConstArrayView1< double > CubbyFlow::MPMTransferSystemData< N >::ParticleMasses ( ) const

Returns per-particle masses.

◆ Resize()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::Resize ( size_t  newNumberOfParticles)
overridevirtual

Resizes particle state, initializing new transfer attributes.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ ResizeGrid()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::ResizeGrid ( const Vector< size_t, N > &  resolution,
const Vector< double, N > &  gridSpacing,
const Vector< double, N > &  gridOrigin 
)

Resizes the background grid without changing particle state.

◆ Set()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::Set ( const ParticleSystemData< N > &  other)
overridevirtual

Copies inherited particle state and resets transfer state.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ SetFLIPBlendingFactor()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::SetFLIPBlendingFactor ( double  factor)

Sets the FLIP fraction used for grid-to-particle transfer.

◆ TransferFromGridToParticles()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::TransferFromGridToParticles ( )
protected

Transfers updated background-grid velocities to particles. Stencil nodes outside the finite grid are clamped to its boundary.

◆ TransferFromGridToParticlesUnchecked()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::TransferFromGridToParticlesUnchecked ( )
protected

◆ TransferFromParticlesToGrid()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::TransferFromParticlesToGrid ( )

Transfers particle mass and momentum to the background grid. Stencil nodes outside the finite grid are clamped to its boundary.

◆ ValidateGridParameters()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::ValidateGridParameters ( const Vector< size_t, N > &  resolution,
const Vector< double, N > &  gridSpacing,
const Vector< double, N > &  gridOrigin 
)
staticprotected

◆ ValidateGridState()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::ValidateGridState ( ) const
protected

◆ ValidateGridToParticleState()

template<size_t N>
void CubbyFlow::MPMTransferSystemData< N >::ValidateGridToParticleState ( ) const
protected

The documentation for this class was generated from the following files: