CubbyFlow::ParticleSystemData3 Class Reference

3-D particle system data. More...

#include <Core/Particle/ParticleSystemData3.h>

Inheritance diagram for CubbyFlow::ParticleSystemData3:
CubbyFlow::Serializable CubbyFlow::SPHSystemData3

Public Types

using ScalarData = Array1< double >
 Scalar data chunk. More...
 
using VectorData = Array1< Vector3D >
 Vector data chunk. More...
 

Public Member Functions

 ParticleSystemData3 ()
 Default constructor. More...
 
 ParticleSystemData3 (size_t numberOfParticles)
 Constructs particle system data with given number of particles. More...
 
 ParticleSystemData3 (const ParticleSystemData3 &other)
 Copy constructor. More...
 
virtual ~ParticleSystemData3 ()
 Destructor. More...
 
void Resize (size_t newNumberOfParticles)
 Resizes the number of particles of the container. More...
 
size_t GetNumberOfParticles () const
 Returns the number of particles. More...
 
size_t AddScalarData (double initialVal=0.0)
 Adds a scalar data layer and returns its index. More...
 
size_t AddVectorData (const Vector3D &initialVal=Vector3D())
 Adds a vector data layer and returns its index. More...
 
double GetRadius () const
 Returns the radius of the particles. More...
 
virtual void SetRadius (double newRadius)
 Sets the radius of the particles. More...
 
double GetMass () const
 Returns the mass of the particles. More...
 
virtual void SetMass (double newMass)
 Sets the mass of the particles. More...
 
ConstArrayAccessor1< Vector3DGetPositions () const
 Returns the position array (immutable). More...
 
ArrayAccessor1< Vector3DGetPositions ()
 Returns the position array (mutable). More...
 
ConstArrayAccessor1< Vector3DGetVelocities () const
 Returns the velocity array (immutable). More...
 
ArrayAccessor1< Vector3DGetVelocities ()
 Returns the velocity array (mutable). More...
 
ConstArrayAccessor1< Vector3DGetForces () const
 Returns the force array (immutable). More...
 
ArrayAccessor1< Vector3DGetForces ()
 Returns the force array (mutable). More...
 
ConstArrayAccessor1< double > ScalarDataAt (size_t idx) const
 Returns custom scalar data layer at given index (immutable). More...
 
ArrayAccessor1< double > ScalarDataAt (size_t idx)
 Returns custom scalar data layer at given index (mutable). More...
 
ConstArrayAccessor1< Vector3DVectorDataAt (size_t idx) const
 Returns custom vector data layer at given index (immutable). More...
 
ArrayAccessor1< Vector3DVectorDataAt (size_t idx)
 Returns custom vector data layer at given index (mutable). More...
 
void AddParticle (const Vector3D &newPosition, const Vector3D &newVelocity=Vector3D(), const Vector3D &newForce=Vector3D())
 Adds a particle to the data structure. More...
 
void AddParticles (const ConstArrayAccessor1< Vector3D > &newPositions, const ConstArrayAccessor1< Vector3D > &newVelocities=ConstArrayAccessor1< Vector3D >(), const ConstArrayAccessor1< Vector3D > &newForces=ConstArrayAccessor1< Vector3D >())
 Adds particles to the data structure. More...
 
const PointNeighborSearcher3PtrGetNeighborSearcher () const
 Returns neighbor searcher. More...
 
void SetNeighborSearcher (const PointNeighborSearcher3Ptr &newNeighborSearcher)
 Sets neighbor searcher. More...
 
const std::vector< std::vector< size_t > > & GetNeighborLists () const
 Returns neighbor lists. More...
 
void BuildNeighborSearcher (double maxSearchRadius)
 Builds neighbor searcher with given search radius. More...
 
void BuildNeighborLists (double maxSearchRadius)
 Builds neighbor lists with given search radius. More...
 
void Serialize (std::vector< uint8_t > *buffer) const override
 Serializes this particle system data to the buffer. More...
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes this particle system data from the buffer. More...
 
void Set (const ParticleSystemData3 &other)
 Copies from other particle system data. More...
 
ParticleSystemData3operator= (const ParticleSystemData3 &other)
 Copies from other particle system data. More...
 

Protected Member Functions

void SerializeParticleSystemData (flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData3 > *fbsParticleSystemData) const
 
void DeserializeParticleSystemData (const fbs::ParticleSystemData3 *fbsParticleSystemData)
 

Detailed Description

3-D particle system data.

This class is the key data structure for storing particle system data. A single particle has position, velocity, and force attributes by default. But it can also have additional custom scalar or vector attributes.

Member Typedef Documentation

◆ ScalarData

Scalar data chunk.

◆ VectorData

Constructor & Destructor Documentation

◆ ParticleSystemData3() [1/3]

CubbyFlow::ParticleSystemData3::ParticleSystemData3 ( )

Default constructor.

◆ ParticleSystemData3() [2/3]

CubbyFlow::ParticleSystemData3::ParticleSystemData3 ( size_t  numberOfParticles)
explicit

Constructs particle system data with given number of particles.

◆ ParticleSystemData3() [3/3]

CubbyFlow::ParticleSystemData3::ParticleSystemData3 ( const ParticleSystemData3 other)

Copy constructor.

◆ ~ParticleSystemData3()

virtual CubbyFlow::ParticleSystemData3::~ParticleSystemData3 ( )
virtual

Destructor.

Member Function Documentation

◆ AddParticle()

void CubbyFlow::ParticleSystemData3::AddParticle ( const Vector3D newPosition,
const Vector3D newVelocity = Vector3D(),
const Vector3D newForce = Vector3D() 
)

Adds a particle to the data structure.

This function will add a single particle to the data structure. For custom data layers, zeros will be assigned for new particles. However, this will invalidate neighbor searcher and neighbor lists. It is users responsibility to call ParticleSystemData3::BuildNeighborSearcher and ParticleSystemData3::BuildNeighborLists to refresh those data.

Parameters
[in]newPositionThe new position.
[in]newVelocityThe new velocity.
[in]newForceThe new force.

◆ AddParticles()

void CubbyFlow::ParticleSystemData3::AddParticles ( const ConstArrayAccessor1< Vector3D > &  newPositions,
const ConstArrayAccessor1< Vector3D > &  newVelocities = ConstArrayAccessor1Vector3D >(),
const ConstArrayAccessor1< Vector3D > &  newForces = ConstArrayAccessor1Vector3D >() 
)

Adds particles to the data structure.

This function will add particles to the data structure. For custom data layers, zeros will be assigned for new particles. However, this will invalidate neighbor searcher and neighbor lists. It is users responsibility to call ParticleSystemData3::BuildNeighborSearcher and ParticleSystemData3::BuildNeighborLists to refresh those data.

Parameters
[in]newPositionsThe new positions.
[in]newVelocitiesThe new velocities.
[in]newForcesThe new forces.

◆ AddScalarData()

size_t CubbyFlow::ParticleSystemData3::AddScalarData ( double  initialVal = 0.0)

Adds a scalar data layer and returns its index.

This function adds a new scalar data layer to the system. It can be used for adding a scalar attribute, such as temperature, to the particles.

Parameters
[in]initialValInitial value of the new scalar data.

◆ AddVectorData()

size_t CubbyFlow::ParticleSystemData3::AddVectorData ( const Vector3D initialVal = Vector3D())

Adds a vector data layer and returns its index.

This function adds a new vector data layer to the system. It can be used for adding a vector attribute, such as vortex, to the particles.

Parameters
[in]initialValInitial value of the new vector data.

◆ BuildNeighborLists()

void CubbyFlow::ParticleSystemData3::BuildNeighborLists ( double  maxSearchRadius)

Builds neighbor lists with given search radius.

◆ BuildNeighborSearcher()

void CubbyFlow::ParticleSystemData3::BuildNeighborSearcher ( double  maxSearchRadius)

Builds neighbor searcher with given search radius.

◆ Deserialize()

void CubbyFlow::ParticleSystemData3::Deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Deserializes this particle system data from the buffer.

Implements CubbyFlow::Serializable.

Reimplemented in CubbyFlow::SPHSystemData3.

◆ DeserializeParticleSystemData()

void CubbyFlow::ParticleSystemData3::DeserializeParticleSystemData ( const fbs::ParticleSystemData3 *  fbsParticleSystemData)
protected

◆ GetForces() [1/2]

ConstArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetForces ( ) const

Returns the force array (immutable).

◆ GetForces() [2/2]

ArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetForces ( )

Returns the force array (mutable).

◆ GetMass()

