Welcome to mirror list, hosted at ThFree Co, Russian Federation.

integrator.hpp « bparticles « simulations « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3a2f1cb6041983070f3270b8c5c674650f64231f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "forces.hpp"
#include "integrator_interface.hpp"

namespace BParticles {

class ConstantVelocityIntegrator : public Integrator {
  std::unique_ptr<AttributesInfo> m_offset_attributes_info;

 public:
  ConstantVelocityIntegrator();

  const AttributesInfo &offset_attributes_info() override;
  void integrate(IntegratorInterface &interface) override;
};

class EulerIntegrator : public Integrator {
 private:
  std::unique_ptr<AttributesInfo> m_offset_attributes_info;
  Vector<Force *> m_forces;

 public:
  EulerIntegrator(ArrayRef<Force *> forces);
  ~EulerIntegrator();

  const AttributesInfo &offset_attributes_info() override;
  void integrate(IntegratorInterface &interface) override;

 private:
  void compute_combined_force(IntegratorInterface &interface, MutableArrayRef<float3> r_force);

  void compute_offsets(IndexMask mask,
                       ArrayRef<float> durations,
                       ArrayRef<float3> last_velocities,
                       ArrayRef<float3> combined_force,
                       MutableArrayRef<float3> r_position_offsets,
                       MutableArrayRef<float3> r_velocity_offsets);
};

}  // namespace BParticles