Angka  0.0.1
A C library focusing on data manipulation and visualization
grid.h
Go to the documentation of this file.
1 
7 #ifndef __GRID_H
8 #define __GRID_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
16 typedef struct s_grid {
18  int *r_shape;
20  double *p_r_nums;
21 
23  int size;
24 
26  int ndim;
27 } AgxGrid;
28 
29 
37 AgxGrid *agx_grid_new(int *shape, int ndim);
38 
42 void agx_grid_delete(AgxGrid **grid);
43 
50 int agx_grid_idim2index(AgxGrid *grid, int *indexes, int ndim);
51 
57 int *agx_grid_index2dim(AgxGrid *grid, int index);
58 
65 int agx_grid_index2idim(AgxGrid *grid, int idim, int index);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif
grid structure data
Definition: grid.h:16
struct s_grid AgxGrid
grid structure data
int agx_grid_index2idim(AgxGrid *grid, int idim, int index)
using agx_grid_index2dim only for a certain dimensional index.
int size
the length of malloc p_r_nums
Definition: grid.h:23
AgxGrid * agx_grid_new(int *shape, int ndim)
create a grid data in malloc
double * p_r_nums
p_r_nums in malloc 1d data
Definition: grid.h:20
int ndim
the length of r_shape
Definition: grid.h:26
int * r_shape
r_shape in malloc 1d data
Definition: grid.h:18
void agx_grid_delete(AgxGrid **grid)
delete agx_grid_new
int agx_grid_idim2index(AgxGrid *grid, int *indexes, int ndim)
convert dimensional indexes to 1d index
int * agx_grid_index2dim(AgxGrid *grid, int index)
convert 1d index to dimensional indexes