Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
Element connectivity data.
+ Collaboration diagram for Element connectivity data.:

Functions

void mhdf_addElement (mhdf_FileHandle file_handle, const char *elem_handle, unsigned int named_elem_type, mhdf_Status *status)
 Add a new table of element data to the file.
char ** mhdf_getElemHandles (mhdf_FileHandle file_handle, unsigned int *count_out, mhdf_Status *status)
 Get the list of element groups in the file.
void mhdf_getElemTypeName (mhdf_FileHandle file_handle, const char *elem_handle, char *buffer, size_t buf_len, mhdf_Status *status)
 Get the element type name for a given element group handle.
int mhdf_isPolyElement (mhdf_FileHandle file_handle, const char *elem_handle, mhdf_Status *status)
 Check if an element group contains polygon or polyhedron.
hid_t mhdf_createConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, int num_nodes_per_elem, long num_elements, long *first_elem_id_out, mhdf_Status *status)
 Create connectivity table for an element group.
hid_t mhdf_openConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, int *num_nodes_per_elem_out, long *num_elements_out, long *first_elem_id_out, mhdf_Status *status)
 Open connectivity table for an element group.
hid_t mhdf_openConnectivitySimple (mhdf_FileHandle file_handle, const char *elem_handle, mhdf_Status *status)
void mhdf_writeConnectivity (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *node_id_list, mhdf_Status *status)
 Write element coordinate data.
void mhdf_writeConnectivityWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *node_id_list, hid_t write_prop, mhdf_Status *status)
void mhdf_readConnectivity (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *node_id_list, mhdf_Status *status)
 Read element coordinate data.
void mhdf_readConnectivityWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *node_id_list, hid_t read_prop, mhdf_Status *status)
void mhdf_createPolyConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, long num_poly, long data_list_length, long *first_id_out, hid_t idx_and_id_handles_out[2], mhdf_Status *status)
 Create a new table for polygon or polyhedron connectivity data.
void mhdf_openPolyConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, long *num_poly_out, long *data_list_length_out, long *first_id_out, hid_t idx_and_id_handles_out[2], mhdf_Status *status)
 Open a table of polygon or polyhedron connectivity data.
void mhdf_writePolyConnIndices (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *index_list, mhdf_Status *status)
 Write polygon or polyhedron index data.
void mhdf_writePolyConnIndicesWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *index_list, hid_t write_prop, mhdf_Status *status)
void mhdf_writePolyConnIDs (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, mhdf_Status *status)
 Write polygon or polyhedron connectivity data.
void mhdf_writePolyConnIDsWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, hid_t write_prop, mhdf_Status *status)
void mhdf_readPolyConnIndices (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *index_list, mhdf_Status *status)
 Read polygon or polyhedron index data.
void mhdf_readPolyConnIndicesWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *index_list, hid_t read_prop, mhdf_Status *status)
void mhdf_readPolyConnIDs (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, mhdf_Status *status)
 Read polygon or polyhedron connectivity data.
void mhdf_readPolyConnIDsWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, hid_t read_prop, mhdf_Status *status)

Function Documentation

void mhdf_addElement ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
unsigned int  named_elem_type,
mhdf_Status status 
)

Add a new table of element data to the file.

Add a element group to the file. An element group is the data for a block of elements with the same TSTT type and same number of nodes in their connectivity data. (e.g. all the MBHEX20 elements). This function is also used to create the groups for general polygon data and general polyhedron data. The requirement that all elements have the same number of nodes in their connectivity does not apply for poly(gons|hedra).

Parameters:
file_handleFile in which to create the element type.
elem_handleThe name to use for the element data. This name is used as an identifier to reference the data for this element type later. The selected name also appears explicitly in the file and therefore should be something descriptive of the element type such as the 'base type' and number of nodes (e.g. "Hex20").
named_elem_typeAn index into the list of named element types passed to mhdf_createFile .
statusPassed back status of API call.

Definition at line 507 of file file.c.

References API_BEGIN, API_END, DENSE_TAG_SUBGROUP, ELEM_TYPE_ATTRIB, ELEMENT_GROUP, get_elem_type_enum(), struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_malloc(), mhdf_name_to_path(), mhdf_path_to_name(), mhdf_setFail(), and mhdf_setOkay().

Referenced by moab::WriteHDF5::create_elem_table().

{
    FileHandle* file_ptr = (FileHandle*)file_handle;
    hid_t group_id, tag_id, enum_id;
    char *path, *ptr;
    size_t name_len;
    herr_t rval;
    API_BEGIN;

    if( !mhdf_check_valid_file( file_ptr, status ) ) return;

    name_len = mhdf_name_to_path( name, NULL, 0 );
    name_len += strlen( ELEMENT_GROUP ) + 1;
    path = (char*)mhdf_malloc( name_len, status );
    if( !path ) return;

    strcpy( path, ELEMENT_GROUP );
    ptr = path + strlen( ELEMENT_GROUP );
    if( !mhdf_path_to_name( name, ptr ) )
    {
        mhdf_setFail( status, "Invalid character string in internal file path: \"%s\"\n", name );
        return;
    }

#if defined( H5Gcreate_vers ) && H5Gcreate_vers > 1
    group_id = H5Gcreate2( file_ptr->hdf_handle, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
#else
    group_id     = H5Gcreate( file_ptr->hdf_handle, path, 3 );
#endif
    if( group_id < 0 )
    {
        mhdf_setFail( status, "Creation of \"%s\" group failed.\n", path );
        free( path );
        return;
    }
    free( path );

#if defined( H5Gcreate_vers ) && H5Gcreate_vers > 1
    tag_id = H5Gcreate2( group_id, DENSE_TAG_SUBGROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
#else
    tag_id       = H5Gcreate( group_id, DENSE_TAG_SUBGROUP, 0 );
#endif
    if( tag_id < 0 )
    {
        H5Gclose( group_id );
        mhdf_setFail( status, "Creation of tag subgroup failed.\n" );
        return;
    }
    H5Gclose( tag_id );

    enum_id = get_elem_type_enum( file_ptr, status );
    if( enum_id < 0 )
    {
        H5Gclose( group_id );
        return;
    }

    rval = H5Tconvert( H5T_NATIVE_UINT, H5Tget_super( enum_id ), 1, &elem_type, NULL, H5P_DEFAULT );
    if( rval < 0 )
    {
        H5Gclose( group_id );
        H5Tclose( enum_id );
        mhdf_setFail( status, "Internal error converting to enum type." );
        return;
    }

    rval = mhdf_create_scalar_attrib( group_id, ELEM_TYPE_ATTRIB, enum_id, &elem_type, status );
    H5Tclose( enum_id );
    if( rval < 0 )
    {
        H5Gclose( group_id );
        return;
    }

    H5Gclose( group_id );
    mhdf_setOkay( status );
    API_END;
}
hid_t mhdf_createConnectivity ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
int  nodes_per_elem,
long  count,
long *  first_id_out,
mhdf_Status status 
)

Create connectivity table for an element group.

Create fixed-connectivity data for an element group. Do NOT use this function for poly(gon/hedron) data.

Parameters:
file_handleThe file.
elem_handleThe element group.
num_nodes_per_elemThe number of nodes in the connectivity data for each element.
num_elementsThe number of elements to be written to the table.
first_elem_id_outElements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table.
statusPassed back status of API call.
Returns:
The HDF5 handle to the connectivity data.

MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.

Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Definition at line 26 of file connectivity.c.

References API_BEGIN, API_END_H, CONNECTIVITY_NAME, struct_FileHandle::id_type, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), mhdf_elem_group_from_handle(), mhdf_setFail(), mhdf_setOkay(), mhdf_write_max_id(), struct_FileHandle::open_handle_count, and START_ID_ATTRIB.

Referenced by moab::WriteHDF5::create_elem_table().

