File: Field.h

package info (click to toggle)
pymol 1.7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 42,668 kB
  • ctags: 25,775
  • sloc: ansic: 494,779; python: 75,446; cpp: 20,088; makefile: 351; sh: 172; csh: 21
file content (80 lines) | stat: -rw-r--r-- 2,351 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80


/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Field
#define _H_Field

#include"os_python.h"
#include"PyMOLGlobals.h"

#define cFieldFloat 0
#define cFieldInt 1
#define cFieldOther 2

typedef struct {
  int type;
  char *data;
  unsigned int *dim;
  unsigned int *stride;
  int n_dim;
  unsigned int size;
  unsigned int base_size;
} CField;

/* accessors for getting data from a field */

#define F3p(f,a,b,c) ((f)->data + \
        (a)*(f)->stride[0] + \
        (b)*(f)->stride[1] + \
        (c)*(f)->stride[2])

#define F4p(f,a,b,c,d) ((f)->data + \
        (a)*(f)->stride[0] + \
        (b)*(f)->stride[1] + \
        (c)*(f)->stride[2] + \
        (d)*(f)->stride[3])

#define Ffloat3p(f,a,b,c) ((float*)F3p(f,a,b,c))
#define Ffloat3(f,a,b,c) (*(Ffloat3p(f,a,b,c)))

#define Ffloat4p(f,a,b,c,d) ((float*)F4p(f,a,b,c,d))
#define Ffloat4(f,a,b,c,d) (*(Ffloat4p(f,a,b,c,d)))

#define Fint3p(f,a,b,c) ((int*)F3p(f,a,b,c))
#define Fint3(f,a,b,c) (*(Fint3p(f,a,b,c)))

#define Fint4p(f,a,b,c,d) ((int*)F4p(f,a,b,c,d))
#define Fint4(f,a,b,c,d) (*(Fint4p(f,a,b,c,d)))

#define Fvoid4p(f,a,b,c,d) ((void*)F4p(f,a,b,c,d))

CField *FieldNew(PyMOLGlobals * G, int *dim, int n_dim, unsigned int base_size, int type);
void FieldZero(CField * I);
void FieldFree(CField * I);
float FieldInterpolatef(CField * I, int a, int b, int c, float x, float y, float z);
void FieldInterpolate3f(CField * I, int *locus, float *fract, float *result);

#define FieldFreeP(ptr) {if(ptr){FieldFree(ptr);ptr=NULL;}}

PyObject *FieldAsPyList(CField * I);
CField *FieldNewFromPyList(PyMOLGlobals * G, PyObject * list);
CField *FieldNewCopy(PyMOLGlobals * G, CField * src);
int FieldSmooth3f(CField * I);

float* FieldSample(CField * I, int skip);

#endif