MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::ExoIIUtil Class Reference

#include <ExoIIUtil.hpp>

+ Inheritance diagram for moab::ExoIIUtil:
+ Collaboration diagram for moab::ExoIIUtil:

Public Member Functions

 ExoIIUtil (Interface *mdb)
 ~ExoIIUtil ()
virtual ExoIIElementType element_name_to_type (const char *name)
 given the element name, return the type
virtual ExoIIElementType get_element_type (EntityHandle entity, Tag mid_nodes_tag, Tag geom_dimension_tag, EntityType indiv_entity_type=MBMAXTYPE)
virtual void has_mid_nodes (ExoIIElementType elem_type, int *array)
virtual int has_mid_nodes (ExoIIElementType elem_type, int dimension)
virtual int geometric_dimension (const ExoIIElementType elem_type)
 return the geometric dimension of the specified element type
virtual const char * element_type_name (ExoIIElementType type)

Static Public Member Functions

static ExoIIElementType static_element_name_to_type (const char *name)
 given the element name, return the type
static ExoIIElementType static_get_element_type (Interface *mdbImpl, const EntityHandle entity, const Tag mid_nodes_tag, const Tag geom_dimension_tag, const EntityType indiv_entity_type=MBMAXTYPE)
static ExoIIElementType get_element_type_from_num_verts (const int num_verts, const EntityType entity_type=MBMAXTYPE, const int dimension=3)

Static Public Attributes

static const EntityType ExoIIElementMBEntity []
 the MB entity type used for each element type
static const char * ElementTypeNames []
 names for all the element types that MB ExoII reader supports
static const int VerticesPerElement []
 number of vertices per element
static const int HasMidNodes [][4]
static const int ElementGeometricDimension []
 geometric dimension of each element

Private Attributes

InterfacemMB

Detailed Description

Definition at line 33 of file ExoIIUtil.hpp.


Constructor & Destructor Documentation

Definition at line 39 of file ExoIIUtil.hpp.

: mMB( mdb ) {}

Definition at line 40 of file ExoIIUtil.hpp.

{}

Member Function Documentation

virtual ExoIIElementType moab::ExoIIUtil::element_name_to_type ( const char *  name) [inline, virtual]

given the element name, return the type

Implements moab::ExoIIInterface.

Definition at line 43 of file ExoIIUtil.hpp.

References static_element_name_to_type().

Referenced by check_type().

virtual const char* moab::ExoIIUtil::element_type_name ( ExoIIElementType  type) [inline, virtual]

Implements moab::ExoIIInterface.

Definition at line 77 of file ExoIIUtil.hpp.

References ElementTypeNames.

Referenced by check_type().

    {
        return ElementTypeNames[type];
    }
virtual int moab::ExoIIUtil::geometric_dimension ( const ExoIIElementType  elem_type) [inline, virtual]

return the geometric dimension of the specified element type

Implements moab::ExoIIInterface.

Definition at line 72 of file ExoIIUtil.hpp.

References ElementGeometricDimension.

    {
        return ElementGeometricDimension[elem_type];
    }
virtual ExoIIElementType moab::ExoIIUtil::get_element_type ( EntityHandle  entity,
Tag  mid_nodes_tag,
Tag  geom_dimension_tag,
EntityType  indiv_entity_type = MBMAXTYPE 
) [inline, virtual]

get the element type of the entity; this entity can either be a meshset, in which case it will be assumed to be a material set meshset, or an individual entity.

Implements moab::ExoIIInterface.

Definition at line 51 of file ExoIIUtil.hpp.

References mMB, and static_get_element_type().

    {
        return static_get_element_type( mMB, entity, mid_nodes_tag, geom_dimension_tag, indiv_entity_type );
    }
ExoIIElementType moab::ExoIIUtil::get_element_type_from_num_verts ( const int  num_verts,
const EntityType  entity_type = MBMAXTYPE,
const int  dimension = 3 
) [static]

given the number of vertices in an entity, and optionally the entity type and geometric dimension, return the corresponding exodusII element type; dimension defaults to 3 following TSTT convention

Definition at line 300 of file ExoIIUtil.cpp.

References ElementGeometricDimension, moab::EXOII_MAX_ELEM_TYPE, moab::EXOII_POLYGON, moab::EXOII_POLYHEDRON, ExoIIElementMBEntity, MBMAXTYPE, MBPOLYGON, MBPOLYHEDRON, and VerticesPerElement.

