Jet  v1.3.3
Public Types | Public Member Functions | Protected Member Functions | List of all members
jet::ParticleSystemData2 Class Reference

2-D particle system data. More...

#include <jet/particle_system_data2.h>

Inheritance diagram for jet::ParticleSystemData2:
jet::Serializable jet::SphSystemData2

Public Types

typedef Array1< double > ScalarData
 Scalar data chunk. More...
 
typedef Array1< Vector2DVectorData
 Vector data chunk. More...
 

Public Member Functions

 ParticleSystemData2 ()
 Default constructor. More...
 
 ParticleSystemData2 (size_t numberOfParticles)
 Constructs particle system data with given number of particles. More...
 
 ParticleSystemData2 (const ParticleSystemData2 &other)
 Copy constructor. More...
 
virtual ~ParticleSystemData2 ()
 Destructor. More...
 
void resize (size_t newNumberOfParticles)
 Resizes the number of particles of the container. More...
 
size_t numberOfParticles () 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 Vector2D &initialVal=Vector2D())
 Adds a vector data layer and returns its index. More...
 
double radius () const
 Returns the radius of the particles. More...
 
virtual void setRadius (double newRadius)
 Sets the radius of the particles. More...
 
double mass () const
 Returns the mass of the particles. More...
 
virtual void setMass (double newMass)
 Sets the mass of the particles. More...
 
ConstArrayAccessor1< Vector2Dpositions () const
 Returns the position array (immutable). More...
 
ArrayAccessor1< Vector2Dpositions ()
 Returns the position array (mutable). More...
 
ConstArrayAccessor1< Vector2Dvelocities () const
 Returns the velocity array (immutable). More...
 
ArrayAccessor1< Vector2Dvelocities ()
 Returns the velocity array (mutable). More...
 
ConstArrayAccessor1< Vector2Dforces () const
 Returns the force array (immutable). More...
 
ArrayAccessor1< Vector2Dforces ()
 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< Vector2DvectorDataAt (size_t idx) const
 Returns custom vector data layer at given index (immutable). More...
 
ArrayAccessor1< Vector2DvectorDataAt (size_t idx)
 Returns custom vector data layer at given index (mutable). More...
 
void addParticle (const Vector2D &newPosition, const Vector2D &newVelocity=Vector2D(), const Vector2D &newForce=Vector2D())
 Adds a particle to the data structure. More...
 
void addParticles (const ConstArrayAccessor1< Vector2D > &newPositions, const ConstArrayAccessor1< Vector2D > &newVelocities=ConstArrayAccessor1< Vector2D >(), const ConstArrayAccessor1< Vector2D > &newForces=ConstArrayAccessor1< Vector2D >())
 Adds particles to the data structure. More...
 
const PointNeighborSearcher2PtrneighborSearcher () const
 Returns neighbor searcher. More...
 
void setNeighborSearcher (const PointNeighborSearcher2Ptr &newNeighborSearcher)
 Sets neighbor searcher. More...
 
const std::vector< std::vector< size_t > > & neighborLists () 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 ParticleSystemData2 &other)
 Copies from other particle system data. More...
 
ParticleSystemData2operator= (const ParticleSystemData2 &other)
 Copies from other particle system data. More...
 
- Public Member Functions inherited from jet::Serializable
 Serializable ()=default
 
virtual ~Serializable ()=default
 

Protected Member Functions

void serializeParticleSystemData (flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData2 > *fbsParticleSystemData) const
 
void deserializeParticleSystemData (const fbs::ParticleSystemData2 *fbsParticleSystemData)
 

Detailed Description

2-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

Vector data chunk.

Constructor & Destructor Documentation

◆ ParticleSystemData2() [1/3]

jet::ParticleSystemData2::ParticleSystemData2 ( )

Default constructor.

◆ ParticleSystemData2() [2/3]

jet::ParticleSystemData2::ParticleSystemData2 ( size_t  numberOfParticles)
explicit

Constructs particle system data with given number of particles.

◆ ParticleSystemData2() [3/3]

jet::ParticleSystemData2::ParticleSystemData2 ( const ParticleSystemData2 other)

Copy constructor.

◆ ~ParticleSystemData2()

virtual jet::ParticleSystemData2::~ParticleSystemData2 ( )
virtual

Destructor.

Member Function Documentation

◆ addParticle()

void jet::ParticleSystemData2::addParticle ( const Vector2D newPosition,
const Vector2D newVelocity = Vector2D(),
const Vector2D newForce = Vector2D() 
)

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 ParticleSystemData2::buildNeighborSearcher and ParticleSystemData2::buildNeighborLists to refresh those data.

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

◆ addParticles()

void jet::ParticleSystemData2::addParticles ( const ConstArrayAccessor1< Vector2D > &  newPositions,
const ConstArrayAccessor1< Vector2D > &  newVelocities = ConstArrayAccessor1Vector2D >(),
const ConstArrayAccessor1< Vector2D > &  newForces = ConstArrayAccessor1Vector2D >() 
)

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 ParticleSystemData2::buildNeighborSearcher and ParticleSystemData2::buildNeighborLists to refresh those data.

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

