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

2-D SPH particle system data. More...

#include <jet/sph_system_data2.h>

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

Public Member Functions

 SphSystemData2 ()
 Constructs empty SPH system. More...
 
 SphSystemData2 (size_t numberOfParticles)
 Constructs SPH system data with given number of particles. More...
 
 SphSystemData2 (const SphSystemData2 &other)
 Copy constructor. More...
 
virtual ~SphSystemData2 ()
 Destructor. More...
 
void setRadius (double newRadius) override
 Sets the radius. More...
 
void setMass (double newMass) override
 Sets the mass of a particle. More...
 
ConstArrayAccessor1< double > densities () const
 Returns the density array accessor (immutable). More...
 
ArrayAccessor1< double > densities ()
 Returns the density array accessor (mutable). More...
 
ConstArrayAccessor1< double > pressures () const
 Returns the pressure array accessor (immutable). More...
 
ArrayAccessor1< double > pressures ()
 Returns the pressure array accessor (mutable). More...
 
void updateDensities ()
 Updates the density array with the latest particle positions. More...
 
void setTargetDensity (double targetDensity)
 Sets the target density of this particle system. More...
 
double targetDensity () const
 Returns the target density of this particle system. More...
 
void setTargetSpacing (double spacing)
 Sets the target particle spacing in meters. More...
 
double targetSpacing () const
 Returns the target particle spacing in meters. More...
 
void setRelativeKernelRadius (double relativeRadius)
 Sets the relative kernel radius. More...
 
double relativeKernelRadius () const
 Returns the relative kernel radius. More...
 
void setKernelRadius (double kernelRadius)
 Sets the absolute kernel radius. More...
 
double kernelRadius () const
 Returns the kernel radius in meters unit. More...
 
double sumOfKernelNearby (const Vector2D &position) const
 Returns sum of kernel function evaluation for each nearby particle. More...
 
double interpolate (const Vector2D &origin, const ConstArrayAccessor1< double > &values) const
 Returns interpolated value at given origin point. More...
 
Vector2D interpolate (const Vector2D &origin, const ConstArrayAccessor1< Vector2D > &values) const
 Returns interpolated vector value at given origin point. More...
 
Vector2D gradientAt (size_t i, const ConstArrayAccessor1< double > &values) const
 
double laplacianAt (size_t i, const ConstArrayAccessor1< double > &values) const
 
Vector2D laplacianAt (size_t i, const ConstArrayAccessor1< Vector2D > &values) const
 
void buildNeighborSearcher ()
 Builds neighbor searcher with kernel radius. More...
 
void buildNeighborLists ()
 Builds neighbor lists with kernel radius. More...
 
void serialize (std::vector< uint8_t > *buffer) const override
 Serializes this SPH system data to the buffer. More...
 
void deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes this SPH system data from the buffer. More...
 
void set (const SphSystemData2 &other)
 Copies from other SPH system data. More...
 
SphSystemData2operator= (const SphSystemData2 &other)
 Copies from other SPH system data. More...
 
- Public Member Functions inherited from jet::ParticleSystemData2
 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...
 
double mass () const
 Returns 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 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
 

Additional Inherited Members

- Public Types inherited from jet::ParticleSystemData2
typedef Array1< double > ScalarData
 Scalar data chunk. More...
 
typedef Array1< Vector2DVectorData
 Vector data chunk. More...
 
- Protected Member Functions inherited from jet::ParticleSystemData2
void serializeParticleSystemData (flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData2 > *fbsParticleSystemData) const
 
void deserializeParticleSystemData (const fbs::ParticleSystemData2 *fbsParticleSystemData)
 

Detailed Description

2-D SPH particle system data.

This class extends ParticleSystemData2 to specialize the data model for SPH. It includes density and pressure array as a default particle attribute, and it also contains SPH utilities such as interpolation operator.

Constructor & Destructor Documentation

◆ SphSystemData2() [1/3]

jet::SphSystemData2::SphSystemData2 ( )

Constructs empty SPH system.

◆ SphSystemData2() [2/3]

jet::SphSystemData2::SphSystemData2 ( size_t  numberOfParticles)
explicit

Constructs SPH system data with given number of particles.

◆ SphSystemData2() [3/3]

jet::SphSystemData2::SphSystemData2 ( const SphSystemData2 other)

Copy constructor.

◆ ~SphSystemData2()

virtual jet::SphSystemData2::~SphSystemData2 ( )
virtual

Destructor.

Member Function Documentation

◆ buildNeighborLists()

void jet::SphSystemData2::buildNeighborLists ( )

Builds neighbor lists with kernel radius.

◆ buildNeighborSearcher()

void jet::SphSystemData2::buildNeighborSearcher ( )

Builds neighbor searcher with kernel radius.

◆ densities() [1/2]

ArrayAccessor1<double> jet::SphSystemData2::densities ( )

Returns the density array accessor (mutable).

◆ densities() [2/2]

ConstArrayAccessor1<double> jet::SphSystemData2::densities ( ) const

Returns the density array accessor (immutable).

◆ deserialize()

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

Deserializes this SPH system data from the buffer.

Reimplemented from jet::ParticleSystemData2.

◆ gradientAt()

Vector2D jet::SphSystemData2::gradientAt ( size_t  i,
const ConstArrayAccessor1< double > &  values 
) const

Returns the gradient of the given values at i-th particle.

Warning
You must update the neighbor lists (SphSystemData2::buildNeighborLists) before calling this function.

◆ interpolate() [1/2]

double jet::SphSystemData2::interpolate ( const Vector2D origin,
const ConstArrayAccessor1< double > &  values 
) const

Returns interpolated value at given origin point.

Returns interpolated scalar data from the given position using standard SPH weighted average. The data array should match the particle layout. For example, density or pressure arrays can be used.

Warning
You must update the neighbor searcher (SphSystemData2::buildNeighborSearcher) before calling this function.

◆ interpolate() [2/2]

Vector2D jet::SphSystemData2::interpolate ( const Vector2D origin,
const ConstArrayAccessor1< Vector2D > &  values 
) const

Returns interpolated vector value at given origin point.

Returns interpolated vector data from the given position using standard SPH weighted average. The data array should match the particle layout. For example, velocity or acceleration arrays can be used.

Warning
You must update the neighbor searcher (SphSystemData2::buildNeighborSearcher) before calling this function.

◆ kernelRadius()

double jet::SphSystemData2::kernelRadius ( ) const

Returns the kernel radius in meters unit.

◆ laplacianAt() [1/2]

double jet::SphSystemData2::laplacianAt ( size_t  i,
const ConstArrayAccessor1< double > &  values 
) const

Returns the laplacian of the given values at i-th particle.

Warning
You must update the neighbor lists (SphSystemData2::buildNeighborLists) before calling this function.

◆ laplacianAt() [2/2]

Vector2D jet::SphSystemData2::laplacianAt ( size_t  i,
const ConstArrayAccessor1< Vector2D > &  values 
) const

Returns the laplacian of the given values at i-th particle.

Warning
You must update the neighbor lists (SphSystemData2::buildNeighborLists) before calling this function.

◆ operator=()

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

Copies from other SPH system data.

◆ pressures() [1/2]

ArrayAccessor1<double> jet::SphSystemData2::pressures ( )

Returns the pressure array accessor (mutable).

◆ pressures() [2/2]

ConstArrayAccessor1<double> jet::SphSystemData2::pressures ( ) const

Returns the pressure array accessor (immutable).

◆ relativeKernelRadius()

double jet::SphSystemData2::relativeKernelRadius ( ) const

Returns the relative kernel radius.

Returns the relative kernel radius compared to the target particle spacing (i.e. kernel radius / target spacing).

◆ serialize()

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

Serializes this SPH system data to the buffer.

Reimplemented from jet::ParticleSystemData2.

◆ set()

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

Copies from other SPH system data.

◆ setKernelRadius()

void jet::SphSystemData2::setKernelRadius ( double  kernelRadius)

Sets the absolute kernel radius.

Sets the absolute kernel radius compared to the target particle spacing (i.e. relative kernel radius * target spacing). Once this function is called, hash grid and density should be updated using updateHashGrid() and updateDensities).

◆ setMass()

void jet::SphSystemData2::setMass ( double  newMass)
overridevirtual

Sets the mass of a particle.

Setting the mass of a particle will change the target density.

Parameters
[in]newMassThe new mass.

Reimplemented from jet::ParticleSystemData2.

◆ setRadius()

void jet::SphSystemData2::setRadius ( double  newRadius)
overridevirtual

Sets the radius.

Sets the radius of the particle system. The radius will be interpreted as target spacing.

Reimplemented from jet::ParticleSystemData2.

◆ setRelativeKernelRadius()

void jet::SphSystemData2::setRelativeKernelRadius ( double  relativeRadius)

Sets the relative kernel radius.

Sets the relative kernel radius compared to the target particle spacing (i.e. kernel radius / target spacing). Once this function is called, hash grid and density should be updated using updateHashGrid() and updateDensities).

◆ setTargetDensity()

void jet::SphSystemData2::setTargetDensity ( double  targetDensity)

Sets the target density of this particle system.

◆ setTargetSpacing()

void jet::SphSystemData2::setTargetSpacing ( double  spacing)

Sets the target particle spacing in meters.

Once this function is called, hash grid and density should be updated using updateHashGrid() and updateDensities).

◆ sumOfKernelNearby()

double jet::SphSystemData2::sumOfKernelNearby ( const Vector2D position) const

Returns sum of kernel function evaluation for each nearby particle.

◆ targetDensity()

double jet::SphSystemData2::targetDensity ( ) const

Returns the target density of this particle system.

◆ targetSpacing()

double jet::SphSystemData2::targetSpacing ( ) const

Returns the target particle spacing in meters.

◆ updateDensities()

void jet::SphSystemData2::updateDensities ( )

Updates the density array with the latest particle positions.

This function updates the density array by recalculating each particle's latest nearby particles' position.

Warning
You must update the neighbor searcher (SphSystemData2::buildNeighborSearcher) before calling this function.

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