Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
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 More...
 
virtual ExoIIElementType get_element_type (EntityHandle entity, Tag mid_nodes_tag, Tag geom_dimension_tag, EntityType indiv_entity_type=MBMAXTYPE)
 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. More...
 
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 More...
 
virtual const char * element_type_name (ExoIIElementType type)
 
- Public Member Functions inherited from moab::ExoIIInterface
 ExoIIInterface ()
 
virtual ~ExoIIInterface ()
 

Static Public Member Functions

static ExoIIElementType static_element_name_to_type (const char *name)
 given the element name, return the type More...
 
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)
 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 More...
 
static ExoIIElementType get_element_type_from_num_verts (const int num_verts, const EntityType entity_type=MBMAXTYPE, const int dimension=3)
 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 More...
 

Static Public Attributes

static const EntityType ExoIIElementMBEntity []
 the MB entity type used for each element type More...
 
static const char * ElementTypeNames []
 names for all the element types that MB ExoII reader supports More...
 
static const int VerticesPerElement []
 number of vertices per element More...
 
static const int HasMidNodes [][4]
 HasMidNode[elem_type][dim] = 1 denotes that elem_type has mid-nodes on sub-entities of dimension dim. More...
 
static const int ElementGeometricDimension []
 geometric dimension of each element More...
 

Private Attributes

InterfacemMB
 

Additional Inherited Members

- Public Types inherited from moab::ExoIIInterface
enum  { MAX_STR_LENGTH = 33 , MAX_LINE_LENGTH = 80 }
 

Detailed Description

Definition at line 33 of file ExoIIUtil.hpp.

Constructor & Destructor Documentation

◆ ExoIIUtil()

moab::ExoIIUtil::ExoIIUtil ( Interface mdb)
inline

Definition at line 39 of file ExoIIUtil.hpp.

39 : mMB( mdb ) {}

◆ ~ExoIIUtil()

moab::ExoIIUtil::~ExoIIUtil ( )
inline

Definition at line 40 of file ExoIIUtil.hpp.

40 {}

Member Function Documentation

◆ element_name_to_type()

virtual ExoIIElementType moab::ExoIIUtil::element_name_to_type ( const char *  name)
inlinevirtual

given the element name, return the type

Implements moab::ExoIIInterface.

Definition at line 43 of file ExoIIUtil.hpp.

44  {
45  return static_element_name_to_type( name );
46  }

References static_element_name_to_type().

◆ element_type_name()

virtual const char* moab::ExoIIUtil::element_type_name ( ExoIIElementType  type)
inlinevirtual

Implements moab::ExoIIInterface.

Definition at line 77 of file ExoIIUtil.hpp.

78  {
79  return ElementTypeNames[type];
80  }

References ElementTypeNames.

◆ geometric_dimension()

virtual int moab::ExoIIUtil::geometric_dimension ( const ExoIIElementType  elem_type)
inlinevirtual

return the geometric dimension of the specified element type

Implements moab::ExoIIInterface.

Definition at line 72 of file ExoIIUtil.hpp.

73  {
74  return ElementGeometricDimension[elem_type];
75  }

References ElementGeometricDimension.

◆ get_element_type()

virtual ExoIIElementType moab::ExoIIUtil::get_element_type ( EntityHandle  entity,
Tag  mid_nodes_tag,
Tag  geom_dimension_tag,
EntityType  indiv_entity_type = MBMAXTYPE 
)
inlinevirtual

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.

55  {
56  return static_get_element_type( mMB, entity, mid_nodes_tag, geom_dimension_tag, indiv_entity_type );
57  }

References mMB, and static_get_element_type().

◆ get_element_type_from_num_verts()

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.