double CubbyFlow::ParticleSystemData3::GetMass ( ) const

Returns the mass of the particles.

◆ GetNeighborLists()

const std::vector<std::vector<size_t> >& CubbyFlow::ParticleSystemData3::GetNeighborLists ( ) const

Returns neighbor lists.

This function returns neighbor lists which is available after calling PointParallelHashGridSearcher3::BuildNeighborLists. Each list stores indices of the neighbors.

Returns
Neighbor lists.

◆ GetNeighborSearcher()

const PointNeighborSearcher3Ptr& CubbyFlow::ParticleSystemData3::GetNeighborSearcher ( ) const

Returns neighbor searcher.

This function returns currently set neighbor searcher object. By default, PointParallelHashGridSearcher3 is used.

Returns
Current neighbor searcher.

◆ GetNumberOfParticles()

size_t CubbyFlow::ParticleSystemData3::GetNumberOfParticles ( ) const

Returns the number of particles.

◆ GetPositions() [1/2]

ConstArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetPositions ( ) const

Returns the position array (immutable).

◆ GetPositions() [2/2]

ArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetPositions ( )

Returns the position array (mutable).

◆ GetRadius()

double CubbyFlow::ParticleSystemData3::GetRadius ( ) const

Returns the radius of the particles.

◆ GetVelocities() [1/2]

ConstArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetVelocities ( ) const

Returns the velocity array (immutable).

◆ GetVelocities() [2/2]

ArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::GetVelocities ( )

Returns the velocity array (mutable).

◆ operator=()

ParticleSystemData3& CubbyFlow::ParticleSystemData3::operator= ( const ParticleSystemData3 other)

Copies from other particle system data.

◆ Resize()

void CubbyFlow::ParticleSystemData3::Resize ( size_t  newNumberOfParticles)

Resizes the number of particles of the container.

This function will resize internal containers to store newly given number of particles including custom data layers. However, this will invalidate neighbor searcher and neighbor lists. It is users responsibility to call ParticleSystemData3::BuildNeighborSearcher and ParticleSystemData3::BuildNeighborLists to refresh those data.

Parameters
[in]newNumberOfParticlesNew number of particles.

◆ ScalarDataAt() [1/2]

ConstArrayAccessor1<double> CubbyFlow::ParticleSystemData3::ScalarDataAt ( size_t  idx) const

Returns custom scalar data layer at given index (immutable).

◆ ScalarDataAt() [2/2]

ArrayAccessor1<double> CubbyFlow::ParticleSystemData3::ScalarDataAt ( size_t  idx)

Returns custom scalar data layer at given index (mutable).

◆ Serialize()

void CubbyFlow::ParticleSystemData3::Serialize ( std::vector< uint8_t > *  buffer) const
overridevirtual

Serializes this particle system data to the buffer.

Implements CubbyFlow::Serializable.

Reimplemented in CubbyFlow::SPHSystemData3.

◆ SerializeParticleSystemData()

void CubbyFlow::ParticleSystemData3::SerializeParticleSystemData ( flatbuffers::FlatBufferBuilder *  builder,
flatbuffers::Offset< fbs::ParticleSystemData3 > *  fbsParticleSystemData 
) const
protected

◆ Set()

void CubbyFlow::ParticleSystemData3::Set ( const ParticleSystemData3 other)

Copies from other particle system data.

◆ SetMass()

virtual void CubbyFlow::ParticleSystemData3::SetMass ( double  newMass)
virtual

Sets the mass of the particles.

Reimplemented in CubbyFlow::SPHSystemData3.

◆ SetNeighborSearcher()

void CubbyFlow::ParticleSystemData3::SetNeighborSearcher ( const PointNeighborSearcher3Ptr newNeighborSearcher)

Sets neighbor searcher.

◆ SetRadius()

virtual void CubbyFlow::ParticleSystemData3::SetRadius ( double  newRadius)
virtual

Sets the radius of the particles.

Reimplemented in CubbyFlow::SPHSystemData3.

◆ VectorDataAt() [1/2]

ConstArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::VectorDataAt ( size_t  idx) const

Returns custom vector data layer at given index (immutable).

◆ VectorDataAt() [2/2]

ArrayAccessor1<Vector3D> CubbyFlow::ParticleSystemData3::VectorDataAt ( size_t  idx)

Returns custom vector data layer at given index (mutable).


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