11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SPH_SOLVER_BASE3_HPP 12 #define CUBBYFLOW_CUDA_PARTICLE_SPH_SOLVER_BASE3_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 25 class CUDASPHSolverBase3 :
public CUDAParticleSystemSolverBase3
32 CUDASPHSolverBase3(
const CUDASPHSolverBase3&) =
delete;
35 CUDASPHSolverBase3(CUDASPHSolverBase3&&) noexcept = delete;
38 ~CUDASPHSolverBase3() override = default;
41 CUDASPHSolverBase3& operator=(const CUDASPHSolverBase3&) = delete;
44 CUDASPHSolverBase3& operator=(CUDASPHSolverBase3&&) 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 CUDAParticleSystemData3* ParticleSystemData() override;
129 const CUDAParticleSystemData3* ParticleSystemData() const override;
137 CUDASPHSystemData3* SPHSystemData();
145 const CUDASPHSystemData3* SPHSystemData() const;
149 unsigned int GetNumberOfSubTimeSteps(
150 double timeIntervalInSeconds) const override;
152 CUDAArrayView1<float4> Forces() const;
154 CUDAArrayView1<float4> 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;
168 CUDASPHSystemData3Ptr m_sphSystemData;
172 using CUDASPHSolverBase3Ptr = std::shared_ptr<CUDASPHSolverBase3>;
177 template <typename DerivedBuilder>
178 class CUDASPHSolverBuilderBase3
179 : public CUDAParticleSystemSolverBuilderBase3<DerivedBuilder>
183 DerivedBuilder& WithTargetDensity(
float targetDensity);
186 DerivedBuilder& WithTargetSpacing(
float targetSpacing);
189 DerivedBuilder& WithRelativeKernelRadius(
float relativeKernelRadius);
192 DerivedBuilder& WithNegativePressureScale(
float negativePressureScale);
195 DerivedBuilder& WithViscosityCoefficient(
float viscosityCoefficient);
198 DerivedBuilder& WithPseudoViscosityCoefficient(
199 float pseudoViscosityCoefficient);
203 float m_targetSpacing = 0.1f;
204 float m_relativeKernelRadius = 1.8f;
205 float m_negativePressureScale = 0.0f;
206 float m_viscosityCoefficient = 0.01f;
207 float m_pseudoViscosityCoefficient = 10.0f;
210 template <
typename T>
211 T& CUDASPHSolverBuilderBase3<T>::WithTargetDensity(
float targetDensity)
213 m_targetDensity = targetDensity;
214 return static_cast<T&
>(*this);
217 template <
typename T>
218 T& CUDASPHSolverBuilderBase3<T>::WithTargetSpacing(
float targetSpacing)
220 m_targetSpacing = targetSpacing;
221 return static_cast<T&
>(*this);
224 template <
typename T>
225 T& CUDASPHSolverBuilderBase3<T>::WithRelativeKernelRadius(
226 float relativeKernelRadius)
228 m_relativeKernelRadius = relativeKernelRadius;
229 return static_cast<T&
>(*this);
232 template <
typename T>
233 T& CUDASPHSolverBuilderBase3<T>::WithNegativePressureScale(
234 float negativePressureScale)
236 m_negativePressureScale = negativePressureScale;
237 return static_cast<T&
>(*this);
240 template <
typename T>
241 T& CUDASPHSolverBuilderBase3<T>::WithViscosityCoefficient(
242 float viscosityCoefficient)
244 m_viscosityCoefficient = viscosityCoefficient;
245 return static_cast<T&
>(*this);
248 template <
typename T>
249 T& CUDASPHSolverBuilderBase3<T>::WithPseudoViscosityCoefficient(
250 float pseudoViscosityCoefficient)
252 m_pseudoViscosityCoefficient = pseudoViscosityCoefficient;
253 return static_cast<T&
>(*this);
BoundingBox3< float > BoundingBox3F
Definition: BoundingBox.hpp:161
constexpr float WATER_DENSITY_FLOAT
Water density.
Definition: Constants.hpp:302
Definition: pybind11Utils.hpp:20