-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaterial.h
100 lines (83 loc) · 1.67 KB
/
Material.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef MATERIAL_H
#define MATERIAL_H
#define PI 3.14159265359
class Material {
public:
Material(float density, float vol, int particles, float h) {
m_density = density;
m_volume = vol;
m_particles = particles;
//m_mass = 0.02f;
m_mass = density * (vol / particles);
m_radius = 0.01f;
//m_radius = pow((float) ((3.0f * m_mass) / (4.0f * PI * m_density)), (float) (1.0/3.0));
m_h = h;
m_support = pow((float) ((3.0f * vol * 20.0f) / (4.0f * PI * particles)) , 1/3.0f);
};
float getMass() {
return m_mass;
};
float getDensity() {
return m_density;
};
float getNumParticles() {
return m_particles;
};
float getVolume() {
return m_volume;
};
float getH() {
return m_h;
};
float getRadius() {
return m_radius;
};
float getRestPressure() {
return m_restPressure;
};
float getK() {
return m_k;
};
float getViscosity() {
return m_viscosity;
};
float getSupport() {
return m_support;
};
float getSurfaceTension() {
return m_surfaceTension;
};
protected:
float m_mass;
float m_density;
float m_volume;
int m_particles;
float m_radius;
float m_h;
float m_restPressure;
float m_k;
float m_viscosity;
float m_support;
float m_surfaceTension;
};
class Water:public Material {
public:
Water(int particles):Material(1000, 0.02/1000 * particles, particles, 0.05) {
m_restPressure = 1000.0f;
m_k = 3.5f;
m_viscosity = 3.5f;
m_support = 0.1f;
m_surfaceTension = 0.07f;
}
};
class Ferro: public Material {
public:
Ferro( int particles):Material(1000, 0.02/1000 * particles, particles, 0.05) {
m_restPressure = 1000.0f;
m_k = 5.0f;
m_viscosity = 20.0f;
m_support = 0.1f;
m_surfaceTension = 6.0f;
}
};
#endif