Look Up Hierarchy and Data API
Table of contents
These APIs simply look up hierarchy array constructed by
libyt
or look up data pointer that is passed in by user and wrapped bylibyt
.
These APIs are only available after
yt_commit
is called.
yt_getGridInfo_Dimensions
int yt_getGridInfo_Dimensions( const long gid, int (*dimensions)[3] );
- Usage: Get dimension of grid
gid
.dimensions[0]
corresponds to dimension in x-axis,dimensions[1]
corresponds to dimension in y-axis, anddimensions[2]
corresponds to dimension in z-axis, excluding ghost cells. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_LeftEdge
int yt_getGridInfo_LeftEdge(const long gid, double (*left_edge)[3]);
- Usage: Get left edge of grid
gid
.left_edge[0]
is left edge of the grid in x-axis in code length,left_edge[1]
for y-axis, andleft_edge[2]
for z-axis. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_RightEdge
int yt_getGridInfo_RightEdge(const long gid, double (*right_edge)[3]);
- Usage: Get right edge of grid
gid
.right_edge[0]
is right edge of the grid in x-axis in code length,right_edge[1]
for y-axis, andright_edge[2]
for z-axis. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_ParentId
int yt_getGridInfo_ParentId(const long gid, long *parent_id);
- Usage: Get parent grid id of grid
gid
. If there is no parent grid,parent_id
will be-1
. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_Level
int yt_getGridInfo_Level(const long gid, int *level);
- Usage: Get level of grid
gid
. If grids are on root level,level
will be0
. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_ProcNum
int yt_getGridInfo_ProcNum(const long gid, int *proc_num);
- Usage: Get MPI process number (MPI rank) of grid
gid
located on. - Return:
YT_SUCCESS
orYT_FAIL
yt_getGridInfo_ParticleCount
int yt_getGridInfo_ParticleCount(const long gid, const char *ptype, long *par_count);
- Usage: Get number of particle
ptype
located on gridgid
. - Return:
YT_SUCCESS
orYT_FAIL
Particle type name
ptype
should be same as what you passed inyt_get_ParticlesPtr
.
yt_getGridInfo_FieldData
int yt_getGridInfo_FieldData(const long gid, const char *field_name, yt_data *field_data);
- Usage: Get the field data
field_name
in grid idgid
. The result will be stored infield_data
. - Return:
YT_SUCCESS
orYT_FAIL
if it cannot get data. -
yt_data
-
data_ptr
: Data pointer. -
data_dimensions[3]
: Dimension of thedata_ptr
array, in the point of view of itself. -
data_dtype
: Data type of the array.
-
Field name
field_name
should be same as what you passed inyt_get_FieldsPtr
.
Do not mix grid dimensions get through
yt_getGridInfo_Dimensions
with data dimensions get throughyt_getGridInfo_FieldData
. Grid dimensions are numbers of cells in [x][y][z] <–> [0][1][2], excluding ghost cells. Whereas data dimensions are just data length in data’s point of view, which may consist of ghost cells.
You should not modify
data_ptr
, because they are actual simulation data passed in by user when setting grid informationyt_get_GridsPtr
.
yt_getGridInfo_ParticleData
int yt_getGridInfo_ParticleData(const long gid, const char *ptype, const char *attr, yt_data *par_data);
- Usage: Get the particle data
ptype
attributeattr
in grid idgid
. The result will be stored inpar_data
. - Return:
YT_SUCCESS
orYT_FAIL
if it cannot get data. -
yt_data
-
data_ptr
: Data pointer. -
data_dimensions[3]
: Dimension of thedata_ptr
array, in the point of view of itself. Ifdata_ptr
is a 1-dim array, the last two elements will be 0. -
data_dtype
: Data type of the array.
-
Particle type
ptype
and attributeattr
should be the same as what you passed inyt_get_ParticlesPtr
.
You should not modify
data_ptr
, because they are actual simulation data passed in by user when setting grid informationyt_get_GridsPtr
.