11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SPH_SOLVER_BASE2_HPP 12 #define CUBBYFLOW_CUDA_PARTICLE_SPH_SOLVER_BASE2_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 25 class CUDASPHSolverBase2 :
public CUDAParticleSystemSolverBase2
32 CUDASPHSolverBase2(
const CUDASPHSolverBase2&) =
delete;
35 CUDASPHSolverBase2(CUDASPHSolverBase2&&) noexcept = delete;
38 ~CUDASPHSolverBase2() override = default;
41 CUDASPHSolverBase2& operator=(const CUDASPHSolverBase2&) = delete;
44 CUDASPHSolverBase2& operator=(CUDASPHSolverBase2&&) noexcept = delete;
51 float NegativePressureScale() const;
61 void SetNegativePressureScale(
float newNegativePressureScale);
64 float ViscosityCoefficient() const;
67 void SetViscosityCoefficient(
float newViscosityCoefficient);
75 float PseudoViscosityCoefficient() const;
78 void SetPseudoViscosityCoefficient(
float newPseudoViscosityCoefficient);
87 float SpeedOfSound() const;
90 void SetSpeedOfSound(
float newSpeedOfSound);
99 float TimeStepLimitScale() const;
102 void SetTimeStepLimitScale(
float newScale);
121 CUDAParticleSystemData2* ParticleSystemData() override;
129 const CUDAParticleSystemData2* ParticleSystemData() const override;
137 CUDASPHSystemData2* SPHSystemData();
145 const CUDASPHSystemData2* SPHSystemData() const;
149 unsigned int GetNumberOfSubTimeSteps(
150 double timeIntervalInSeconds) const override;
152 CUDAArrayView1<float2> Forces() const;
154 CUDAArrayView1<float2> SmoothedVelocities() const;
159 size_t m_smoothedVelIdx;
160 float m_negativePressureScale = 0.0f;
161 float m_viscosityCoefficient = 0.01f;
162 float m_pseudoViscosityCoefficient = 10.0f;
163 float m_speedOfSound = 100.0f;
164 float m_timeStepLimitScale = 1.0f;
169 CUDASPHSystemData2Ptr m_sphSystemData;
173 using CUDASPHSolverBase2Ptr = std::shared_ptr<CUDASPHSolverBase2>;
178 template <
typename DerivedBuilder>
179 class CUDASPHSolverBuilderBase2
180 :
public CUDAParticleSystemSolverBuilderBase2<DerivedBuilder>
184 DerivedBuilder& WithTargetDensity(
float targetDensity);
187 DerivedBuilder& WithTargetSpacing(
float targetSpacing);
190 DerivedBuilder& WithRelativeKernelRadius(
float relativeKernelRadius);
193 DerivedBuilder& WithNegativePressureScale(
float negativePressureScale);
196 DerivedBuilder& WithViscosityCoefficient(
float viscosityCoefficient);
199 DerivedBuilder& WithPseudoViscosityCoefficient(
200 float pseudoViscosityCoefficient);
204 float m_targetSpacing = 0.1f;
205 float m_relativeKernelRadius = 1.8f;
206 float m_negativePressureScale = 0.0f;
207 float m_viscosityCoefficient = 0.01f;
208 float m_pseudoViscosityCoefficient = 10.0f;
211 template <
typename T>
212 T& CUDASPHSolverBuilderBase2<T>::WithTargetDensity(
float targetDensity)
214 m_targetDensity = targetDensity;
215 return static_cast<T&
>(*this);
218 template <
typename T>
219 T& CUDASPHSolverBuilderBase2<T>::WithTargetSpacing(
float targetSpacing)
221 m_targetSpacing = targetSpacing;
222 return static_cast<T&
>(*this);
225 template <
typename T>
226 T& CUDASPHSolverBuilderBase2<T>::WithRelativeKernelRadius(
227 float relativeKernelRadius)
229 m_relativeKernelRadius = relativeKernelRadius;
230 return static_cast<T&
>(*this);
233 template <
typename T>
234 T& CUDASPHSolverBuilderBase2<T>::WithNegativePressureScale(
235 float negativePressureScale)
237 m_negativePressureScale = negativePressureScale;
238 return static_cast<T&
>(*this);
241 template <
typename T>
242 T& CUDASPHSolverBuilderBase2<T>::WithViscosityCoefficient(
243 float viscosityCoefficient)
245 m_viscosityCoefficient = viscosityCoefficient;
246 return static_cast<T&
>(*this);
249 template <
typename T>
250 T& CUDASPHSolverBuilderBase2<T>::WithPseudoViscosityCoefficient(
251 float pseudoViscosityCoefficient)
253 m_pseudoViscosityCoefficient = pseudoViscosityCoefficient;
254 return static_cast<T&
>(*this);
BoundingBox2< float > BoundingBox2F
Definition: BoundingBox.hpp:157
constexpr float WATER_DENSITY_FLOAT
Water density.
Definition: Constants.hpp:302
Definition: pybind11Utils.hpp:20
Vector2< float > Vector2F
Definition: Matrix.hpp:773