processgrid.h 1.71 KB
Newer Older
lvs's avatar
lvs committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef PROCESSGRID_H_
#define PROCESSGRID_H_

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#include <libgen.h>

// libgen.h contains basename() and dir() from a fullpath name
// Specific: to open correctly grid map field fiels and associated files
// Not only during real execution but also SDAccel cpu-, hw-emulation
// http://ask.systutorials.com/681/get-the-directory-path-and-file-name-from-absolute-path-linux

#include "miscellaneous.h"

18
19
20
21
// Added for allocating fgrids
#include <vector>
using std::vector;

lvs's avatar
lvs committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define getvalue_4Darr(mempoi, grinf, t, z, y, x)                  *(mempoi + (grinf).size_xyz[0] * (y + (grinf).size_xyz[1] * (z + (grinf).size_xyz[2]*t)) + x)
#define getvalue_4Darr_withsize(mempoi, gridsize_xyz, t, z, y, x)  *(mempoi + gridsize_xyz[0]*(y + gridsize_xyz[1] * (z + gridsize_xyz[2]*t)) + x)
//The macro helps to access the grid point values
//which were read from external files with get_gridvalues function.
//The first parameter is a pointer which points to the memory area storing the data.
//The second one is the corresponding grid info (parameter of get_gridinfo function).
//The other parameters are the type index, z, y and x coordinates of the grid point.

typedef struct
//Struct which can contain all the important informations which derives from .gpf and .xyz files.
{
	char*  grid_file_path;	  // Added to store the full path of the grid file
	char   receptor_name [64];
	int    size_xyz [3];
	double spacing;
	double size_xyz_angstr [3];
	char   grid_types [16][3];
	int    num_of_atypes;
	double origo_real_xyz [3];
} Gridinfo;

int get_gridinfo(const char*, Gridinfo*);

int get_gridvalues_f(const Gridinfo* mygrid,
46
		     float* fgrids);
lvs's avatar
lvs committed
47
48

#endif /* PROCESSGRID_H_ */