Jet  v1.3.3
sph_system_data3.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_SPH_SYSTEM_DATA3_H_
8 #define INCLUDE_JET_SPH_SYSTEM_DATA3_H_
9 
10 #include <jet/constants.h>
12 #include <vector>
13 
14 namespace jet {
15 
24  public:
27 
30 
33 
35  virtual ~SphSystemData3();
36 
43  void setRadius(double newRadius) override;
44 
52  void setMass(double newMass) override;
53 
56 
59 
62 
65 
68 
71 
73  double targetDensity() const;
74 
81  void setTargetSpacing(double spacing);
82 
84  double targetSpacing() const;
85 
94  void setRelativeKernelRadius(double relativeRadius);
95 
105 
112  double relativeKernelRadius() const;
113 
115  double kernelRadius() const;
116 
118  double sumOfKernelNearby(const Vector3D& position) const;
119 
128  double interpolate(const Vector3D& origin,
129  const ConstArrayAccessor1<double>& values) const;
130 
140  const ConstArrayAccessor1<Vector3D>& values) const;
141 
144  const ConstArrayAccessor1<double>& values) const;
145 
147  double laplacianAt(size_t i,
148  const ConstArrayAccessor1<double>& values) const;
149 
152  const ConstArrayAccessor1<Vector3D>& values) const;
153 
156 
159 
161  void serialize(std::vector<uint8_t>* buffer) const override;
162 
164  void deserialize(const std::vector<uint8_t>& buffer) override;
165 
167  void set(const SphSystemData3& other);
168 
171 
172  private:
174  double _targetDensity = kWaterDensity;
175 
177  double _targetSpacing = 0.1;
178 
181  double _kernelRadiusOverTargetSpacing = 1.8;
182 
184  double _kernelRadius;
185 
186  size_t _pressureIdx;
187 
188  size_t _densityIdx;
189 
191  void computeMass();
192 };
193 
195 typedef std::shared_ptr<SphSystemData3> SphSystemData3Ptr;
196 
197 } // namespace jet
198 
199 #endif // INCLUDE_JET_SPH_SYSTEM_DATA3_H_
jet::SphSystemData3::SphSystemData3
SphSystemData3()
Constructs empty SPH system.
jet::ParticleSystemData3
3-D particle system data.
Definition: particle_system_data3.h:45
jet::SphSystemData3Ptr
std::shared_ptr< SphSystemData3 > SphSystemData3Ptr
Shared pointer for the SphSystemData3 type.
Definition: sph_system_data3.h:195
jet::SphSystemData3::setRelativeKernelRadius
void setRelativeKernelRadius(double relativeRadius)
Sets the relative kernel radius.
jet::SphSystemData3::setKernelRadius
void setKernelRadius(double kernelRadius)
Sets the absolute kernel radius.
jet::ConstArrayAccessor< T, 1 >
1-D read-only array accessor class.
Definition: array_accessor1.h:184
jet::SphSystemData3::setTargetSpacing
void setTargetSpacing(double spacing)
Sets the target particle spacing in meters.
jet::SphSystemData3
3-D SPH particle system data.
Definition: sph_system_data3.h:23
jet::ParticleSystemData3::numberOfParticles
size_t numberOfParticles() const
Returns the number of particles.
jet::SphSystemData3::relativeKernelRadius
double relativeKernelRadius() const
Returns the relative kernel radius.
jet::SphSystemData3::setRadius
void setRadius(double newRadius) override
Sets the radius.
jet::SphSystemData3::pressures
ConstArrayAccessor1< double > pressures() const
Returns the pressure array accessor (immutable).
jet::SphSystemData3::buildNeighborLists
void buildNeighborLists()
Builds neighbor lists with kernel radius.
jet::SphSystemData3::kernelRadius
double kernelRadius() const
Returns the kernel radius in meters unit.
jet::SphSystemData3::updateDensities
void updateDensities()
Updates the density array with the latest particle positions.
particle_system_data3.h
jet::SphSystemData3::SphSystemData3
SphSystemData3(size_t numberOfParticles)
Constructs SPH system data with given number of particles.
jet::SphSystemData3::serialize
void serialize(std::vector< uint8_t > *buffer) const override
Serializes this SPH system data to the buffer.
jet
Definition: advection_solver2.h:18
jet::SphSystemData3::densities
ArrayAccessor1< double > densities()
Returns the density array accessor (mutable).
jet::SphSystemData3::interpolate
Vector3D interpolate(const Vector3D &origin, const ConstArrayAccessor1< Vector3D > &values) const
Returns interpolated vector value at given origin point.
jet::SphSystemData3::laplacianAt
Vector3D laplacianAt(size_t i, const ConstArrayAccessor1< Vector3D > &values) const
Returns the laplacian of the given values at i-th particle.
jet::SphSystemData3::deserialize
void deserialize(const std::vector< uint8_t > &buffer) override
Deserializes this SPH system data from the buffer.
jet::SphSystemData3::densities
ConstArrayAccessor1< double > densities() const
Returns the density array accessor (immutable).
jet::SphSystemData3::~SphSystemData3
virtual ~SphSystemData3()
Destructor.
jet::SphSystemData3::interpolate
double interpolate(const Vector3D &origin, const ConstArrayAccessor1< double > &values) const
Returns interpolated value at given origin point.
jet::SphSystemData3::buildNeighborSearcher
void buildNeighborSearcher()
Builds neighbor searcher with kernel radius.
constants.h
jet::SphSystemData3::setMass
void setMass(double newMass) override
Sets the mass of a particle.
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::SphSystemData3::set
void set(const SphSystemData3 &other)
Copies from other SPH system data.
jet::SphSystemData3::pressures
ArrayAccessor1< double > pressures()
Returns the pressure array accessor (mutable).
jet::SphSystemData3::setTargetDensity
void setTargetDensity(double targetDensity)
Sets the target density of this particle system.
jet::SphSystemData3::SphSystemData3
SphSystemData3(const SphSystemData3 &other)
Copy constructor.
jet::SphSystemData3::gradientAt
Vector3D gradientAt(size_t i, const ConstArrayAccessor1< double > &values) const
Returns the gradient of the given values at i-th particle.
jet::SphSystemData3::targetDensity
double targetDensity() const
Returns the target density of this particle system.
jet::SphSystemData3::sumOfKernelNearby
double sumOfKernelNearby(const Vector3D &position) const
Returns sum of kernel function evaluation for each nearby particle.
jet::kWaterDensity
constexpr double kWaterDensity
Water density.
Definition: constants.h:304
jet::SphSystemData3::laplacianAt
double laplacianAt(size_t i, const ConstArrayAccessor1< double > &values) const
Returns the laplacian of the given values at i-th particle.
jet::SphSystemData3::targetSpacing
double targetSpacing() const
Returns the target particle spacing in meters.
jet::ArrayAccessor< T, 1 >
1-D array accessor class.
Definition: array_accessor1.h:27
jet::SphSystemData3::operator=
SphSystemData3 & operator=(const SphSystemData3 &other)
Copies from other SPH system data.