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