Loading...
Searching...
No Matches
CubbyFlow::MPMSystemData< N > Class Template Referencefinal

N-D material point method particle and grid state. More...

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

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

Public Types

using Base = ParticleSystemData< N >
 
using DeformationState = SnowDeformationState< 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

 MPMSystemData (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 MPM state with a vertex-centered background grid.
 
void Resize (size_t newNumberOfParticles) override
 Resizes particle state, initializing new MPM attributes.
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes inherited particle state and resets MPM-specific state.
 
void Set (const ParticleSystemData< N > &other) override
 Copies inherited particle state and resets MPM-specific 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.
 
ConstArrayView1< DeformationStateDeformationStates () const
 Returns per-particle deformation states.
 
ArrayView1< DeformationStateDeformationStates ()
 Returns per-particle deformation states.
 
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 ()
 
void TransferFromGridToParticles ()
 
- 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.
 

Additional Inherited Members

- 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::MPMSystemData< N >

N-D material point method particle and grid state.

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

Member Typedef Documentation

◆ Base

◆ DeformationState

template<size_t N>
using CubbyFlow::MPMSystemData< N >::DeformationState = SnowDeformationState<N>

Constructor & Destructor Documentation

◆ MPMSystemData()

template<size_t N>
CubbyFlow::MPMSystemData< N >::MPMSystemData ( 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 MPM state with a vertex-centered background grid.

Member Function Documentation

◆ DeformationStates() [1/2]

Returns per-particle deformation states.

◆ DeformationStates() [2/2]

template<size_t N>
ConstArrayView1< typename MPMSystemData< N >::DeformationState > CubbyFlow::MPMSystemData< N >::DeformationStates ( ) const

Returns per-particle deformation states.

◆ Deserialize()

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

Deserializes inherited particle state and resets MPM-specific state.

Implements CubbyFlow::Serializable.

◆ FLIPBlendingFactor()

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

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

◆ GridMass() [1/2]

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

Returns grid mass.

◆ GridMass() [2/2]

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

Returns grid mass.

◆ GridVelocities() [1/2]

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

Returns current grid velocities.

◆ GridVelocities() [2/2]

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

Returns current grid velocities.

◆ GridVelocitiesBeforeUpdate() [1/2]

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

Returns grid velocities before the grid update.

◆ GridVelocitiesBeforeUpdate() [2/2]

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

Returns grid velocities before the grid update.

◆ InitialVolumes() [1/2]

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

Returns per-particle initial volumes.

◆ InitialVolumes() [2/2]

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

Returns per-particle initial volumes.

◆ ParticleMasses() [1/2]

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

Returns per-particle masses.

◆ ParticleMasses() [2/2]

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

Returns per-particle masses.

◆ Resize()

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

Resizes particle state, initializing new MPM attributes.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ ResizeGrid()

template<size_t N>
void CubbyFlow::MPMSystemData< 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::MPMSystemData< N >::Set ( const ParticleSystemData< N > &  other)
overridevirtual

Copies inherited particle state and resets MPM-specific state.

Reimplemented from CubbyFlow::ParticleSystemData< N >.

◆ SetFLIPBlendingFactor()

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

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

◆ TransferFromGridToParticles()

template<size_t N>
void CubbyFlow::MPMSystemData< N >::TransferFromGridToParticles ( )

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

◆ TransferFromParticlesToGrid()

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

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


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