4.8.4. API Functions
[4.8. Meshes]

When an API function is called that fills in an array, the array must already be allocated. The path used in all of these functions is the path to the mesh folder, not the path for the element or node folder.

Writing
This function is used to set the number of elements for a mesh. Anyone using this API to read the mesh will have to know this in order to properly allocate their arrays.

C/C++
int xfSetNumberOfElements(xid GroupId, int NumElems);
FORTRAN
SUBROUTINE  XF_SET_NUMBER_OF_ELEMENTS(GroupId, NumElems, Error);
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(IN)      :: NumElems
INTEGER, INTENT(OUT)     :: Error
These functions are used to set the element types.  If all of the elements have the same type, you can pass a single value rather than passing an entire array. 
C/C++
int xfSetAllElemsSameType(xid GroupId, int type);
int xfWriteElemTypes(xid GroupId, int *type, int Compression);
FORTRAN
SUBROUTINE  XF_SET_ALL_ELEMS_SAME_TYPE(GroupId, Type, Error);
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(IN)      :: Type
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_WRITE_ELEM_TYPES(GroupId, Types, Error);
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(IN)      :: Types(*)
INTEGER, INTENT(OUT)     :: Error
This functions sets the node ids for the elements (must be numbered consistently with diagrams in Table 4). The "Ids" array must be a contiguous array of size MaxNumNodes X NumElems. The ids of the nodes start at one which represents the first array index in the node array. Since C arrays are zero based, the actual index of the node in the array when using C is decremented by one.

C/C++
int xfWriteElemNodeIds(xid GroupId, int MaxNumNodes, int *Ids, int Compression...);
FORTRAN
SUBROUTINE XF_WRITE_ELEM_NODE_IDS (a_Id, a_nElems, a_nMaxNodes, a_Ids, a_Compression, error)
INTEGER,         INTENT(IN)        :: a_Id
INTEGER,                INTENT(IN)        :: a_nElems, a_nMaxNodes, a_Compression
INTEGER, DIMENSION(*),  INTENT(IN)        :: a_Ids
INTEGER,                INTENT(OUT)       :: error
The functions to write the node group data are as follows:

C/C++
int xfSetNumberOfNodes(xid GroupId, int Num);
int xfWriteXNodeLocations(xid GroupId, double *Locs, int Compression);
int xfWriteYNodeLocations(xid GroupId, double *Locs);
int xfWriteZNodeLocations(xid GroupId, double *Locs);
FORTRAN
SUBROUTINE  XF_SET_NUMBER_OF_NODES(GroupId, Num, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(IN)      :: Num, Compression
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_WRITE_X_NODE_LOCATIONS(GroupId, XLocs, Compression, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(IN) :: Locs(*)
INTEGER, INTENT(IN)      :: Compression
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_WRITE_Y_NODE_LOCATIONS(GroupId, YLocs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(IN) :: Locs(*)
INTEGER, INTENT(IN)      :: Compression
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_WRITE_Z_NODE_LOCATIONS(GroupId, ZLocs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(IN) :: Locs(*)
INTEGER, INTENT(IN)      :: Compression
INTEGER, INTENT(OUT)     :: Error
 
// The locations can also be written as a single 2D array indexed by
// component then node index
SUBROUTINE  XF_WRITE_LOCATIONS(GroupId, Locs, Compression, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(IN) :: Locs(3,*)
INTEGER, INTENT(IN)      :: Compression
INTEGER, INTENT(OUT)     :: Error
Reading
Several functions are provided to read the element group data.

The following function is used to get the number of elements in a mesh:

C/C++
int xfGetNumberOfElements(xid GroupId, int *NumElems);
FORTRAN
SUBROUTINE  XF_GET_NUMBER_OF_ELEMENTS(GroupId, NumElems, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)      :: NumElems, Error
These functions are used to get the element types. If all of the elements have the same type, you can retrieve a single value rather than entire array.

C/C++
int xfAreAllElemsSameType(xid GroupId, xbool &Same);
int xfReadElemTypesSingleValue(xid GroupId, int *Type);
int xfReadElemTypes(xid GroupId, int *Types);
FORTRAN
SUBROUTINE  XF_ARE_ALL_ELEMS_SAME_TYPE(GroupId, Same, Error)
INTEGER(XID), INTENT(IN) :: GroupId
LOGICAL, INTENT(OUT)     :: Same
INTEGER, INTENT(OUT)      :: Error
 
SUBROUTINE  XF_READ_ELEM_TYPE_SINGLE_VALUE(GroupId, Type, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)     :: Type
INTEGER, INTENT(OUT)      :: Error
 
SUBROUTINE  XF_READ_ELEM_TYPES(GroupId, Types, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)     :: Types(*)
INTEGER, INTENT(OUT)      :: Error
These functions are used to get the element connectivity information. The first returns the maximum number of nodes in any element in the mesh. This is used to dimension the connectivity array returned by the second function.

C/C++
int xfGetMaxNodesInElem(xid GroupId, int *MaxNodes);
int xfReadElemNodeIds(xid GroupId, int *ElemNodes);
FORTRAN
SUBROUTINE  XF_GET_MAX_NODES_IN_ELEM(GroupId, MaxNodes, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)     :: MaxNodes
INTEGER, INTENT(OUT)      :: Error
 
SUBROUTINE  XF_GET_MAX_NODES_IN_ELEM(GroupId, ElemNodes, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)     :: ElemNodes(*)
INTEGER, INTENT(OUT)      :: Error
The functions to read the node group data will be:

C/C++
int xfGetNumberOfNodes(xid GroupId, int *NumNodes);
int xfReadNodeLocationsX(xid GroupId, double *xLocs); ???
int xfReadNodeLocationsY(xid GroupId, double *yLocs); ???
int xfReadNodeLocationsZ(xid GroupId, double *zLocs); ???
FORTRAN
SUBROUTINE  XF_GET_NUMBER_OF_NODES(GroupId, NumNodes, Error)
INTEGER(XID), INTENT(IN) :: GroupId
INTEGER, INTENT(OUT)     :: NumNodes
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_READ_NODE_LOCATIONS_X(GroupId, xLocs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(OUT)     :: xLocs(*)
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_READ_NODE_LOCATIONS_Y(GroupId, yLocs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(OUT)     :: yLocs(*)
INTEGER, INTENT(OUT)     :: Error
 
SUBROUTINE  XF_READ_NODE_LOCATIONS_Y(GroupId, zLocs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(OUT)     :: zLocs(*)
INTEGER, INTENT(OUT)     :: Error

// To read all the same time similar to writing.
SUBROUTINE XF_READ_NODE_LOCATIONS (GroupId, Locs, Error)
INTEGER(XID), INTENT(IN) :: GroupId
REAL(DOUBLE), INTENT(OUT)     :: Locs(3, *)
INTEGER, INTENT(OUT)     :: Error

Generated on Wed Jun 2 11:55:32 2010 for XMDF by  doxygen 1.5.6