{
    FileHandle* file_ptr;
    hid_t elem_id, table_id;
    hsize_t dims[2];
    long first_id;
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;

    if( nodes_per_elem <= 0 || count < 0 || !first_id_out )
    {
        mhdf_setFail( status, "Invalid argument." );
        return -1;
    }

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
    if( elem_id < 0 ) return -1;

    dims[0]  = (hsize_t)count;
    dims[1]  = (hsize_t)nodes_per_elem;
    table_id = mhdf_create_table( elem_id, CONNECTIVITY_NAME, file_ptr->id_type, 2, dims, status );
    H5Gclose( elem_id );
    if( table_id < 0 ) return -1;

    first_id = file_ptr->max_id + 1;
    if( !mhdf_create_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
    {
        H5Dclose( table_id );
        return -1;
    }

    *first_id_out = first_id;
    file_ptr->max_id += count;
    if( !mhdf_write_max_id( file_ptr, status ) )
    {
        H5Dclose( table_id );
        return -1;
    }
    file_ptr->open_handle_count++;
    mhdf_setOkay( status );

    API_END_H( 1 );
    return table_id;
}
void mhdf_createPolyConnectivity ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
long  num_poly,
long  data_list_length,
long *  first_id_out,
hid_t  idx_and_id_handles_out[2],
mhdf_Status status 
)

Create a new table for polygon or polyhedron connectivity data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

Parameters:
file_handleThe file to write.
elem_handleThe element group.
num_polyThe total number number of polygons or polyhedra to be written in the table.
data_list_lengthThe total number of values to be written to the table (the number of polys plus the sum of the number of entities in each poly's connectivity data.)
first_id_outElements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table.
idx_and_id_handles_outThe handles for the index list and connectivity list, respectively.
statusPassed back status of API call.

Definition at line 187 of file connectivity.c.

References API_BEGIN, API_END_H, CONNECTIVITY_NAME, dim, struct_FileHandle::id_type, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), mhdf_elem_group_from_handle(), MHDF_INDEX_TYPE, mhdf_setFail(), mhdf_setOkay(), mhdf_write_max_id(), struct_FileHandle::open_handle_count, POLY_INDEX_NAME, and START_ID_ATTRIB.

{
    FileHandle* file_ptr;
    hid_t elem_id, index_id, conn_id;
    hsize_t dim;
    long first_id;
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return;

    if( num_poly <= 0 || data_list_length <= 0 || !first_id_out )
    {
        mhdf_setFail( status, "Invalid argument." );
        return;
    }

    if( data_list_length < 3 * num_poly )
    {
        /* Could check agains 4*num_poly, but allow degenerate polys
           (1 for count plus 2 dim-1 defining entities, where > 2
            defining entities is a normal poly, 2 defining entities
            is a degenerate poly and 1 defning entity is not valid.)
        */

        mhdf_setFail( status,
                      "Invalid polygon data:  data length of %ld is "
                      "insufficient for %ld poly(gons/hedra).\n",
                      data_list_length, num_poly );
        return;
    }

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_type, status );
    if( elem_id < 0 ) return;

    dim      = (hsize_t)num_poly;
    index_id = mhdf_create_table( elem_id, POLY_INDEX_NAME, MHDF_INDEX_TYPE, 1, &dim, status );
    if( index_id < 0 )
    {
        H5Gclose( elem_id );
        return;
    }

    dim     = (hsize_t)data_list_length;
    conn_id = mhdf_create_table( elem_id, CONNECTIVITY_NAME, file_ptr->id_type, 1, &dim, status );
    H5Gclose( elem_id );
    if( conn_id < 0 )
    {
        H5Dclose( index_id );
        return;
    }

    first_id = file_ptr->max_id + 1;
    if( !mhdf_create_scalar_attrib( conn_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
    {
        H5Dclose( index_id );
        H5Dclose( conn_id );
        return;
    }

    *first_id_out = first_id;
    file_ptr->max_id += num_poly;
    if( !mhdf_write_max_id( file_ptr, status ) )
    {
        H5Dclose( index_id );
        H5Dclose( conn_id );
        return;
    }
    file_ptr->open_handle_count++;
    mhdf_setOkay( status );
    handles_out[0] = index_id;
    handles_out[1] = conn_id;
    API_END_H( 2 );
}
char** mhdf_getElemHandles ( mhdf_FileHandle  file_handle,
unsigned int *  count_out,
mhdf_Status status 
)

Get the list of element groups in the file.

Get the list of element groups in the file. An element group is the data for a block of elements with the same TSTT type and same number of nodes in their connectivity data. (e.g. all the MBHEX20 elements). This function is also used to retrieve the groups for general polygon data and general polyhedron data. The requirement that all elements have the same number of nodes in their connectivity does not apply for poly(gons|hedra).

Parameters:
file_handleThe file.
count_outMemory location at which to store the length of the returned array.
statusPassed back status of API call.
Returns:
An array of pointers to element group names. This array is allocated as a single memory block and should be freed with one call to free().

Definition at line 586 of file file.c.

References buffer, ELEMENT_GROUP, struct_FileHandle::hdf_handle, length(), mhdf_check_valid_file(), mhdf_malloc(), mhdf_path_to_name(), mhdf_setFail(), and mhdf_setOkay().

Referenced by main(), and mhdf_getFileSummary().

{
    hsize_t count, length, i;
    char** buffer;
    char* current;
    hid_t group_id;
    herr_t rval;
    ssize_t rlen = 0;
    size_t remaining;
    FileHandle* file_ptr = (FileHandle*)file_handle;
    if( !mhdf_check_valid_file( file_ptr, status ) ) return NULL;

#if defined( H5Gopen_vers ) && H5Gopen_vers > 1
    group_id = H5Gopen2( file_ptr->hdf_handle, ELEMENT_GROUP, H5P_DEFAULT );
#else
    group_id     = H5Gopen( file_ptr->hdf_handle, ELEMENT_GROUP );
#endif
    if( group_id < 0 )
    {
        mhdf_setFail( status, "Invalid file -- element group does not exist." );
        return NULL;
    }

    rval = H5Gget_num_objs( group_id, &count );
    if( rval < 0 )
    {
        H5Gclose( group_id );
        mhdf_setFail( status, "Internal error calling H5Gget_num_objs." );
        return NULL;
    }
    *count_out = count;

    for( i = 0; i < count; ++i )
    {
        rlen += H5Gget_objname_by_idx( group_id, i, NULL, 0 ) + 1;
    }

    length = count * sizeof( char* ) + rlen;
    buffer = (char**)mhdf_malloc( length, status );
    if( !buffer )
    {
        H5Gclose( group_id );
        return NULL;
    }
    current   = (char*)( buffer + count );
    remaining = rlen;

    for( i = 0; i < count; ++i )
    {
        buffer[i] = current;
        rlen      = H5Gget_objname_by_idx( group_id, i, current, remaining ) + 1;
        if( rlen < 0 )
        {
            H5Gclose( group_id );
            free( buffer );
            mhdf_setFail( status, "Internal error calling H5Gget_objname_by_idx." );
            return NULL;
        }

        mhdf_path_to_name( current, current );
        remaining -= rlen;
        current += rlen;
    }

    H5Gclose( group_id );
    mhdf_setOkay( status );
    return buffer;
}
void mhdf_getElemTypeName ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
char *  buffer,
size_t  buf_len,
mhdf_Status status 
)

Get the element type name for a given element group handle.

Fails if name is longer than buf_len.

Parameters:
file_handleThe file.
elem_handleOne of the group names passed back from mhdf_getElemHandles
bufferA buffer to copy the name into.
buf_lenThe length of buffer.
statusPassed back status of API call.

Definition at line 655 of file file.c.

References API_BEGIN, API_END, ELEM_TYPE_ATTRIB, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_setFail(), and mhdf_setOkay().

Referenced by get_elem_desc(), and main().

{
    FileHandle* file_ptr;
    hid_t elem_id, type_id, attr_id;
    char bytes[16];
    herr_t rval;
    API_BEGIN;

    if( NULL == buffer || buf_len < 2 )
    {
        mhdf_setFail( status, "invalid input" );
        return;
    }
    buffer[0] = '\0';

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return;

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
    if( elem_id < 0 ) return;

    attr_id = H5Aopen_name( elem_id, ELEM_TYPE_ATTRIB );
    H5Gclose( elem_id );
    if( attr_id < 0 )
    {
        mhdf_setFail( status, "Missing element type attribute.  Invalid file." );
        return;
    }

    type_id = H5Aget_type( attr_id );
    assert( type_id > 0 );

    rval = H5Aread( attr_id, type_id, bytes );
    H5Aclose( attr_id );
    if( rval < 0 )
    {
        H5Tclose( type_id );
        mhdf_setFail( status, "Failed to read element type attribute.  Invalid file." );
        return;
    }

    rval = H5Tenum_nameof( type_id, bytes, buffer, buf_len );
    H5Tclose( type_id );
    if( rval < 0 )
    {
        mhdf_setFail( status, "Invalid datatype for element type attribute.  Invalid file." );
        return;
    }

    mhdf_setOkay( status );
    API_END;
    return;
}
int mhdf_isPolyElement ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
mhdf_Status status 
)

Check if an element group contains polygon or polyhedron.

Check if an element group contains general polygon or polyhedrons rather than typically fixed-connectivity elements.

Parameters:
file_handleThe file.
elem_handleThe element group.
statusPassed back status of API call.
Returns:
Zero if normal fixed-connectivity element data. Non-zero if poly(gon/hedron) general-connectivity data.

Definition at line 748 of file file.c.

References API_BEGIN, API_END, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_is_in_group(), mhdf_setOkay(), and POLY_INDEX_NAME.

Referenced by get_elem_desc().

{
    FileHandle* file_ptr;
    hid_t elem_id;
    int rval;
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
    if( elem_id < 0 ) return -1;

    mhdf_setOkay( status );
    rval = mhdf_is_in_group( elem_id, POLY_INDEX_NAME, status );
    H5Gclose( elem_id );
    API_END;
    return rval;
}
hid_t mhdf_openConnectivity ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
int *  num_nodes_per_elem_out,
long *  num_elements_out,
long *  first_elem_id_out,
mhdf_Status status 
)

Open connectivity table for an element group.

Open fixed-connectivity data for an element group. Do NOT use this function for poly(gon/hedron) data. Use mhdf_isPolyElement or mhdf_getTsttElemType to check if the data is poly(gon|hedron) data before calling this function to open the data.

Parameters:
file_handleThe file.
elem_handleThe element group.
num_nodes_per_elem_outUsed to pass back the number of nodes in each element.
num_elements_outPass back the number of elements in the table.
first_elem_id_outElements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table.
statusPassed back status of API call.
Returns:
The HDF5 handle to the connectivity data.

Definition at line 78 of file connectivity.c.

References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table2(), mhdf_setFail(), mhdf_setOkay(), and struct_FileHandle::open_handle_count.

Referenced by get_elem_desc(), main(), and moab::WriteHDF5::write_elems().

{
    FileHandle* file_ptr;
    hid_t elem_id, table_id;
    hsize_t dims[2];
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;

    if( !num_nodes_per_elem_out || !num_elements_out || !first_elem_id_out )
    {
        mhdf_setFail( status, "Invalid argument." );
        return -1;
    }

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
    if( elem_id < 0 ) return -1;

    table_id = mhdf_open_table2( elem_id, CONNECTIVITY_NAME, 2, dims, first_elem_id_out, status );

    H5Gclose( elem_id );
    if( table_id < 0 ) return -1;

    *num_elements_out       = dims[0];
    *num_nodes_per_elem_out = dims[1];

    file_ptr->open_handle_count++;
    mhdf_setOkay( status );
    API_END_H( 1 );
    return table_id;
}
hid_t mhdf_openConnectivitySimple ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
mhdf_Status status 
)

Definition at line 116 of file connectivity.c.

References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table_simple(), mhdf_setOkay(), and struct_FileHandle::open_handle_count.

Referenced by check_valid_elem_conn(), moab::ReadHDF5::read_elems(), and moab::ReadHDF5::read_node_adj_elems().

{
    FileHandle* file_ptr;
    hid_t elem_id, table_id;
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;

    elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
    if( elem_id < 0 ) return -1;

    table_id = mhdf_open_table_simple( elem_id, CONNECTIVITY_NAME, status );

    H5Gclose( elem_id );
    if( table_id < 0 ) return -1;

    file_ptr->open_handle_count++;
    mhdf_setOkay( status );
    API_END_H( 1 );
    return table_id;
}
void mhdf_openPolyConnectivity ( mhdf_FileHandle  file_handle,
const char *  elem_handle,
long *  num_poly_out,
long *  data_list_length_out,
long *  first_id_out,
hid_t  idx_and_id_handles_out[2],
mhdf_Status status 
)

Open a table of polygon or polyhedron connectivity data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

Parameters:
file_handleThe file to write.
elem_handleThe element group.
num_poly_outThe total number number of polygons or polyhedra to be written in the table.
data_list_length_outThe total number of values to be written to the table (the number of polys plus the sum of the number of entities in each poly's connectivity data.)
first_id_outElements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table.
idx_and_id_handles_outThe handles for the index list and connectivity list, respectively.
statusPassed back status of API call.

Definition at line 268 of file connectivity.c.

References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table(), mhdf_read_scalar_attrib(), mhdf_setFail(), mhdf_setOkay(), struct_FileHandle::open_handle_count, POLY_INDEX_NAME, and START_ID_ATTRIB.

Referenced by check_valid_poly_conn(), get_elem_desc(), and moab::ReadHDF5::read_poly().

{
    FileHandle* file_ptr;
    hid_t elem_id, table_id, index_id;
    hsize_t row_count;
    API_BEGIN;

    file_ptr = (FileHandle*)( file_handle );
    if( !mhdf_check_valid_file( file_ptr, status ) ) return;

    if( !num_poly_out || !data_list_length_out || !first_poly_id_out )
    {
        mhdf_setFail( status, "Invalid argument." );
        return;
    }

    elem_id = mhdf_elem_group_from_handle( file_ptr, element_handle, status );
    if( elem_id < 0 ) return;

    index_id = mhdf_open_table( elem_id, POLY_INDEX_NAME, 1, &row_count, status );
    if( index_id < 0 )
    {
        H5Gclose( elem_id );
        return;
    }
    *num_poly_out = (int)row_count;

    table_id = mhdf_open_table( elem_id, CONNECTIVITY_NAME, 1, &row_count, status );

    H5Gclose( elem_id );
    if( table_id < 0 )
    {
        H5Dclose( index_id );
        return;
    }
    *data_list_length_out = (long)row_count;

    if( !mhdf_read_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, first_poly_id_out, status ) )
    {
        H5Dclose( table_id );
        H5Dclose( index_id );
        return;
    }

    file_ptr->open_handle_count++;
    handles_out[0] = index_id;
    handles_out[1] = table_id;
    mhdf_setOkay( status );
    API_END_H( 2 );
}
void mhdf_readConnectivity ( hid_t  data_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  node_id_list,
mhdf_Status status 
)

Read element coordinate data.

Read interleaved fixed-connectivity element data for a block of elements. Note: Do not use this for polygon or polyhedron data.

Parameters:
data_handleHandle returned from mhdf_createConnectivity or mhdf_openConnectivity.
offsetTable row (element index) at which to start read.
countNumber of rows (number of elements) to read.
hdf_integer_typeThe type of the integer data in node_id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
node_id_listPointer to memory at which to write interleaved connectivity data specified as global node IDs.
statusPassed back status of API call.

Definition at line 163 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

Referenced by check_valid_elem_conn(), and main().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, nodes, H5P_DEFAULT, status );
    API_END;
}
void mhdf_readConnectivityWithOpt ( hid_t  data_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  node_id_list,
hid_t  read_prop,
mhdf_Status status 
)

Definition at line 174 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

Referenced by moab::ReadHDF5::read_node_adj_elems().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, nodes, prop, status );
    API_END;
}
void mhdf_readPolyConnIDs ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  id_list,
mhdf_Status status 
)

Read polygon or polyhedron connectivity data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

Parameters:
poly_handleThe handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity.
offsetThe offset in the table at which to read. The offset is in terms of the integer values in the table, not the count of polys.
countThe size of the integer list to read.
hdf_integer_typeThe type of the integer data as written into memory. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
id_listThe memory location at which to write the connectivity data.
statusPassed back status of API call.

Definition at line 397 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

Referenced by check_valid_poly_conn().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, id_list, H5P_DEFAULT, status );
    API_END;
}
void mhdf_readPolyConnIDsWithOpt ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  id_list,
hid_t  read_prop,
mhdf_Status status 
)

Definition at line 408 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, id_list, prop, status );
    API_END;
}
void mhdf_readPolyConnIndices ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  index_list,
mhdf_Status status 
)

Read polygon or polyhedron index data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

Parameters:
poly_handleThe handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity.
offsetThe offset in the table at which to read. The offset is in terms of the integer values in the table, not the count of polys.
countThe size of the integer list to read.
hdf_integer_typeThe type of the integer data as written into memory. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
index_listThe memory location at which to write the indices.
statusPassed back status of API call.

Definition at line 349 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

Referenced by check_valid_poly_conn().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, index_list, H5P_DEFAULT, status );
    API_END;
}
void mhdf_readPolyConnIndicesWithOpt ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
void *  index_list,
hid_t  read_prop,
mhdf_Status status 
)

Definition at line 360 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_read_data().

{
    API_BEGIN;
    mhdf_read_data( table_id, offset, count, hdf_integer_type, index_list, prop, status );
    API_END;
}
void mhdf_writeConnectivity ( hid_t  data_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  node_id_list,
mhdf_Status status 
)

Write element coordinate data.

Write interleaved fixed-connectivity element data for a block of elements. Note: Do not use this for polygon or polyhedron data.

Parameters:
data_handleHandle returned from mhdf_createConnectivity or mhdf_openConnectivity.
offsetTable row (element index) at which to start writing.
countNumber of rows (number of elements) to write.
hdf_integer_typeThe type of the integer data in node_id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
node_id_listInterleaved connectivity data specified as global node IDs.
statusPassed back status of API call.

Definition at line 139 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, nodes, H5P_DEFAULT, status );
    API_END;
}
void mhdf_writeConnectivityWithOpt ( hid_t  data_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  node_id_list,
hid_t  write_prop,
mhdf_Status status 
)

Definition at line 150 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

Referenced by moab::WriteHDF5::write_elems().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, nodes, prop, status );
    API_END;
}
void mhdf_writePolyConnIDs ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  id_list,
mhdf_Status status 
)

Write polygon or polyhedron connectivity data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

This function writes the connectivity/ID list.

Parameters:
poly_handleThe handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity.
offsetThe offset in the table at which to write. The offset is in terms of the integer values in the table, not the count of polys.
countThe size of the integer list to write.
hdf_integer_typeThe type of the integer data in id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
id_listThe count/global ID list specifying the connectivity of the polys.
statusPassed back status of API call.

Definition at line 373 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, id_list, H5P_DEFAULT, status );
    API_END;
}
void mhdf_writePolyConnIDsWithOpt ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  id_list,
hid_t  write_prop,
mhdf_Status status 
)

Definition at line 384 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, id_list, prop, status );
    API_END;
}
void mhdf_writePolyConnIndices ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  index_list,
mhdf_Status status 
)

Write polygon or polyhedron index data.

Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)

This function writes the index list.

Parameters:
poly_handleThe handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity.
offsetThe offset in the table at which to write. The offset is in terms of the integer values in the table, not the count of polys.
countThe size of the integer list to write.
hdf_integer_typeThe type of the integer data in id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER
index_listThe index list for the polys.
statusPassed back status of API call.

Definition at line 325 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, index_list, H5P_DEFAULT, status );
    API_END;
}
void mhdf_writePolyConnIndicesWithOpt ( hid_t  poly_handle,
long  offset,
long  count,
hid_t  hdf_integer_type,
const void *  index_list,
hid_t  write_prop,
mhdf_Status status 
)

Definition at line 336 of file connectivity.c.

References API_BEGIN, API_END, and mhdf_write_data().

{
    API_BEGIN;
    mhdf_write_data( table_id, offset, count, hdf_integer_type, index_list, prop, status );
    API_END;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines