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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use crate::math::Real;
bitflags::bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[repr(C)]
pub struct SimulationDofs: u32 {
const LOCK_NONE = 0;
const LOCK_X = 1 << 0;
const LOCK_Y = 1 << 1;
#[cfg(feature = "dim3")]
const LOCK_Z = 1 << 2;
}
}
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)]
pub enum BoundaryHandling {
Stick,
Friction,
FrictionZUp, None,
}
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)]
pub enum DamageModel {
CdMpm,
Eigenerosion,
ModifiedEigenerosion,
None,
}
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)]
pub struct SolverParameters {
pub dt: Real,
pub max_substep_dt: Real,
pub max_num_substeps: u32,
pub boundary_handling: BoundaryHandling,
pub damage_model: DamageModel,
pub force_fluids_volume_recomputation: bool,
pub enable_boundary_particle_projection: bool,
pub stop_after_one_substep: bool,
pub simulation_dofs: SimulationDofs,
}
impl Default for SolverParameters {
fn default() -> Self {
SolverParameters {
dt: 1.0 / 60.0,
max_substep_dt: Real::MAX,
max_num_substeps: 1000,
boundary_handling: BoundaryHandling::Friction,
damage_model: DamageModel::None,
force_fluids_volume_recomputation: false,
enable_boundary_particle_projection: false,
stop_after_one_substep: false,
simulation_dofs: SimulationDofs::LOCK_NONE,
}
}
}