commit | author | age
|
d7639a
|
1 |
#ifndef _GENERAL_H |
SP |
2 |
#define _GENERAL_H |
|
3 |
|
|
4 |
#include<stdarg.h> |
7958e9
|
5 |
#include<stdio.h> |
d7639a
|
6 |
/* @brief This is a header file, defining general constants and structures. |
SP |
7 |
* @file header.h |
|
8 |
* @author Samo Penic |
|
9 |
* @date 5.3.2001 |
311301
|
10 |
* |
d7639a
|
11 |
* Header file for general inclusion in all the code, defining data structures |
SP |
12 |
* and general constans. All datatypes used in the code is also defined here. |
|
13 |
* |
311301
|
14 |
* Miha: branch trisurf-polyel |
d7639a
|
15 |
*/ |
SP |
16 |
|
|
17 |
/* Defines */ |
|
18 |
/** @brief Return value of type bz_bool that indiceates successful function finish |
|
19 |
* |
|
20 |
* Function usualy return some value, which are the result of certain operation. Functions that don't |
|
21 |
* return any parameters can return value, that indicates if the function call finished successfully. |
|
22 |
* In case of successful function run, the functions should return TS_SUCCESS to the caller. This define |
|
23 |
* is set here to get uniformity among all the functions used in program. |
|
24 |
* |
|
25 |
* Example of usage: |
|
26 |
* ts_boot somefunction(ts_int param1, ....){ |
|
27 |
* ... |
|
28 |
* return TS_SUCCESS; |
|
29 |
* } |
|
30 |
*/ |
|
31 |
#define TS_SUCCESS 0 |
|
32 |
|
|
33 |
/** @brief Return value of type bz_bool that indicates unsuccessful function finish |
|
34 |
* |
|
35 |
* Function usualy return some value, which are the result of certain operation. Functions that don't |
|
36 |
* return any parameters can return value, that indicates if the function call finished successfully. |
|
37 |
* In case of unsuccessful function run, the functions should return TS_FAIL to the caller. This define |
|
38 |
* is set here to get uniformity among all the functions used in program. |
|
39 |
* |
|
40 |
* Example of usage: |
|
41 |
* |
|
42 |
* ts_boot somefunction(ts_int param1, ....){ |
|
43 |
* ... |
|
44 |
* return TS_FAIL; |
|
45 |
* } |
|
46 |
*/ |
|
47 |
#define TS_FAIL 1 |
|
48 |
|
|
49 |
/* CONSTANTS */ |
|
50 |
|
|
51 |
/* DATA TYPES */ |
|
52 |
/** @brief Sets the default datatype for ts_double |
|
53 |
* |
|
54 |
* Requred for some functions to work, like "pow" from math.h. If ts_double is defined as |
|
55 |
* float program must run with "powf". Where type dependant function is used it checks this |
|
56 |
* define directive to decide which version to compile in. Available options |
|
57 |
* |
|
58 |
* TS_DOUBLE_FLOAT |
|
59 |
* TS_DOUBLE_DOUBLE |
|
60 |
* TS_DOUBLE_LONGDOUBLE |
|
61 |
*/ |
|
62 |
#define TS_DOUBLE_DOUBLE |
|
63 |
|
|
64 |
/** For the purpose of greater flexibility all data types used in the program |
|
65 |
* shouldn't use standard C types, but should use types defined here. |
|
66 |
* ts_int (uses int) |
|
67 |
*/ |
|
68 |
typedef int ts_int; |
|
69 |
/** For the purpose of greater flexibility all data types used in the program |
|
70 |
* shouldn't use standard C types, but should use types defined here. |
|
71 |
* ts_uint (uses unsigned int) |
|
72 |
*/ |
|
73 |
typedef unsigned int ts_uint; |
|
74 |
/** For the purpose of greater flexibility all data types used in the program |
|
75 |
* shouldn't use standard C types, but should use types defined here. |
|
76 |
* ts_long (uses long) |
|
77 |
*/ |
|
78 |
typedef long ts_long; |
|
79 |
/** For the purpose of greater flexibility all data types used in the program |
|
80 |
* shouldn't use standard C types, but should use types defined here. |
|
81 |
* ts_ulong (uses unsigned long) |
|
82 |
*/ |
|
83 |
typedef unsigned long ts_ulong; |
|
84 |
/** For the purpose of greater flexibility all data types used in the program |
|
85 |
* shouldn't use standard C types, but should use types defined here. |
|
86 |
* ts_float (uses float) |
|
87 |
*/ |
|
88 |
typedef float ts_float; |
|
89 |
/** For the purpose of greater flexibility all data types used in the program |
|
90 |
* shouldn't use standard C types, but should use types defined here. |
|
91 |
* ts_double (uses double) |
|
92 |
*/ |
|
93 |
typedef double ts_double; |
|
94 |
/** For the purpose of greater flexibility all data types used in the program |
|
95 |
* shouldn't use standard C types, but should use types defined here. |
|
96 |
* ts_char (uses char) |
|
97 |
*/ |
|
98 |
typedef char ts_char; |
|
99 |
/** For the purpose of greater flexibility all data types used in the program |
|
100 |
* shouldn't use standard C types, but should use types defined here. |
|
101 |
* ts_uchar (uses unsigned char) |
|
102 |
*/ |
|
103 |
typedef unsigned char ts_uchar; |
|
104 |
/** For the purpose of greater flexibility all data types used in the program |
|
105 |
* shouldn't use standard C types, but should use types defined here. |
|
106 |
* ts_bool (uses char) |
|
107 |
*/ |
|
108 |
typedef char ts_bool; |
|
109 |
|
|
110 |
|
|
111 |
/* STRUCTURES */ |
|
112 |
|
523bf1
|
113 |
|
SP |
114 |
/** @brief Data structure for keeping the coordinates in selected coordinate |
|
115 |
* system |
|
116 |
*/ |
|
117 |
#define TS_COORD_CARTESIAN 0 |
|
118 |
#define TS_COORD_SPHERICAL 1 |
|
119 |
#define TS_COORD_CYLINDRICAL 2 |
|
120 |
|
|
121 |
typedef struct { |
|
122 |
ts_double e1; |
|
123 |
ts_double e2; |
|
124 |
ts_double e3; |
|
125 |
ts_uint coord_type; |
|
126 |
} ts_coord; |
|
127 |
|
d7639a
|
128 |
/** @brief Data structure of all data connected to a vertex |
SP |
129 |
* |
8f6a69
|
130 |
* ts_vertex holds the data for one single point (bead, vertex). To understand how to use it |
d7639a
|
131 |
* here is a detailed description of the fields in the data structure. */ |
8f6a69
|
132 |
struct ts_vertex { |
SP |
133 |
ts_uint idx; |
a10dd5
|
134 |
ts_double x; /**< The x coordinate of vertex. */ |
d7639a
|
135 |
ts_double y; /**< The y coordinate of vertex. */ |
SP |
136 |
ts_double z; /**< The z coordinate of vertex. */ |
|
137 |
ts_uint neigh_no; /**< The number of neighbours. */ |
a10dd5
|
138 |
struct ts_vertex **neigh; /**< The pointer that holds neigh_no pointers to this structure. */ |
SP |
139 |
ts_double *bond_length; /**< Obsolete! The bond lenght is moved to ts_bond */ |
|
140 |
ts_double *bond_length_dual; /**< Obsolete! Bond length in dual lattice is moved to ts_bond! */ |
d7639a
|
141 |
ts_double curvature; |
SP |
142 |
ts_double energy; |
|
143 |
ts_double energy_h; |
|
144 |
ts_uint tristar_no; |
a10dd5
|
145 |
struct ts_triangle **tristar; /**< The list of triangles this vertex belongs to. This is an array of pointers to ts_triangle structure of tristar_no length */ |
SP |
146 |
ts_uint bond_no; |
|
147 |
struct ts_bond **bond; /**< Array of pointers of lenght bond_no that stores information on bonds. */ |
|
148 |
struct ts_cell *cell; /**< Which cell do we belong to? */ |
d7639a
|
149 |
ts_double xk; |
SP |
150 |
ts_double c; |
|
151 |
ts_uint id; |
523bf1
|
152 |
ts_double projArea; |
SP |
153 |
ts_double relR; |
|
154 |
ts_double solAngle; |
1d5dff
|
155 |
struct ts_poly *grafted_poly; |
737714
|
156 |
}; |
d7639a
|
157 |
typedef struct ts_vertex ts_vertex; |
SP |
158 |
|
73f967
|
159 |
typedef struct { |
SP |
160 |
ts_uint n; |
a10dd5
|
161 |
ts_vertex **vtx; |
73f967
|
162 |
|
SP |
163 |
} ts_vertex_list; |
|
164 |
|
e016c4
|
165 |
struct ts_bond { |
fedf2b
|
166 |
ts_uint idx; |
d7639a
|
167 |
ts_vertex *vtx1; |
SP |
168 |
ts_vertex *vtx2; |
|
169 |
ts_double bond_length; |
|
170 |
ts_double bond_length_dual; |
a63f17
|
171 |
ts_bool tainted; |
fedf2b
|
172 |
ts_double energy; |
a10dd5
|
173 |
}; |
SP |
174 |
typedef struct ts_bond ts_bond; |
|
175 |
|
|
176 |
struct ts_bond_list { |
|
177 |
ts_uint n; |
|
178 |
ts_bond **bond; |
|
179 |
}; |
|
180 |
typedef struct ts_bond_list ts_bond_list; |
|
181 |
|
41a035
|
182 |
struct ts_triangle { |
SP |
183 |
ts_uint idx; |
d7639a
|
184 |
ts_vertex *vertex[3]; |
SP |
185 |
ts_uint neigh_no; |
|
186 |
struct ts_triangle **neigh; |
|
187 |
ts_double xnorm; |
|
188 |
ts_double ynorm; |
|
189 |
ts_double znorm; |
523bf1
|
190 |
ts_double area; // firstly needed for sh.c |
c9d07c
|
191 |
ts_double volume; // firstly needed for sh.c |
a10dd5
|
192 |
}; |
d7639a
|
193 |
typedef struct ts_triangle ts_triangle; |
a10dd5
|
194 |
|
SP |
195 |
struct ts_triangle_list{ |
|
196 |
ts_uint n; |
|
197 |
ts_triangle **tria; |
|
198 |
}; |
a2a676
|
199 |
typedef struct ts_triangle_list ts_triangle_list; |
d7639a
|
200 |
|
SP |
201 |
|
bb77ca
|
202 |
typedef struct ts_cell { |
SP |
203 |
ts_uint idx; |
34d3de
|
204 |
ts_vertex **vertex; |
SP |
205 |
ts_uint nvertex; |
bb77ca
|
206 |
} ts_cell; |
SP |
207 |
|
|
208 |
typedef struct ts_cell_list{ |
|
209 |
ts_uint ncmax[3]; |
|
210 |
ts_uint cellno; |
|
211 |
ts_cell **cell; |
d7639a
|
212 |
ts_double dcell; |
SP |
213 |
ts_double shift; |
|
214 |
ts_double max_occupancy; |
bb77ca
|
215 |
} ts_cell_list; |
SP |
216 |
|
|
217 |
|
|
218 |
typedef struct { |
523bf1
|
219 |
ts_uint l; |
SP |
220 |
ts_double **ulm; |
262607
|
221 |
ts_double **sumUlm2; |
SP |
222 |
ts_uint N; |
621830
|
223 |
ts_double **co; |
eb8605
|
224 |
ts_double ***Ylmi; |
523bf1
|
225 |
} ts_spharm; |
SP |
226 |
|
|
227 |
|
|
228 |
|
1d5dff
|
229 |
struct ts_poly { |
M |
230 |
ts_vertex_list *vlist; |
|
231 |
ts_bond_list *blist; |
|
232 |
ts_vertex *grafted_vtx; |
48bb92
|
233 |
ts_double k; |
1d5dff
|
234 |
}; |
M |
235 |
typedef struct ts_poly ts_poly; |
|
236 |
|
|
237 |
|
|
238 |
struct ts_poly_list { |
|
239 |
ts_uint n; |
|
240 |
ts_poly **poly; |
|
241 |
}; |
|
242 |
typedef struct ts_poly_list ts_poly_list; |
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
523bf1
|
247 |
typedef struct { |
bb77ca
|
248 |
ts_vertex_list *vlist; |
SP |
249 |
ts_bond_list *blist; |
|
250 |
ts_triangle_list *tlist; |
48bb92
|
251 |
ts_cell_list *clist; |
bb77ca
|
252 |
ts_uint nshell; |
48bb92
|
253 |
ts_double bending_rigidity; |
M |
254 |
ts_double dmax; |
|
255 |
ts_double stepsize; |
|
256 |
ts_double cm[3]; |
|
257 |
ts_double volume; |
|
258 |
ts_spharm *sphHarmonics; |
624f81
|
259 |
// Polymers outside the vesicle and attached to the vesicle membrane (polymer brush): |
1d5dff
|
260 |
ts_poly_list *poly_list; |
624f81
|
261 |
// Filaments inside the vesicle (not attached to the vesicel membrane: |
M |
262 |
ts_poly_list *filament_list; |
|
263 |
|
48bb92
|
264 |
ts_double spring_constant; |
e86357
|
265 |
ts_double pressure; |
b866cf
|
266 |
ts_int pswitch; |
624f81
|
267 |
|
M |
268 |
ts_double R_nucleus; |
|
269 |
|
d7639a
|
270 |
} ts_vesicle; |
SP |
271 |
|
|
272 |
|
523bf1
|
273 |
|
d7639a
|
274 |
/* GLOBAL VARIABLES */ |
SP |
275 |
|
|
276 |
int quiet; |
|
277 |
|
|
278 |
|
|
279 |
/* FUNCTIONS */ |
|
280 |
|
|
281 |
/** Non-fatal error function handler: |
|
282 |
* @param text is a description of an error |
|
283 |
* @returns doesn't return anything |
|
284 |
*/ |
|
285 |
void err(char *text); |
|
286 |
|
|
287 |
/** Fatal error function handler: |
|
288 |
* @param text is a description of an error |
|
289 |
* @param errcode is a (non-zero) error code |
|
290 |
* @returns terminates the execution of program with errcode set |
|
291 |
*/ |
|
292 |
void fatal(char *text, ts_int errcode); |
|
293 |
|
7958e9
|
294 |
ts_uint ts_fprintf(FILE *fd, char *fmt, ...); |
d7639a
|
295 |
|
737714
|
296 |
#define VTX(n) &(vlist->vtx[n]) |
SP |
297 |
#define VTX_DATA(n) vlist->vtx[n].data |
73f967
|
298 |
|
d7639a
|
299 |
#endif |