303 {
304  if( MBPOLYGON == entity_type && 2 == dimension ) return EXOII_POLYGON;
305  if( MBPOLYHEDRON == entity_type && 3 == dimension ) return EXOII_POLYHEDRON;
306  for( int i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
307  {
308  if( ( entity_type == MBMAXTYPE || entity_type == ExoIIElementMBEntity[i] ) &&
309  VerticesPerElement[i] == num_verts && ElementGeometricDimension[i] >= dimension )
310  return (ExoIIElementType)i;
311  }
312 
313  return EXOII_MAX_ELEM_TYPE;
314 }

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

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

◆ has_mid_nodes() [1/2]

virtual void moab::ExoIIUtil::has_mid_nodes ( ExoIIElementType  elem_type,
int *  array 
)
inlinevirtual

Implements moab::ExoIIInterface.

Definition at line 59 of file ExoIIUtil.hpp.

60  {
61  array[0] = HasMidNodes[elem_type][0];
62  array[1] = HasMidNodes[elem_type][1];
63  array[2] = HasMidNodes[elem_type][2];
64  array[3] = HasMidNodes[elem_type][3];
65  }

References HasMidNodes.

Referenced by static_get_element_type().

◆ has_mid_nodes() [2/2]

virtual int moab::ExoIIUtil::has_mid_nodes ( ExoIIElementType  elem_type,
int  dimension 
)
inlinevirtual

Implements moab::ExoIIInterface.

Definition at line 67 of file ExoIIUtil.hpp.

68  {
69  return HasMidNodes[elem_type][dimension];
70  }

References HasMidNodes.

◆ static_element_name_to_type()

ExoIIElementType moab::ExoIIUtil::static_element_name_to_type ( const char *  name)
static

given the element name, return the type

Definition at line 218 of file ExoIIUtil.cpp.

219 {
220  int i;
221  for( i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
222  if( strcmp( ElementTypeNames[i], name ) == 0 ) return (ExoIIElementType)i;
223 
224  return EXOII_MAX_ELEM_TYPE;
225 }

References ElementTypeNames, and moab::EXOII_MAX_ELEM_TYPE.

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

◆ static_get_element_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.

232 {
233  // branch based on what kind of entity we're looking at
234  EntityType handle_type = mdbImpl->type_from_handle( entity );
235 
236  if( handle_type == MBENTITYSET )
237  {
238 
239  // it's a meshset - assume it's a block (check this?) and work off the midnodes tag
240 
241  // get the element type of the block; first, get the hasMidNodes tag, then convert to an exo
242  // element type
243  int has_mid_nodes[4];
244  int dimension = -1;
245  if( mdbImpl->tag_get_data( mid_nodes_tag, &entity, 1, has_mid_nodes ) != MB_SUCCESS )
246  {
247  // no mid nodes tag - look for indiv entity type, and if it was input, output the
248  // default number of vertices
249  if( MBMAXTYPE != indiv_entity_type )
250  {
251  // get dimension
252  if( indiv_entity_type == MBQUAD || indiv_entity_type == MBTRI )
253  dimension = 3; // want to ouput shells by default
254  else if( indiv_entity_type == MBEDGE )
255  dimension = 2;
256  else
257  dimension = CN::Dimension( indiv_entity_type );
258 
259  return get_element_type_from_num_verts( CN::VerticesPerEntity( indiv_entity_type ), indiv_entity_type,
260  dimension );
261  }
262  else
263  return EXOII_MAX_ELEM_TYPE;
264  }
265  else
266  {
267  // block meshset had midnodes tag - look for geometric dimension one too
268  mdbImpl->tag_get_data( geom_dimension_tag, &entity, 1, &dimension );
269  }
270 
271  for( int i = 0; i < EXOII_MAX_ELEM_TYPE; i++ )
272  {
273  if( ( indiv_entity_type == MBMAXTYPE || indiv_entity_type == ExoIIElementMBEntity[i] ) &&
274  has_mid_nodes[0] == HasMidNodes[i][0] && has_mid_nodes[1] == HasMidNodes[i][1] &&
275  has_mid_nodes[2] == HasMidNodes[i][2] && has_mid_nodes[3] == HasMidNodes[i][3] &&
276  ( -1 == dimension || ElementGeometricDimension[i] == dimension ) )
277  return (ExoIIElementType)i;
278  }
279 
280  return EXOII_MAX_ELEM_TYPE;
281  }
282 
283  else if( handle_type == MBVERTEX )
284  // only have one type of entity for vertices...
285  return EXOII_SPHERE;
286 
287  else
288  {
289  std::vector< EntityHandle > tmp( 31 );
290 
291  mdbImpl->get_connectivity( &entity, 1, tmp, true );
292  return get_element_type_from_num_verts( tmp.size(), indiv_entity_type );
293  // it's a regular entity - look for a connectivity tag
294  }
295 
296  // if we've gotten here, we failed
297  // return EXOII_MAX_ELEM_TYPE;
298 }

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().

Member Data Documentation

◆ ElementGeometricDimension

const int moab::ExoIIUtil::ElementGeometricDimension
static
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().

◆ ElementTypeNames

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 element_type_name(), moab::WriteNCDF::initialize_exodus_file(), and static_element_name_to_type().

◆ ExoIIElementMBEntity

const EntityType moab::ExoIIUtil::ExoIIElementMBEntity
static

◆ HasMidNodes

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 has_mid_nodes(), and static_get_element_type().

◆ mMB

Interface* moab::ExoIIUtil::mMB
private

Definition at line 36 of file ExoIIUtil.hpp.

Referenced by get_element_type().

◆ VerticesPerElement


The documentation for this class was generated from the following files: