hp2FEM  0.1
src/metis-5.0/GKlib/gk_struct.h
Go to the documentation of this file.
00001 
00010 #ifndef _GK_STRUCT_H_
00011 #define _GK_STRUCT_H_
00012 
00013 
00014 /********************************************************************/
00016 /********************************************************************/
00017 #define GK_MKKEYVALUE_T(NAME, KEYTYPE, VALTYPE) \
00018 typedef struct {\
00019   KEYTYPE key;\
00020   VALTYPE val;\
00021 } NAME;\
00022 
00023 /* The actual KeyVal data structures */
00024 GK_MKKEYVALUE_T(gk_ckv_t,   char,     gk_idx_t)
00025 GK_MKKEYVALUE_T(gk_ikv_t,   int,      gk_idx_t)
00026 GK_MKKEYVALUE_T(gk_i32kv_t, int32_t,  gk_idx_t)
00027 GK_MKKEYVALUE_T(gk_i64kv_t, int64_t,  gk_idx_t)
00028 GK_MKKEYVALUE_T(gk_fkv_t,   float,    gk_idx_t)
00029 GK_MKKEYVALUE_T(gk_dkv_t,   double,   gk_idx_t)
00030 GK_MKKEYVALUE_T(gk_skv_t,   char *,   gk_idx_t)
00031 GK_MKKEYVALUE_T(gk_idxkv_t, gk_idx_t, gk_idx_t)
00032 
00033 
00034 
00035 /********************************************************************/
00037 /********************************************************************/
00038 #define GK_MKPQUEUE_T(NAME, KVTYPE)\
00039 typedef struct {\
00040   gk_idx_t nnodes;\
00041   gk_idx_t maxnodes;\
00042 \
00043   /* Heap version of the data structure */ \
00044   KVTYPE   *heap;\
00045   gk_idx_t *locator;\
00046 } NAME;\
00047 
00048 GK_MKPQUEUE_T(gk_ipq_t,    gk_ikv_t)
00049 GK_MKPQUEUE_T(gk_i32pq_t,  gk_i32kv_t)
00050 GK_MKPQUEUE_T(gk_i64pq_t,  gk_i64kv_t)
00051 GK_MKPQUEUE_T(gk_fpq_t,    gk_fkv_t)
00052 GK_MKPQUEUE_T(gk_dpq_t,    gk_dkv_t)
00053 GK_MKPQUEUE_T(gk_idxpq_t,  gk_idxkv_t)
00054 
00055 
00056 
00057 /*-------------------------------------------------------------
00058  * The following data structure stores a sparse CSR format
00059  *-------------------------------------------------------------*/
00060 typedef struct gk_csr_t {
00061   int nrows, ncols;
00062   int *rowptr, *colptr, *rowids;
00063   int *rowind, *colind, *colids;
00064   float *rowval, *colval;
00065   float *rnorms, *cnorms;
00066   float *rsums, *csums;
00067 } gk_csr_t;
00068 
00069 
00070 /*-------------------------------------------------------------
00071  * The following data structure stores stores a string as a 
00072  * pair of its allocated buffer and the buffer itself.
00073  *-------------------------------------------------------------*/
00074 typedef struct gk_str_t {
00075   size_t len;
00076   char *buf;
00077 } gk_str_t;
00078 
00079 
00080 
00081 
00082 /*-------------------------------------------------------------
00083 * The following data structure implements a string-2-int mapping
00084 * table used for parsing command-line options
00085 *-------------------------------------------------------------*/
00086 typedef struct gk_StringMap_t {
00087   char *name;
00088   int id;
00089 } gk_StringMap_t;
00090 
00091 
00092 /*------------------------------------------------------------
00093  * This structure implements a simple hash table
00094  *------------------------------------------------------------*/
00095 typedef struct gk_HTable_t {
00096   int nelements;          /* The overall size of the hash-table */
00097   int htsize;             /* The current size of the hash-table */
00098   gk_ikv_t *harray;       /* The actual hash-table */
00099 } gk_HTable_t;
00100 
00101 
00102 /*------------------------------------------------------------
00103  * This structure implements a gk_Tokens_t list returned by the
00104  * string tokenizer
00105  *------------------------------------------------------------*/
00106 typedef struct gk_Tokens_t {
00107   int ntoks;        /* The number of tokens in the input string */
00108   char *strbuf;     /* The memory that stores all the entries */
00109   char **list;      /* Pointers to the strbuf for each element */
00110 } gk_Tokens_t;
00111 
00112 /*------------------------------------------------------------
00113  * This structure implements storage for an atom in a pdb file
00114  *------------------------------------------------------------*/
00115 typedef struct atom {
00116   int       serial;
00117   char      *name;
00118   char      altLoc;
00119   char      *resname;
00120   char      chainid;    
00121   int       rserial;
00122   char      icode;
00123   char      element;
00124   double    x;
00125   double    y;
00126   double    z;
00127   double    opcy;
00128   double    tmpt;
00129 } atom;
00130 
00131 
00132 /*------------------------------------------------------------
00133  * This structure implements storage for a center of mass for
00134  * a single residue.
00135  *------------------------------------------------------------*/
00136 typedef struct center_of_mass {
00137   char name;
00138   double x;
00139   double y;
00140   double z;
00141 } center_of_mass;
00142 
00143 
00144 /*------------------------------------------------------------
00145  * This structure implements storage for a pdb protein 
00146  *------------------------------------------------------------*/
00147 typedef struct pdbf {
00148         int natoms;                     /* Number of atoms */
00149         int nresidues;  /* Number of residues based on coordinates */
00150         int ncas;
00151         int nbbs;
00152         int corruption;
00153         char *resSeq;         /* Residue sequence based on coordinates    */
00154   char **threeresSeq; /* three-letter residue sequence */
00155         atom *atoms;
00156         atom **bbs;
00157         atom **cas;
00158   center_of_mass *cm;
00159 } pdbf;
00160 
00161 
00162 
00163 /*************************************************************
00164 * Localization Structures for converting characters to integers
00165 **************************************************************/
00166 typedef struct gk_i2cc2i_t {
00167     int n;
00168     char *i2c;
00169     int *c2i;
00170 } gk_i2cc2i_t;
00171  
00172 
00173 /*******************************************************************
00174  *This structure implements storage of a protein sequence
00175  * *****************************************************************/
00176 typedef struct gk_seq_t {
00177     
00178     int len; /*Number of Residues */
00179     int *sequence; /* Stores the sequence*/
00180     
00181     
00182     int **pssm; /* Stores the pssm matrix */
00183     int **psfm; /* Stores the psfm matrix */
00184     char *name; /* Stores the name of the sequence */
00185 
00186     int nsymbols;
00187 
00188     
00189 } gk_seq_t;
00190 
00191 
00192 
00193 
00194 /*************************************************************************/
00198 /*************************************************************************/
00199 typedef struct gk_mop_t {
00200   int type;
00201   ssize_t nbytes;
00202   void *ptr;
00203 } gk_mop_t;
00204 
00205 
00206 /*************************************************************************/
00208 /*************************************************************************/
00209 typedef struct gk_mcore_t {
00210   /* Workspace information */
00211   size_t coresize;     
00212   size_t corecpos;     
00213   void *core;          
00215   /* These are for implementing a stack-based allocation scheme using both
00216      core and also dynamically allocated memory */
00217   size_t nmops;         
00218   size_t cmop;          
00219   gk_mop_t *mops;       
00221   /* These are for keeping various statistics for wspacemalloc */
00222   size_t num_callocs;   
00223   size_t num_hallocs;   
00224   size_t size_callocs;  
00225   size_t size_hallocs;  
00226   size_t cur_callocs;   
00227   size_t cur_hallocs;   
00228   size_t max_callocs;   
00229   size_t max_hallocs;   
00231 } gk_mcore_t;
00232 
00233 
00234 
00235 #endif
 All Classes Files Functions Variables Typedefs Friends Defines