Angka  0.0.1
A C library focusing on data manipulation and visualization
grid.h File Reference

the library for grid data manipulation More...

Go to the source code of this file.

Data Structures

struct  s_grid
 grid structure data More...
 

Typedefs

typedef struct s_grid AgxGrid
 grid structure data More...
 

Functions

AgxGridagx_grid_new (int *shape, int ndim)
 create a grid data in malloc More...
 
void agx_grid_delete (AgxGrid **grid)
 delete agx_grid_new More...
 
int agx_grid_idim2index (AgxGrid *grid, int *indexes, int ndim)
 convert dimensional indexes to 1d index More...
 
int * agx_grid_index2dim (AgxGrid *grid, int index)
 convert 1d index to dimensional indexes More...
 
int agx_grid_index2idim (AgxGrid *grid, int idim, int index)
 using agx_grid_index2dim only for a certain dimensional index. More...
 

Detailed Description

the library for grid data manipulation

Typedef Documentation

◆ AgxGrid

typedef struct s_grid AgxGrid

grid structure data

Function Documentation

◆ agx_grid_delete()

void agx_grid_delete ( AgxGrid **  grid)

delete agx_grid_new

◆ agx_grid_idim2index()

int agx_grid_idim2index ( AgxGrid grid,
int *  indexes,
int  ndim 
)

convert dimensional indexes to 1d index

Parameters
indexesinput dimensional indexes {x1, ..., xn}
ndimlength of dimensional input N
Returns
idx if idx < size of array, otherwise is -1

◆ agx_grid_index2dim()

int* agx_grid_index2dim ( AgxGrid grid,
int  index 
)

convert 1d index to dimensional indexes

Returns
malloc shape that need to be deleted using free()
Note
return NULL if shape cannot be allocated

◆ agx_grid_index2idim()

int agx_grid_index2idim ( AgxGrid grid,
int  idim,
int  index 
)

using agx_grid_index2dim only for a certain dimensional index.

Note
the return in agx_grid_index2dim has been deleted in the function.
Returns
index in n-dimensional index.
Note
return -1 if error.

◆ agx_grid_new()

AgxGrid* agx_grid_new ( int *  shape,
int  ndim 
)

create a grid data in malloc

Warning
need to be deleted before closing the program or after data is unused using agx_grid_delete
Parameters
shapearray input dimensional values beginning with {x1, ..., xn}
ndimthe length of dimensional data N {x1, ..., xn}
Note
AgxGrid = NULL if grid cannot be allocated.