SU2
gk_struct.h
Go to the documentation of this file.
1 
10 #ifndef _GK_STRUCT_H_
11 #define _GK_STRUCT_H_
12 
13 
14 /********************************************************************/
16 /********************************************************************/
17 #define GK_MKKEYVALUE_T(NAME, KEYTYPE, VALTYPE) \
18 typedef struct {\
19  KEYTYPE key;\
20  VALTYPE val;\
21 } NAME;\
22 
23 /* The actual KeyVal data structures */
24 GK_MKKEYVALUE_T(gk_ckv_t, char, ssize_t)
25 GK_MKKEYVALUE_T(gk_ikv_t, int, ssize_t)
26 GK_MKKEYVALUE_T(gk_i32kv_t, int32_t, ssize_t)
27 GK_MKKEYVALUE_T(gk_i64kv_t, int64_t, ssize_t)
28 GK_MKKEYVALUE_T(gk_zkv_t, ssize_t, ssize_t)
29 GK_MKKEYVALUE_T(gk_fkv_t, float, ssize_t)
30 GK_MKKEYVALUE_T(gk_dkv_t, double, ssize_t)
31 GK_MKKEYVALUE_T(gk_skv_t, char *, ssize_t)
32 GK_MKKEYVALUE_T(gk_idxkv_t, gk_idx_t, gk_idx_t)
33 
34 
35 
36 /********************************************************************/
38 /********************************************************************/
39 #define GK_MKPQUEUE_T(NAME, KVTYPE)\
40 typedef struct {\
41  gk_idx_t nnodes;\
42  gk_idx_t maxnodes;\
43 \
44  /* Heap version of the data structure */ \
45  KVTYPE *heap;\
46  gk_idx_t *locator;\
47 } NAME;\
48 
49 GK_MKPQUEUE_T(gk_ipq_t, gk_ikv_t)
50 GK_MKPQUEUE_T(gk_i32pq_t, gk_i32kv_t)
51 GK_MKPQUEUE_T(gk_i64pq_t, gk_i64kv_t)
52 GK_MKPQUEUE_T(gk_fpq_t, gk_fkv_t)
53 GK_MKPQUEUE_T(gk_dpq_t, gk_dkv_t)
54 GK_MKPQUEUE_T(gk_idxpq_t, gk_idxkv_t)
55 
56 
57 #define GK_MKPQUEUE2_T(NAME, KTYPE, VTYPE)\
58 typedef struct {\
59  ssize_t nnodes;\
60  ssize_t maxnodes;\
61 \
62  /* Heap version of the data structure */ \
63  KTYPE *keys;\
64  VTYPE *vals;\
65 } NAME;\
66 
67 
68 
69 /*-------------------------------------------------------------
70  * The following data structure stores a sparse CSR format
71  *-------------------------------------------------------------*/
72 typedef struct gk_csr_t {
73  int32_t nrows, ncols;
74  ssize_t *rowptr, *colptr;
75  int32_t *rowind, *colind;
76  int32_t *rowids, *colids;
77  float *rowval, *colval;
78  float *rnorms, *cnorms;
79  float *rsums, *csums;
80  float *rsizes, *csizes;
81  float *rvols, *cvols;
82  float *rwgts, *cwgts;
83 } gk_csr_t;
84 
85 
86 /*-------------------------------------------------------------
87  * The following data structure stores a sparse graph
88  *-------------------------------------------------------------*/
89 typedef struct gk_graph_t {
90  int32_t nvtxs;
91  ssize_t *xadj;
92  int32_t *adjncy;
93  int32_t *iadjwgt;
94  float *fadjwgt;
95  int32_t *ivwgts;
96  float *fvwgts;
97  int32_t *ivsizes;
98  float *fvsizes;
99  int32_t *vlabels;
100 } gk_graph_t;
101 
102 
103 /*-------------------------------------------------------------
104  * The following data structure stores stores a string as a
105  * pair of its allocated buffer and the buffer itself.
106  *-------------------------------------------------------------*/
107 typedef struct gk_str_t {
108  size_t len;
109  char *buf;
110 } gk_str_t;
111 
112 
113 
114 
115 /*-------------------------------------------------------------
116 * The following data structure implements a string-2-int mapping
117 * table used for parsing command-line options
118 *-------------------------------------------------------------*/
119 typedef struct gk_StringMap_t {
120  char *name;
121  int id;
123 
124 
125 /*------------------------------------------------------------
126  * This structure implements a simple hash table
127  *------------------------------------------------------------*/
128 typedef struct gk_HTable_t {
129  int nelements; /* The overall size of the hash-table */
130  int htsize; /* The current size of the hash-table */
131  gk_ikv_t *harray; /* The actual hash-table */
132 } gk_HTable_t;
133 
134 
135 /*------------------------------------------------------------
136  * This structure implements a gk_Tokens_t list returned by the
137  * string tokenizer
138  *------------------------------------------------------------*/
139 typedef struct gk_Tokens_t {
140  int ntoks; /* The number of tokens in the input string */
141  char *strbuf; /* The memory that stores all the entries */
142  char **list; /* Pointers to the strbuf for each element */
143 } gk_Tokens_t;
144 
145 /*------------------------------------------------------------
146  * This structure implements storage for an atom in a pdb file
147  *------------------------------------------------------------*/
148 typedef struct atom {
149  int serial;
150  char *name;
151  char altLoc;
152  char *resname;
153  char chainid;
154  int rserial;
155  char icode;
156  char element;
157  double x;
158  double y;
159  double z;
160  double opcy;
161  double tmpt;
162 } atom;
163 
164 
165 /*------------------------------------------------------------
166  * This structure implements storage for a center of mass for
167  * a single residue.
168  *------------------------------------------------------------*/
169 typedef struct center_of_mass {
170  char name;
171  double x;
172  double y;
173  double z;
175 
176 
177 /*------------------------------------------------------------
178  * This structure implements storage for a pdb protein
179  *------------------------------------------------------------*/
180 typedef struct pdbf {
181  int natoms; /* Number of atoms */
182  int nresidues; /* Number of residues based on coordinates */
183  int ncas;
184  int nbbs;
185  int corruption;
186  char *resSeq; /* Residue sequence based on coordinates */
187  char **threeresSeq; /* three-letter residue sequence */
188  atom *atoms;
189  atom **bbs;
190  atom **cas;
191  center_of_mass *cm;
192 } pdbf;
193 
194 
195 
196 /*************************************************************
197 * Localization Structures for converting characters to integers
198 **************************************************************/
199 typedef struct gk_i2cc2i_t {
200  int n;
201  char *i2c;
202  int *c2i;
203 } gk_i2cc2i_t;
204 
205 
206 /*******************************************************************
207  *This structure implements storage of a protein sequence
208  * *****************************************************************/
209 typedef struct gk_seq_t {
210 
211  int len; /*Number of Residues */
212  int *sequence; /* Stores the sequence*/
213 
214 
215  int **pssm; /* Stores the pssm matrix */
216  int **psfm; /* Stores the psfm matrix */
217  char *name; /* Stores the name of the sequence */
218 
219  int nsymbols;
220 
221 
222 } gk_seq_t;
223 
224 
225 
226 
227 /*************************************************************************/
231 /*************************************************************************/
232 typedef struct gk_mop_t {
233  int type;
234  ssize_t nbytes;
235  void *ptr;
236 } gk_mop_t;
237 
238 
239 /*************************************************************************/
241 /*************************************************************************/
242 typedef struct gk_mcore_t {
243  /* Workspace information */
244  size_t coresize;
245  size_t corecpos;
246  void *core;
248  /* These are for implementing a stack-based allocation scheme using both
249  core and also dynamically allocated memory */
250  size_t nmops;
251  size_t cmop;
254  /* These are for keeping various statistics for wspacemalloc */
255  size_t num_callocs;
256  size_t num_hallocs;
257  size_t size_callocs;
258  size_t size_hallocs;
259  size_t cur_callocs;
260  size_t cur_hallocs;
261  size_t max_callocs;
262  size_t max_hallocs;
264 } gk_mcore_t;
265 
266 
267 
268 #endif
int32_t * iadjwgt
Definition: gk_struct.h:93
int32_t * adjncy
Definition: gk_struct.h:92
int32_t * ivsizes
Definition: gk_struct.h:97
size_t max_callocs
Definition: gk_struct.h:261
size_t cur_callocs
Definition: gk_struct.h:259
ssize_t * xadj
Definition: gk_struct.h:91
Definition: gk_struct.h:169
gk_mop_t * mops
Definition: gk_struct.h:252
Definition: gk_struct.h:148
float * fadjwgt
Definition: gk_struct.h:94
size_t cmop
Definition: gk_struct.h:251
struct gk_mcore_t gk_mcore_t
size_t coresize
Definition: gk_struct.h:244
Definition: gk_struct.h:242
size_t nmops
Definition: gk_struct.h:250
int32_t * ivwgts
Definition: gk_struct.h:95
Definition: gk_struct.h:89
Definition: gk_struct.h:209
#define GK_MKKEYVALUE_T(NAME, KEYTYPE, VALTYPE)
Definition: gk_struct.h:17
Definition: gk_struct.h:128
size_t num_hallocs
Definition: gk_struct.h:256
size_t max_hallocs
Definition: gk_struct.h:262
Definition: gk_struct.h:72
void * core
Definition: gk_struct.h:246
Definition: gk_struct.h:107
size_t corecpos
Definition: gk_struct.h:245
float * fvwgts
Definition: gk_struct.h:96
#define GK_MKPQUEUE_T(NAME, KVTYPE)
Definition: gk_struct.h:39
size_t size_hallocs
Definition: gk_struct.h:258
Definition: gk_struct.h:119
float * fvsizes
Definition: gk_struct.h:98
size_t num_callocs
Definition: gk_struct.h:255
size_t cur_hallocs
Definition: gk_struct.h:260
Definition: gk_struct.h:139
Definition: gk_struct.h:232
int32_t nvtxs
Definition: gk_struct.h:90
Definition: gk_struct.h:199
int32_t * vlabels
Definition: gk_struct.h:99
Definition: gk_struct.h:180
struct gk_mop_t gk_mop_t
size_t size_callocs
Definition: gk_struct.h:257