IDXL Layouts are normally used to describe arrays of data associated with nodes or elements. The layout abstraction allows you to use IDXL routines to communicate any sort of data, stored in a variety of formats.
Like Index Lists, Layouts are referred to via an opaque handle--in a C program via the integer typedef IDXL_Layout_t, and in Fortran via a bare integer.
In most programs, the data to be communicated is a dense array of data of one type. In this case, there is only one layout routine you need to know:
IDXL_Layout_t IDXL_Layout_create(int type,int width);
INTEGER function IDXL_Layout_create(type,width)
INTEGER, INTENT(IN) :: type,width
The simplest data layout to describe--a dense array of this IDXL datatype, indexed by entity number, with width pieces of data per entity. Note that the number of entities is not stored with the layout-the number of entities to be communicated depends on the communication routine.
The IDXL datatypes are:
| IDXL Datatype | C Datatypes | Fortran Datatypes |
| IDXL_BYTE | unsigned char | INTEGER*1 |
| char | LOGICAL*1 | |
| IDXL_INT | int | INTEGER |
| IDXL_REAL | float | SINGLE PRECISION |
| REAL*4 | ||
| IDXL_DOUBLE | double | DOUBLE PRECISION |
| REAL*8 |
For example, if you keep a dense array with 3 doubles of force per node, you'd call this routine as:
This routine was once called FEM_Create_simple_field.
These advanced routines are only needed if you want to exchange data stored in an array of user-defined types. Most programs only need IDXL_Layout_create.
IDXL_Layout_t IDXL_Layout_offset(int type, int width, int offsetBytes, int distanceBytes,int skewBytes);
INTEGER function IDXL_Layout_offset(type,width,offsetBytes,distanceBytes,skewBytes)
INTEGER, INTENT(IN) :: type,width,offsetBytes,distanceBytes,skewBytes
The most general data layout-an array indexed by entity, containing width pieces of data per entity. This routine expands on IDXL_Layout_create by adding support for user-defined types or other unusual data layouts. You describe your layout by giving various in-memory byte offsets that describe the data is stored. Again, the number of entities is not stored with the layout-the number of entities to be communicated depends on the communication routine.
For example, if your node data is all stored in a struct (in fortran, a named TYPE), offsetBytes gives the distance between the start of the struct and the force; and distanceBytes gives the size in bytes of the struct.
In C, the offsetof and sizeof keywords are useful for finding these values. In Fortran, we provide a special routine called foffsetof that returns the distance, in bytes, between its two arguments.
void IDXL_Layout_destroy(IDXL_Layout_t layout);
SUBROUTINE IDXL_Layout_destroy(layout)
INTEGER, INTENT(IN) :: layout
Destroy this Layout. You only need call this routine if you repeatedly create layouts.
int IDXL_Get_layout_type(IDXL_Layout_t layout);
INTEGER function IDXL_Get_layout_type(layout)
Return the IDXL datatype for this layout.
int IDXL_Get_layout_width(IDXL_Layout_t layout);
INTEGER function IDXL_Get_layout_width(layout)
Return the layout width--the number of data items that are communicated per entity.
int IDXL_Get_layout_distance(IDXL_Layout_t layout);
INTEGER function IDXL_Get_layout_distance(layout)
Return the layout distance--the number of bytes between successive entity's data items.
Before IDXL was made a separate library, FEM included these routines, which are still preserved for backward compatability.
IDXL_Layout_t FEM_Create_simple_field(int type,int width);
INTEGER function FEM_Create_simple_field(type,width)
INTEGER, INTENT(IN) :: type,width
This routine is completely interchangable to IDXL_Layout_create.
int FEM_Create_field(int type,int width,int offset,int distance);
INTEGER function FEM_Create_field(type, width, offset, distance)
INTEGER, INTENT(IN) :: type, width, offset, distance
This routine is like a call to IDXL_Layout_offset with the rarely used skewBytes set to zero.
September 22, 2008
FEM Homepage
Charm Homepage