Jet
v1.3.3
|
2-D particle system data. More...
#include <jet/particle_system_data2.h>
Public Types | |
typedef Array1< double > | ScalarData |
Scalar data chunk. More... | |
typedef Array1< Vector2D > | VectorData |
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< Vector2D > | positions () const |
Returns the position array (immutable). More... | |
ArrayAccessor1< Vector2D > | positions () |
Returns the position array (mutable). More... | |
ConstArrayAccessor1< Vector2D > | velocities () const |
Returns the velocity array (immutable). More... | |
ArrayAccessor1< Vector2D > | velocities () |
Returns the velocity array (mutable). More... | |
ConstArrayAccessor1< Vector2D > | forces () const |
Returns the force array (immutable). More... | |
ArrayAccessor1< Vector2D > | forces () |
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< Vector2D > | vectorDataAt (size_t idx) const |
Returns custom vector data layer at given index (immutable). More... | |
ArrayAccessor1< Vector2D > | vectorDataAt (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 PointNeighborSearcher2Ptr & | neighborSearcher () 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... | |
ParticleSystemData2 & | operator= (const ParticleSystemData2 &other) |
Copies from other particle system data. More... | |
![]() | |
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) |
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.
typedef Array1<double> jet::ParticleSystemData2::ScalarData |
Scalar data chunk.
Vector data chunk.
jet::ParticleSystemData2::ParticleSystemData2 | ( | ) |
Default constructor.
|
explicit |
Constructs particle system data with given number of particles.
jet::ParticleSystemData2::ParticleSystemData2 | ( | const ParticleSystemData2 & | other | ) |
Copy constructor.
|
virtual |
Destructor.
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.
[in] | newPosition | The new position. |
[in] | newVelocity | The new velocity. |
[in] | newForce | The new force. |
void jet::ParticleSystemData2::addParticles | ( | const ConstArrayAccessor1< Vector2D > & | newPositions, |
const ConstArrayAccessor1< Vector2D > & | newVelocities = ConstArrayAccessor1< Vector2D >() , |
||
const ConstArrayAccessor1< Vector2D > & | newForces = ConstArrayAccessor1< Vector2D >() |
||
) |
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.
[in] | newPositions | The new positions. |
[in] | newVelocities | The new velocities. |
[in] | newForces | The new forces. |
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.
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.
void jet::ParticleSystemData2::buildNeighborLists | ( | double | maxSearchRadius | ) |
Builds neighbor lists with given search radius.
void jet::ParticleSystemData2::buildNeighborSearcher | ( | double | maxSearchRadius | ) |
Builds neighbor searcher with given search radius.
|
overridevirtual |
Deserializes this particle system data from the buffer.
Implements jet::Serializable.
Reimplemented in jet::SphSystemData2.
|
protected |
ArrayAccessor1<Vector2D> jet::ParticleSystemData2::forces | ( | ) |
Returns the force array (mutable).
ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::forces | ( | ) | const |
Returns the force array (immutable).
double jet::ParticleSystemData2::mass | ( | ) | const |
Returns the mass of the particles.
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.
const PointNeighborSearcher2Ptr& jet::ParticleSystemData2::neighborSearcher | ( | ) | const |
Returns neighbor searcher.
This function returns currently set neighbor searcher object. By default, PointParallelHashGridSearcher2 is used.
size_t jet::ParticleSystemData2::numberOfParticles | ( | ) | const |
Returns the number of particles.
ParticleSystemData2& jet::ParticleSystemData2::operator= | ( | const ParticleSystemData2 & | other | ) |
Copies from other particle system data.
ArrayAccessor1<Vector2D> jet::ParticleSystemData2::positions | ( | ) |
Returns the position array (mutable).
ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::positions | ( | ) | const |
Returns the position array (immutable).
double jet::ParticleSystemData2::radius | ( | ) | const |
Returns the radius of the particles.
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.
[in] | newNumberOfParticles | New number of particles. |
ArrayAccessor1<double> jet::ParticleSystemData2::scalarDataAt | ( | size_t | idx | ) |
Returns custom scalar data layer at given index (mutable).
ConstArrayAccessor1<double> jet::ParticleSystemData2::scalarDataAt | ( | size_t | idx | ) | const |
Returns custom scalar data layer at given index (immutable).
|
overridevirtual |
Serializes this particle system data to the buffer.
Implements jet::Serializable.
Reimplemented in jet::SphSystemData2.
|
protected |
void jet::ParticleSystemData2::set | ( | const ParticleSystemData2 & | other | ) |
Copies from other particle system data.
|
virtual |
Sets the mass of the particles.
Reimplemented in jet::SphSystemData2.
void jet::ParticleSystemData2::setNeighborSearcher | ( | const PointNeighborSearcher2Ptr & | newNeighborSearcher | ) |
Sets neighbor searcher.
|
virtual |
Sets the radius of the particles.
Reimplemented in jet::SphSystemData2.
ArrayAccessor1<Vector2D> jet::ParticleSystemData2::vectorDataAt | ( | size_t | idx | ) |
Returns custom vector data layer at given index (mutable).
ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::vectorDataAt | ( | size_t | idx | ) | const |
Returns custom vector data layer at given index (immutable).
ArrayAccessor1<Vector2D> jet::ParticleSystemData2::velocities | ( | ) |
Returns the velocity array (mutable).
ConstArrayAccessor1<Vector2D> jet::ParticleSystemData2::velocities | ( | ) | const |
Returns the velocity array (immutable).