◆ addScalarData()

size_t jet::ParticleSystemData2::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.

\params[in] initialVal Initial value of the new scalar data.

◆ addVectorData()

size_t jet::ParticleSystemData2::addVectorData ( const Vector2D initialVal = Vector2D())

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.

\params[in] initialVal Initial value of the new vector data.

◆ buildNeighborLists()

void jet::ParticleSystemData2::buildNeighborLists ( double  maxSearchRadius)

Builds neighbor lists with given search radius.

◆ buildNeighborSearcher()

void jet::ParticleSystemData2::buildNeighborSearcher ( double  maxSearchRadius)

Builds neighbor searcher with given search radius.

◆ deserialize()

void jet::ParticleSystemData2::deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Deserializes this particle system data from the buffer.

Implements jet::Serializable.

Reimplemented in jet::SphSystemData2.

◆ deserializeParticleSystemData()

void jet::ParticleSystemData2::deserializeParticleSystemData ( const fbs::ParticleSystemData2 *  fbsParticleSystemData)
protected

◆ forces() [1/2]

ArrayAccessor1<Vector2D> jet::ParticleSystemData2::forces ( )

Returns the force array (mutable).

◆ forces() [2/2]

ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::forces ( ) const

Returns the force array (immutable).

◆ mass()

double jet::ParticleSystemData2::mass ( ) const

Returns the mass of the particles.

◆ neighborLists()

const std::vector<std::vector<size_t> >& jet::ParticleSystemData2::neighborLists ( ) const

Returns neighbor lists.

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

Returns
Neighbor lists.

◆ neighborSearcher()

const PointNeighborSearcher2Ptr& jet::ParticleSystemData2::neighborSearcher ( ) const

Returns neighbor searcher.

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

Returns
Current neighbor searcher.

◆ numberOfParticles()

size_t jet::ParticleSystemData2::numberOfParticles ( ) const

Returns the number of particles.

◆ operator=()

ParticleSystemData2& jet::ParticleSystemData2::operator= ( const ParticleSystemData2 other)

Copies from other particle system data.

◆ positions() [1/2]

ArrayAccessor1<Vector2D> jet::ParticleSystemData2::positions ( )

Returns the position array (mutable).

◆ positions() [2/2]

ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::positions ( ) const

Returns the position array (immutable).

◆ radius()

double jet::ParticleSystemData2::radius ( ) const

Returns the radius of the particles.

◆ resize()

void jet::ParticleSystemData2::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 ParticleSystemData2::buildNeighborSearcher and ParticleSystemData2::buildNeighborLists to refresh those data.

Parameters
[in]newNumberOfParticlesNew number of particles.

◆ scalarDataAt() [1/2]

ArrayAccessor1<double> jet::ParticleSystemData2::scalarDataAt ( size_t  idx)

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

◆ scalarDataAt() [2/2]

ConstArrayAccessor1<double> jet::ParticleSystemData2::scalarDataAt ( size_t  idx) const

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

◆ serialize()

void jet::ParticleSystemData2::serialize ( std::vector< uint8_t > *  buffer) const
overridevirtual

Serializes this particle system data to the buffer.

Implements jet::Serializable.

Reimplemented in jet::SphSystemData2.

◆ serializeParticleSystemData()

void jet::ParticleSystemData2::serializeParticleSystemData ( flatbuffers::FlatBufferBuilder *  builder,
flatbuffers::Offset< fbs::ParticleSystemData2 > *  fbsParticleSystemData 
) const
protected

◆ set()

void jet::ParticleSystemData2::set ( const ParticleSystemData2 other)

Copies from other particle system data.

◆ setMass()

virtual void jet::ParticleSystemData2::setMass ( double  newMass)
virtual

Sets the mass of the particles.

Reimplemented in jet::SphSystemData2.

◆ setNeighborSearcher()

void jet::ParticleSystemData2::setNeighborSearcher ( const PointNeighborSearcher2Ptr newNeighborSearcher)

Sets neighbor searcher.

◆ setRadius()

virtual void jet::ParticleSystemData2::setRadius ( double  newRadius)
virtual

Sets the radius of the particles.

Reimplemented in jet::SphSystemData2.

◆ vectorDataAt() [1/2]

ArrayAccessor1<Vector2D> jet::ParticleSystemData2::vectorDataAt ( size_t  idx)

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

◆ vectorDataAt() [2/2]

ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::vectorDataAt ( size_t  idx) const

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

◆ velocities() [1/2]

ArrayAccessor1<Vector2D> jet::ParticleSystemData2::velocities ( )

Returns the velocity array (mutable).

◆ velocities() [2/2]

ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::velocities ( ) const

Returns the velocity array (immutable).


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