moab
moab::ExoIIUtil Class Reference

#include <ExoIIUtil.hpp>

Inheritance diagram for moab::ExoIIUtil:
moab::ExoIIInterface

List of all members.

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.

  {
    return static_element_name_to_type(name);
  }
virtual const char* moab::ExoIIUtil::element_type_name ( ExoIIElementType  type) [inline, virtual]

Implements moab::ExoIIInterface.

Definition at line 77 of file ExoIIUtil.hpp.

  {
    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.

  {
    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.

  {
    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 355 of file ExoIIUtil.cpp.

{
  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.

  {
    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.

  {
    return HasMidNodes[elem_type][dimension];
  }

given the element name, return the type

Definition at line 274 of file ExoIIUtil.cpp.

{
  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 284 of file ExoIIUtil.cpp.

{
    // 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

geometric dimension of each element

Definition at line 118 of file ExoIIUtil.hpp.

const char * moab::ExoIIUtil::ElementTypeNames [static]

names for all the element types that MB ExoII reader supports

Definition at line 108 of file ExoIIUtil.hpp.

const EntityType moab::ExoIIUtil::ExoIIElementMBEntity [static]

the MB entity type used for each element type

Definition at line 105 of file ExoIIUtil.hpp.

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 115 of file ExoIIUtil.hpp.

Definition at line 36 of file ExoIIUtil.hpp.

number of vertices per element

Definition at line 111 of file ExoIIUtil.hpp.


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