| 1 |
/** |
| 2 |
* @file biom.h |
| 3 |
* @ingroup global_gamer |
| 4 |
* @brief Some parameter/datatype definitions |
| 5 |
* @author Zeyun Yu ([email protected]) |
| 6 |
* @note None |
| 7 |
* @version $Id: biom.i,v 1.1 2010/12/08 04:54:20 fetk Exp $ |
| 8 |
* |
| 9 |
* @attention |
| 10 |
* @verbatim |
| 11 |
* |
| 12 |
* GAMER = < Geometry-preserving Adaptive MeshER > |
| 13 |
* Copyright (C) 1994-- Michael Holst and Zeyun Yu |
| 14 |
* |
| 15 |
* This library is free software; you can redistribute it and/or |
| 16 |
* modify it under the terms of the GNU Lesser General Public |
| 17 |
* License as published by the Free Software Foundation; either |
| 18 |
* version 2.1 of the License, or (at your option) any later version. |
| 19 |
* |
| 20 |
* This library is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 |
* Lesser General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU Lesser General Public |
| 26 |
* License along with this library; if not, write to the Free Software |
| 27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 28 |
* |
| 29 |
* @endverbatim |
| 30 |
*/ |
| 31 |
|
| 32 |
// critical parameters for mesh generation |
| 33 |
|
| 34 |
/** @brief Isovalue used in the Marching Cube method */ |
| 35 |
#define IsoValue 2.5 |
| 36 |
/** @brief Blurring blobyness used in conversion from PDB/PQR to 3D volumes */ |
| 37 |
#define BLOBBYNESS -0.2f |
| 38 |
/** @brief Discretization rate of 3D volumes */ |
| 39 |
#define DIM_SCALE 1.99 |
| 40 |
/** @brief Coarsening Rate in surface post-processing */ |
| 41 |
#define CoarsenRate 0.1666 |
| 42 |
/** @brief The minimal volumes (in voxels) of islands to be removed */ |
| 43 |
#define MIN_VOLUME 333333 |
| 44 |
/** @brief The size of the bounding sphere (= object size X the following rate) */ |
| 45 |
#define SphereRatio 40 |
| 46 |
|
| 47 |
#define MaxVal 999999 |
| 48 |
#define MaxAtom 10 |
| 49 |
|
| 50 |
// Other definitions and data structures |
| 51 |
|
| 52 |
/** @brief Other definition */ |
| 53 |
#define PIE 3.14159265358979f |
| 54 |
/** @brief Other definition */ |
| 55 |
#define IndexVect(i,j,k) ((k)*xdim*ydim + (j)*xdim + (i)) |
| 56 |
#define IndexVect1(i,j,k) ((k)*xdim1*ydim1 + (j)*xdim1 + (i)) |
| 57 |
/** @brief Other definition */ |
| 58 |
#define max(x, y) ((x>y) ? (x):(y)) |
| 59 |
/** @brief Other definition */ |
| 60 |
#define min(x, y) ((x<y) ? (x):(y)) |
| 61 |
|
| 62 |
/** @brief Other definition */ |
| 63 |
#define _LITTLE_ENDIAN 1 |
| 64 |
|
| 65 |
/** @brief Other data structure FLT2VECT (float) */ |
| 66 |
typedef struct { |
| 67 |
float x; /**< @brief x-coordinate */ |
| 68 |
float y; /**< @brief y-coordinate */ |
| 69 |
}FLT2VECT; |
| 70 |
|
| 71 |
/** @brief Other data structure FLTVECT (float) */ |
| 72 |
typedef struct { |
| 73 |
float x; /**< @brief x-coordinate */ |
| 74 |
float y; /**< @brief y-coordinate */ |
| 75 |
float z; /**< @brief z-coordinate */ |
| 76 |
}FLTVECT; |
| 77 |
|
| 78 |
/** @brief Other data structure DBLVECT (double float) */ |
| 79 |
typedef struct { |
| 80 |
double x; /**< @brief x-coordinate */ |
| 81 |
double y; /**< @brief y-coordinate */ |
| 82 |
double z; /**< @brief z-coordinate */ |
| 83 |
}DBLVECT; |
| 84 |
|
| 85 |
/** @brief Other data structure INT3VECT (int) */ |
| 86 |
typedef struct { |
| 87 |
int a; /**< @brief first integer */ |
| 88 |
int b; /**< @brief second integer */ |
| 89 |
int c; /**< @brief third integer */ |
| 90 |
}INT3VECT; |
| 91 |
|
| 92 |
/** @brief Other data structure INT4VECT (int) */ |
| 93 |
typedef struct { |
| 94 |
int a; /**< @brief first integer */ |
| 95 |
int b; /**< @brief second integer */ |
| 96 |
int c; /**< @brief third integer */ |
| 97 |
int d; /**< @brief fourth integer */ |
| 98 |
}INT4VECT; |
| 99 |
|
| 100 |
/** @brief Other data structure NPNT3 */ |
| 101 |
typedef struct NeighborPoint3 NPNT3; |
| 102 |
/** @brief Other data structure NeighborPoint3 */ |
| 103 |
struct NeighborPoint3{ |
| 104 |
int a; /**< @brief first integer */ |
| 105 |
int b; /**< @brief second integer */ |
| 106 |
int c; /**< @brief third integer */ |
| 107 |
NPNT3 *next; /**< @brief pointer to the next triangle */ |
| 108 |
}; |
| 109 |
|
| 110 |
/** @brief Other data structure SurfaceMesh (for surface meshes) */ |
| 111 |
typedef struct { |
| 112 |
int nv; /**< @brief number of vertices */ |
| 113 |
int nf; /**< @brief number of triangles */ |
| 114 |
int nvm; /**< @brief number of vertices */ |
| 115 |
int nfm; /**< @brief number of triangles */ |
| 116 |
}SurfaceMesh; |
| 117 |
|
| 118 |
typedef struct GemMesh{ |
| 119 |
int dim; |
| 120 |
int dimii; |
| 121 |
int vertices; |
| 122 |
int simplices; |
| 123 |
}GemMesh; |
| 124 |
|
| 125 |
/** @brief Other data structure TeTraMesh (for tetrahedral meshes) */ |
| 126 |
typedef struct { |
| 127 |
int nv; /**< @brief number of nodes */ |
| 128 |
int nf; /**< @brief numner of tetrahedra */ |
| 129 |
FLTVECT *vertex; /**< @brief pointer to the vertices */ |
| 130 |
INT4VECT *face; /**< @brief pointer to the tetrahedra */ |
| 131 |
INT4VECT *neighbor; /**< @brief pointer to the neighbors (tetrahedra) */ |
| 132 |
}TeTraMesh; |
| 133 |
|
| 134 |
|
| 135 |
/** @brief Other data structure SPNT */ |
| 136 |
typedef struct SamplePoint SPNT; |
| 137 |
/** @brief Other data structure SamplePoint */ |
| 138 |
struct SamplePoint{ |
| 139 |
float x; /**< @brief x-coordinate */ |
| 140 |
float y; /**< @brief y-coordinate */ |
| 141 |
float z; /**< @brief z-coordinate */ |
| 142 |
SPNT *next; /**< @brief pointer to next vertex */ |
| 143 |
}; |
| 144 |
|
| 145 |
|
| 146 |
/** @brief Other data structure NPNT2 */ |
| 147 |
typedef struct NeighborPoint2 NPNT2; |
| 148 |
/** @brief Other data structure NeighborPoint2 */ |
| 149 |
struct NeighborPoint2{ |
| 150 |
int a; /**< @brief first integer */ |
| 151 |
int b; /**< @brief second integer */ |
| 152 |
NPNT2 *next; /**< @brief pointer to the next point */ |
| 153 |
}; |
| 154 |
|
| 155 |
/** @brief Other data structure ATOM */ |
| 156 |
typedef struct { |
| 157 |
float x; /**< @brief x-coordinate */ |
| 158 |
float y; /**< @brief y-coordinate */ |
| 159 |
float z; /**< @brief z-coordinate */ |
| 160 |
float radius; /**< @brief radius */ |
| 161 |
}ATOM; |
| 162 |
|
| 163 |
|
| 164 |
/** @brief Other data structure EIGENVECT */ |
| 165 |
typedef struct { |
| 166 |
float x1; /**< @brief x-coordinate of first eigenvector */ |
| 167 |
float y1; /**< @brief y-coordinate of first eigenvector */ |
| 168 |
float z1; /**< @brief z-coordinate of first eigenvector */ |
| 169 |
float x2; /**< @brief x-coordinate of second eigenvector */ |
| 170 |
float y2; /**< @brief y-coordinate of second eigenvector */ |
| 171 |
float z2; /**< @brief z-coordinate of second eigenvector */ |
| 172 |
float x3; /**< @brief x-coordinate of third eigenvector */ |
| 173 |
float y3; /**< @brief y-coordinate of third eigenvector */ |
| 174 |
float z3; /**< @brief z-coordinate of third eigenvector */ |
| 175 |
}EIGENVECT; |
| 176 |
|
| 177 |
|
| 178 |
/** @brief Other data structure MinHeapS */ |
| 179 |
typedef struct { |
| 180 |
unsigned short *x; /**< @brief x-coordinate */ |
| 181 |
unsigned short *y; /**< @brief y-coordinate */ |
| 182 |
unsigned short *z; /**< @brief z-coordinate */ |
| 183 |
int *seed; /**< @brief seed */ |
| 184 |
float *dist; /**< @brief distance */ |
| 185 |
int size; /**< @brief size */ |
| 186 |
}MinHeapS; |
| 187 |
|
| 188 |
|
| 189 |
/** @brief Other data structure SEEDS */ |
| 190 |
typedef struct{ |
| 191 |
float seedx; /**< @brief x-coordinate */ |
| 192 |
float seedy; /**< @brief y-coordinate */ |
| 193 |
float seedz; /**< @brief z-coordinate */ |
| 194 |
int atom[MaxAtom]; /**< @brief atom array */ |
| 195 |
}SEEDS; |
| 196 |
|
| 197 |
// GemMesh functions |
| 198 |
//GemMesh* GemMesh_fromTetgen(tetgenio& tetio); |
| 199 |
GemMesh* GemMesh_fromSurfaceMesh(SurfaceMesh* surfmesh, char* tetgen_params); |
| 200 |
//GemMesh* GemMesh_fromPdb(tetgenio* out, float radius, float centerx, |
| 201 |
// float centery, float centerz, char *ActiveSite, |
| 202 |
// int output_flag); |
| 203 |
void GemMesh_writeMcsf(GemMesh* out, char* filename); |
| 204 |
void GemMesh_dtor(GemMesh*); |
| 205 |
void GemMesh_writeOFF(GemMesh* Gem_mesh, char* filename); |
| 206 |
|
| 207 |
// Not working... |
| 208 |
//void SurfaceMesh_getMinMaxAngles(SurfaceMesh* ,float*, float*, int*, int*, int, int); |
| 209 |
void SurfaceMesh_resetVertexMarkers(SurfaceMesh* surfmesh); |
| 210 |
void SurfaceMesh_resetFaceMarkers(SurfaceMesh* surfmesh); |
| 211 |
void SurfaceMesh_refine(SurfaceMesh*); |
| 212 |
bool SurfaceMesh_smooth(SurfaceMesh* surfmesh, |
| 213 |
unsigned int max_min_angle, |
| 214 |
unsigned int min_max_angle, |
| 215 |
unsigned int max_iter, |
| 216 |
bool flip_edges); |
| 217 |
void SurfaceMesh_normalSmooth(SurfaceMesh* surfmesh); |
| 218 |
char SurfaceMesh_coarse(SurfaceMesh* surfmesh, float coarse_rate, |
| 219 |
float flatness_rate, float denseness_weight, |
| 220 |
float max_normal_angle); |
| 221 |
ATOM SurfaceMesh_getCenterRadius(SurfaceMesh* surfmesh); |
| 222 |
// Not working |
| 223 |
// void SurfaceMesh_assignActiveSites(SurfaceMesh*, ATOM*, unsigned int, unsigned int*, unsigned int*); |
| 224 |
void SurfaceMesh_correctNormals(SurfaceMesh* surfmesh); |
| 225 |
void SurfaceMesh_writeOFF(SurfaceMesh* surfmesh, char* filename); |
| 226 |
|
| 227 |
// void ReadActiveSiteFile(char*, unsigned int&, ATOM*&, unsigned int*&, float*&); |
| 228 |
void ReadActiveSiteFile(char*, unsigned int&, ATOM*&, unsigned int*&); |
| 229 |
void ReadRawiv(int *, int *, int *, float **, char *,float *, float *); |
| 230 |
void SurfaceExtract(TeTraMesh*, SurfaceMesh*); |
| 231 |
// Not working |
| 232 |
// float PDB2Volume(char *, float **, int *, int *, int *,float *, float *, ATOM **,int *,char); |
| 233 |
// void MarchingCube(int, int, int, float *, float, float, SurfaceMesh **,SPNT **); |