Referenced by moab::WriteTemplate::gather_mesh_information(), moab::WriteSLAC::gather_mesh_information(), moab::WriteNCDF::gather_mesh_information(), and static_get_element_type().

{
    if( MBPOLYGON == entity_type && 2 == dimension ) return EXOII_POLYGON;
    if( MBPOLYHEDRON == entity_type && 3 == dimension ) return EXOII_POLYHEDRON;
    for( int i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
    {
        if( ( entity_type == MBMAXTYPE || entity_type == ExoIIElementMBEntity[i] ) &&
            VerticesPerElement[i] == num_verts && ElementGeometricDimension[i] >= dimension )
            return (ExoIIElementType)i;
    }

    return EXOII_MAX_ELEM_TYPE;
}
virtual void moab::ExoIIUtil::has_mid_nodes ( ExoIIElementType  elem_type,
int *  array 
) [inline, virtual]

Implements moab::ExoIIInterface.

Definition at line 59 of file ExoIIUtil.hpp.

References HasMidNodes.

Referenced by static_get_element_type().

    {
        array[0] = HasMidNodes[elem_type][0];
        array[1] = HasMidNodes[elem_type][1];
        array[2] = HasMidNodes[elem_type][2];
        array[3] = HasMidNodes[elem_type][3];
    }
virtual int moab::ExoIIUtil::has_mid_nodes ( ExoIIElementType  elem_type,
int  dimension 
) [inline, virtual]

Implements moab::ExoIIInterface.

Definition at line 67 of file ExoIIUtil.hpp.

References HasMidNodes.

    {
        return HasMidNodes[elem_type][dimension];
    }

given the element name, return the type

Definition at line 218 of file ExoIIUtil.cpp.

References ElementTypeNames, and moab::EXOII_MAX_ELEM_TYPE.

Referenced by element_name_to_type(), moab::ReadNCDF::read_elements(), and moab::ReadNCDF::update().

{
    int i;
    for( i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
        if( strcmp( ElementTypeNames[i], name ) == 0 ) return (ExoIIElementType)i;

    return EXOII_MAX_ELEM_TYPE;
}
ExoIIElementType moab::ExoIIUtil::static_get_element_type ( Interface mdbImpl,
const EntityHandle  entity,
const Tag  mid_nodes_tag,
const Tag  geom_dimension_tag,
const EntityType  indiv_entity_type = MBMAXTYPE 
) [static]

get the element type of the entity; this entity can either be a meshset, in which case it will be assumed to be a material set meshset, or an individual entity. If a meshset, and indiv_entity_type is input, that type is used to start the search for the connectivity tag which determines how many vertices per entity are defined for that meshset

Definition at line 227 of file ExoIIUtil.cpp.

References moab::CN::Dimension(), ElementGeometricDimension, moab::EXOII_MAX_ELEM_TYPE, moab::EXOII_SPHERE, ExoIIElementMBEntity, moab::Interface::get_connectivity(), get_element_type_from_num_verts(), has_mid_nodes(), HasMidNodes, MB_SUCCESS, MBEDGE, MBENTITYSET, MBMAXTYPE, MBQUAD, MBTRI, MBVERTEX, moab::Interface::tag_get_data(), moab::Interface::type_from_handle(), and moab::CN::VerticesPerEntity().

Referenced by get_element_type().

{
    // branch based on what kind of entity we're looking at
    EntityType handle_type = mdbImpl->type_from_handle( entity );

    if( handle_type == MBENTITYSET )
    {

        // it's a meshset - assume it's a block (check this?) and work off the midnodes tag

        // get the element type of the block; first, get the hasMidNodes tag, then convert to an exo
        // element type
        int has_mid_nodes[4];
        int dimension = -1;
        if( mdbImpl->tag_get_data( mid_nodes_tag, &entity, 1, has_mid_nodes ) != MB_SUCCESS )
        {
            // no mid nodes tag - look for indiv entity type, and if it was input, output the
            // default number of vertices
            if( MBMAXTYPE != indiv_entity_type )
            {
                // get dimension
                if( indiv_entity_type == MBQUAD || indiv_entity_type == MBTRI )
                    dimension = 3;  // want to ouput shells by default
                else if( indiv_entity_type == MBEDGE )
                    dimension = 2;
                else
                    dimension = CN::Dimension( indiv_entity_type );

                return get_element_type_from_num_verts( CN::VerticesPerEntity( indiv_entity_type ), indiv_entity_type,
                                                        dimension );
            }
            else
                return EXOII_MAX_ELEM_TYPE;
        }
        else
        {
            // block meshset had midnodes tag - look for geometric dimension one too
            mdbImpl->tag_get_data( geom_dimension_tag, &entity, 1, &dimension );
        }

        for( int i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
        {
            if( ( indiv_entity_type == MBMAXTYPE || indiv_entity_type == ExoIIElementMBEntity[i] ) &&
                has_mid_nodes[0] == HasMidNodes[i][0] && has_mid_nodes[1] == HasMidNodes[i][1] &&
                has_mid_nodes[2] == HasMidNodes[i][2] && has_mid_nodes[3] == HasMidNodes[i][3] &&
                ( -1 == dimension || ElementGeometricDimension[i] == dimension ) )
                return (ExoIIElementType)i;
        }

        return EXOII_MAX_ELEM_TYPE;
    }

    else if( handle_type == MBVERTEX )
        // only have one type of entity for vertices...
        return EXOII_SPHERE;

    else
    {
        std::vector< EntityHandle > tmp( 31 );

        mdbImpl->get_connectivity( &entity, 1, tmp, true );
        return get_element_type_from_num_verts( tmp.size(), indiv_entity_type );
        // it's a regular entity - look for a connectivity tag
    }

    // if we've gotten here, we failed
    // return EXOII_MAX_ELEM_TYPE;
}

Member Data Documentation

Initial value:
 {
    3,  
    3,  
    2, 2,
    2,  
    3, 3,
    3,  
    3, 3,
    3,  
    3, 3, 3, 3,
    3,  
    2, 2, 2, 2,
    2,  
    3, 3, 3, 3,
    3,  
    3, 3, 3, 3,
    3,  
    3, 3, 3, 3, 3,
    3,  
    3,  
    3,  
    3, 3, 3, 3,
    3,  
    3,  
    2,  
    3,  
    0   
}

geometric dimension of each element

Definition at line 117 of file ExoIIUtil.hpp.

Referenced by geometric_dimension(), get_element_type_from_num_verts(), and static_get_element_type().

const char * moab::ExoIIUtil::ElementTypeNames [static]
Initial value:
 { "SPHERE",  
                                              "SPRING",  
                                              "BAR",     
                                              "BAR2",    
                                              "BAR3",    
                                              "BEAM",    
                                              "BEAM2",   
                                              "BEAM3",   
                                              "TRUSS",   
                                              "TRUSS2",  
                                              "TRUSS3",  
                                              "TRI",     
                                              "TRI3",    
                                              "SHELL3",  
                                              "TRI6",     "TRI7",     "QUAD",      "QUAD4",     "QUAD5",     "QUAD8",
                                              "QUAD9",    "SHELL",    "SHELL4",    "SHELL5",    "SHELL8",    "SHELL9",
                                              "TETRA",    "TETRA4",   "TET4",      "TETRA8",    "TETRA10",   "TETRA14",
                                              "PYRAMID",  "PYRAMID5", "PYRAMID10", "PYRAMID13", "PYRAMID18", "WEDGE",
                                              "KNIFE",    "HEX",      "HEX8",      "HEX9",      "HEX20",     "HEX27",
                                              "HEXSHELL",
                                              "nsided",  
                                              "NFACED",  
                                              "UNKNOWN" }

names for all the element types that MB ExoII reader supports

Definition at line 107 of file ExoIIUtil.hpp.

Referenced by check_type(), element_type_name(), moab::WriteNCDF::initialize_exodus_file(), and static_element_name_to_type().

const int moab::ExoIIUtil::HasMidNodes [static]

HasMidNode[elem_type][dim] = 1 denotes that elem_type has mid-nodes on sub-entities of dimension dim

Definition at line 114 of file ExoIIUtil.hpp.

Referenced by check_type(), has_mid_nodes(), and static_get_element_type().

Definition at line 36 of file ExoIIUtil.hpp.

Referenced by get_element_type().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines