Jet
v1.3.3
|
3-D SPH particle system data. More...
#include <jet/sph_system_data3.h>
Public Member Functions | |
SphSystemData3 () | |
Constructs empty SPH system. More... | |
SphSystemData3 (size_t numberOfParticles) | |
Constructs SPH system data with given number of particles. More... | |
SphSystemData3 (const SphSystemData3 &other) | |
Copy constructor. More... | |
virtual | ~SphSystemData3 () |
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... | |
void | setKernelRadius (double kernelRadius) |
Sets the absolute kernel radius. More... | |
double | relativeKernelRadius () const |
Returns the relative kernel radius. More... | |
double | kernelRadius () const |
Returns the kernel radius in meters unit. More... | |
double | sumOfKernelNearby (const Vector3D &position) const |
Returns sum of kernel function evaluation for each nearby particle. More... | |
double | interpolate (const Vector3D &origin, const ConstArrayAccessor1< double > &values) const |
Returns interpolated value at given origin point. More... | |
Vector3D | interpolate (const Vector3D &origin, const ConstArrayAccessor1< Vector3D > &values) const |
Returns interpolated vector value at given origin point. More... | |
Vector3D | gradientAt (size_t i, const ConstArrayAccessor1< double > &values) const |
Returns the gradient of the given values at i-th particle. More... | |
double | laplacianAt (size_t i, const ConstArrayAccessor1< double > &values) const |
Returns the laplacian of the given values at i-th particle. More... | |
Vector3D | laplacianAt (size_t i, const ConstArrayAccessor1< Vector3D > &values) const |
Returns the laplacian of the given values at i-th particle. More... | |
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 SphSystemData3 &other) |
Copies from other SPH system data. More... | |
SphSystemData3 & | operator= (const SphSystemData3 &other) |
Copies from other SPH system data. More... | |
![]() | |
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 | 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 Vector3D &initialVal=Vector3D()) |
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< Vector3D > | positions () const |
Returns the position array (immutable). More... | |
ArrayAccessor1< Vector3D > | positions () |
Returns the position array (mutable). More... | |
ConstArrayAccessor1< Vector3D > | velocities () const |
Returns the velocity array (immutable). More... | |
ArrayAccessor1< Vector3D > | velocities () |
Returns the velocity array (mutable). More... | |
ConstArrayAccessor1< Vector3D > | forces () const |
Returns the force array (immutable). More... | |
ArrayAccessor1< Vector3D > | 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< Vector3D > | vectorDataAt (size_t idx) const |
Returns custom vector data layer at given index (immutable). More... | |
ArrayAccessor1< Vector3D > | vectorDataAt (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 PointNeighborSearcher3Ptr & | neighborSearcher () const |
Returns neighbor searcher. More... | |
void | setNeighborSearcher (const PointNeighborSearcher3Ptr &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 ParticleSystemData3 &other) |
Copies from other particle system data. More... | |
ParticleSystemData3 & | operator= (const ParticleSystemData3 &other) |
Copies from other particle system data. More... | |
![]() | |
Serializable ()=default | |
virtual | ~Serializable ()=default |
Additional Inherited Members | |
![]() | |
typedef Array1< double > | ScalarData |
Scalar data chunk. More... | |
typedef Array1< Vector3D > | VectorData |
Vector data chunk. More... | |
![]() | |
void | serializeParticleSystemData (flatbuffers::FlatBufferBuilder *builder, flatbuffers::Offset< fbs::ParticleSystemData3 > *fbsParticleSystemData) const |
void | deserializeParticleSystemData (const fbs::ParticleSystemData3 *fbsParticleSystemData) |
3-D SPH particle system data.
This class extends ParticleSystemData3 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.
jet::SphSystemData3::SphSystemData3 | ( | ) |
Constructs empty SPH system.
|
explicit |
Constructs SPH system data with given number of particles.
jet::SphSystemData3::SphSystemData3 | ( | const SphSystemData3 & | other | ) |
Copy constructor.
|
virtual |
Destructor.
void jet::SphSystemData3::buildNeighborLists | ( | ) |
Builds neighbor lists with kernel radius.
void jet::SphSystemData3::buildNeighborSearcher | ( | ) |
Builds neighbor searcher with kernel radius.
ArrayAccessor1<double> jet::SphSystemData3::densities | ( | ) |
Returns the density array accessor (mutable).
ConstArrayAccessor1<double> jet::SphSystemData3::densities | ( | ) | const |
Returns the density array accessor (immutable).
|
overridevirtual |
Deserializes this SPH system data from the buffer.
Reimplemented from jet::ParticleSystemData3.
Vector3D jet::SphSystemData3::gradientAt | ( | size_t | i, |
const ConstArrayAccessor1< double > & | values | ||
) | const |
Returns the gradient of the given values at i-th particle.
double jet::SphSystemData3::interpolate | ( | const Vector3D & | 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.
Vector3D jet::SphSystemData3::interpolate | ( | const Vector3D & | origin, |
const ConstArrayAccessor1< Vector3D > & | 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.
double jet::SphSystemData3::kernelRadius | ( | ) | const |
Returns the kernel radius in meters unit.
double jet::SphSystemData3::laplacianAt | ( | size_t | i, |
const ConstArrayAccessor1< double > & | values | ||
) | const |
Returns the laplacian of the given values at i-th particle.
Vector3D jet::SphSystemData3::laplacianAt | ( | size_t | i, |
const ConstArrayAccessor1< Vector3D > & | values | ||
) | const |
Returns the laplacian of the given values at i-th particle.
SphSystemData3& jet::SphSystemData3::operator= | ( | const SphSystemData3 & | other | ) |
Copies from other SPH system data.
ArrayAccessor1<double> jet::SphSystemData3::pressures | ( | ) |
Returns the pressure array accessor (mutable).
ConstArrayAccessor1<double> jet::SphSystemData3::pressures | ( | ) | const |
Returns the pressure array accessor (immutable).
double jet::SphSystemData3::relativeKernelRadius | ( | ) | const |
Returns the relative kernel radius.
Returns the relative kernel radius compared to the target particle spacing (i.e. kernel radius / target spacing).
|
overridevirtual |
Serializes this SPH system data to the buffer.
Reimplemented from jet::ParticleSystemData3.
void jet::SphSystemData3::set | ( | const SphSystemData3 & | other | ) |
Copies from other SPH system data.
void jet::SphSystemData3::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).
|
overridevirtual |
Sets the mass of a particle.
Setting the mass of a particle will change the target density.
[in] | newMass | The new mass. |
Reimplemented from jet::ParticleSystemData3.
|
overridevirtual |
Sets the radius.
Sets the radius of the particle system. The radius will be interpreted as target spacing.
Reimplemented from jet::ParticleSystemData3.
void jet::SphSystemData3::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).
void jet::SphSystemData3::setTargetDensity | ( | double | targetDensity | ) |
Sets the target density of this particle system.
void jet::SphSystemData3::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).
double jet::SphSystemData3::sumOfKernelNearby | ( | const Vector3D & | position | ) | const |
Returns sum of kernel function evaluation for each nearby particle.
double jet::SphSystemData3::targetDensity | ( | ) | const |
Returns the target density of this particle system.
double jet::SphSystemData3::targetSpacing | ( | ) | const |
Returns the target particle spacing in meters.
void jet::SphSystemData3::updateDensities | ( | ) |
Updates the density array with the latest particle positions.