-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcell.h
145 lines (137 loc) · 2.79 KB
/
cell.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef CELL_2D_H
#define CELL_2D_H
# include "units.h"
# include "solid.h"
/*
struct Bond{
int size;
int *first;
int *next;
double *L0;
public:
Bond(){size=0;
first=NULL;next=NULL;L0=NULL;
}
Bond(int size_){
size = size_;
first = new int[size];
next = new int[size];
L0 = new double[size];
}
Bond& operator=(const Bond& rhs){
if (this !=&rhs){
delete [] first;
delete [] next;
delete [] L0;
size = rhs.size;
first = new int[size];
next = new int[size];
L0 = new double[size];
for (int i=0;i<size;i++){
first[i]=rhs.first[i];
next[i]=rhs.next[i];
L0[i]=rhs.L0[i];
}
}
return *this;
}
~Bond(){
delete [] first;
delete [] next;
delete [] L0;
}
};
struct Angle{
int size;
int *left;
int *middle;
int *right;
double *ang0;
public:
Angle(){size=0;
left=NULL;middle=NULL;right=NULL;ang0=NULL;
}
Angle(int size_){
size = size_;
left = new int[size];
middle = new int[size];
right = new int[size];
ang0 = new double[size];
}
Angle& operator=(const Angle& rhs){
if (this !=&rhs){
delete [] left;
delete [] middle;
delete [] right;
delete [] ang0;
size = rhs.size;
left = new int[size];
middle = new int[size];
right = new int[size];
ang0 = new double[size];
for (int i=0;i<size;i++){
left[i]=rhs.left[i];
middle[i]=rhs.middle[i];
right[i]=rhs.right[i];
ang0[i]=rhs.ang0[i];
}
}
return *this;
}
~Angle(){
delete [] left;
delete [] right;
delete [] middle;
delete [] ang0;
}
};*/
class Cell: public Solid{
public:
//double *x;
double *xtmp;
//double *v;
//double *force;
Bond *pBond;
Angle *pAngle;
double rho;
double ks;
double kb;
double kp;
double m;
double g;
double acc[2];
//double xc[2];
double *A0;
//int nn, nb, na;
int nb, na;
//int ns;// already defined in solid
int nForOne;// # of nodes for each solid object
int periodicX, periodicY;
int *edgeFlag;
public:
// creator
Cell();
~Cell();
Cell& operator=(const Cell& rhs);
void readInput(const std::string filename);
void reReadPosition(const std::string filename);
void init();
// manipulator
void update();
void updateHalf();
void nondimension(const Units&);
void computeEquilibrium();
void computeForce();
double computeArea(int idx);
void bondHarmonicForce();
void angleBendForce();
void areaConservationForce();
void velocityVerletIntegration();
void moveTo(double x,double y);
// acessor
void writeGeometry(const std::string filename);
void writeForce(const std::string filename);
void writeVelocity(const std::string filename);
void writeLog(const std::string filename);
};
#endif