-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSIMULATION_LAYOUT.h
58 lines (45 loc) · 1.97 KB
/
SIMULATION_LAYOUT.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
// Copyright (c) 2011, Eftychios Sifakis.
// Distributed under the FreeBSD license (see license.txt)
#pragma once
namespace PhysBAM{
template<class TV> class SEGMENTED_CURVE;
template<class TV> class FREE_PARTICLES;
template<class T>
class SIMULATION_LAYOUT
{
public:
typedef VECTOR<T,3> TV;
const STREAM_TYPE stream_type;
const int n; // Number of particles in wire mesh
const T youngs_modulus; // Elasticity and damping coefficients
const T damping_coefficient;
const T wire_mass; // Mass and length for entire wire
const T wire_restlength;
ARRAY<T> mass; // Mass (per each particle)
ARRAY<T> restlength; // Restlength (per each spring)
GEOMETRY_PARTICLES<TV> particles;
DEFORMABLE_GEOMETRY_COLLECTION<TV> collection;
const int number_of_frames; // Total number of frames
const T frame_time; // Frame (snapshot) interval
const T CFL_number; // CFL number (not to exceed 1)
SEGMENTED_CURVE<TV>* wire_curve;
FREE_PARTICLES<TV>* wire_particles;
const T sphere_radius;
const TV sphere_position;
const T collision_stiffness;
SIMULATION_LAYOUT(const STREAM_TYPE stream_type_input);
void Initialize();
void Add_Elastic_Forces(ARRAY_VIEW<const TV> X,ARRAY_VIEW<TV> force) const;
void Add_Damping_Forces(ARRAY_VIEW<const TV> X,ARRAY_VIEW<const TV> V,
ARRAY_VIEW<TV> force) const;
void Add_Force_Differential(ARRAY_VIEW<const TV> X,ARRAY_VIEW<const TV> dX,
ARRAY_VIEW<TV> dforce) const;
void Add_External_Forces(ARRAY_VIEW<TV> force) const;
T Maximum_Dt() const;
void Write_Output(const int frame) const;
void Set_Kinematic_Positions(const T time,ARRAY_VIEW<TV> X) const;
void Add_Kinematic_Positions(const T time,const T factor,ARRAY_VIEW<TV> X) const;
void Set_Kinematic_Velocities(const T time,ARRAY_VIEW<TV> V) const;
void Clear_Values_Of_Kinematic_Particles(ARRAY_VIEW<TV> array) const;
};
}