Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::Tqdcfr::BlockHeader Class Reference

#include <Tqdcfr.hpp>

+ Collaboration diagram for moab::Tqdcfr::BlockHeader:

Public Member Functions

void print ()
 
 BlockHeader ()
 

Static Public Member Functions

static ErrorCode read_info_header (const double data_version, const unsigned int model_offset, const FEModelHeader::ArrayInfo &info, Tqdcfr *instance, BlockHeader *&block_headers)
 

Public Attributes

unsigned int blockID
 
unsigned int blockElemType
 
unsigned int memCt
 
unsigned int memOffset
 
unsigned int memTypeCt
 
unsigned int attribOrder
 
unsigned int blockCol
 
unsigned int blockMixElemType
 
unsigned int blockPyrType
 
unsigned int blockMat
 
unsigned int blockLength
 
unsigned int blockDim
 
EntityHandle setHandle
 
EntityType blockEntityType
 
int hasMidNodes [4]
 

Detailed Description

Definition at line 154 of file Tqdcfr.hpp.

Constructor & Destructor Documentation

◆ BlockHeader()

moab::Tqdcfr::BlockHeader::BlockHeader ( )

Definition at line 2933 of file Tqdcfr.cpp.

2934  : blockID( 0 ), blockElemType( 0 ), memCt( 0 ), memOffset( 0 ), memTypeCt( 0 ), attribOrder( 0 ), blockCol( 0 ),
2935  blockMixElemType( 0 ), blockPyrType( 0 ), blockMat( 0 ), blockLength( 0 ), blockDim( 0 ), setHandle( 0 ),
2937 {
2938 }

Member Function Documentation

◆ print()

void moab::Tqdcfr::BlockHeader::print ( )

Definition at line 2940 of file Tqdcfr.cpp.

2941 {
2942  std::cout << "blockID = " << blockID << std::endl;
2943  std::cout << "blockElemType = " << blockElemType << std::endl;
2944  std::cout << "memCt = " << memCt << std::endl;
2945  std::cout << "memOffset = " << memOffset << std::endl;
2946  std::cout << "memTypeCt = " << memTypeCt << std::endl;
2947  std::cout << "attribOrder = " << attribOrder << std::endl;
2948  std::cout << "blockCol = " << blockCol << std::endl;
2949  std::cout << "blockMixElemType = " << blockMixElemType << std::endl;
2950  std::cout << "blockPyrType = " << blockPyrType << std::endl;
2951  std::cout << "blockMat = " << blockMat << std::endl;
2952  std::cout << "blockLength = " << blockLength << std::endl;
2953  std::cout << "blockDim = " << blockDim << std::endl;
2954  std::cout << "setHandle = " << setHandle << std::endl;
2955  std::cout << "blockEntityType = " << blockEntityType << std::endl;
2956 }

◆ read_info_header()

ErrorCode moab::Tqdcfr::BlockHeader::read_info_header ( const double  data_version,
const unsigned int  model_offset,
const FEModelHeader::ArrayInfo info,
Tqdcfr instance,
Tqdcfr::BlockHeader *&  block_headers 
)
static

Definition at line 2000 of file Tqdcfr.cpp.

2005 {
2006  block_headers = new BlockHeader[info.numEntities];
2007  instance->FSEEK( model_offset + info.tableOffset );
2008  ErrorCode result;
2009 
2010  if( 0 == instance->categoryTag )
2011  {
2012  static const char val[CATEGORY_TAG_SIZE] = { 0 };
2013  result = instance->mdbImpl->tag_get_handle( CATEGORY_TAG_NAME, CATEGORY_TAG_SIZE, MB_TYPE_OPAQUE,
2014  instance->categoryTag, MB_TAG_SPARSE | MB_TAG_CREAT, val );
2015  if( MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result ) return result;
2016  }
2017 
2018  for( unsigned int i = 0; i < info.numEntities; i++ )
2019  {
2020  // Create an entity set for this entity
2021  result = instance->create_set( block_headers[i].setHandle );
2022  if( MB_SUCCESS != result ) return result;
2023  static const char material_category[CATEGORY_TAG_SIZE] = "Material Set\0";
2024 
2025  instance->FREADI( 12 );
2026  block_headers[i].blockID = instance->uint_buf[0];
2027  block_headers[i].blockElemType = instance->uint_buf[1];
2028  block_headers[i].memCt = instance->uint_buf[2];
2029  block_headers[i].memOffset = instance->uint_buf[3];
2030  block_headers[i].memTypeCt = instance->uint_buf[4];
2031  block_headers[i].attribOrder = instance->uint_buf[5]; // Attrib order
2032  block_headers[i].blockCol = instance->uint_buf[6];
2033  block_headers[i].blockMixElemType = instance->uint_buf[7]; // Mixed elem type
2034  block_headers[i].blockPyrType = instance->uint_buf[8];
2035  block_headers[i].blockMat = instance->uint_buf[9];
2036  block_headers[i].blockLength = instance->uint_buf[10];
2037  block_headers[i].blockDim = instance->uint_buf[11];
2038 
2039  Tag bhTag_header;
2040  {
2041  std::vector< int > def_uint_zero( 3, 0 );
2042  result = instance->mdbImpl->tag_get_handle( BLOCK_HEADER, 3 * sizeof( unsigned int ), MB_TYPE_INTEGER,
2043  bhTag_header, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES,
2044  &def_uint_zero[0] );
2045  if( MB_SUCCESS != result ) return result;
2046  int block_header_data[] = { static_cast< int >( block_headers[i].blockCol ),
2047  static_cast< int >( block_headers[i].blockMat ),
2048  static_cast< int >( block_headers[i].blockDim ) };
2049  result =
2050  instance->mdbImpl->tag_set_data( bhTag_header, &( block_headers[i].setHandle ), 1, block_header_data );
2051  }
2052 
2053  if( MB_SUCCESS != result ) return result;
2054 
2055  // Adjust element type for data version; older element types didn't include
2056  // 4 new trishell element types
2057  if( data_version <= 1.0 && block_headers[i].blockElemType >= 15 ) block_headers[i].blockElemType += 4;
2058 
2059  if( block_headers[i].blockElemType >= (unsigned)cub_elem_num_verts_len )
2060  {
2061  // Block element type unassigned, will have to infer from verts/element; make sure it's
2062  // the expected value of 52
2063  if( ( 14 == major && 2 < minor ) || 15 <= major )
2064  {
2065  if( 55 != block_headers[i].blockElemType )
2066  MB_SET_ERR( MB_FAILURE, "Invalid block element type: " << block_headers[i].blockElemType );
2067  }
2068  else
2069  {
2070  if( 52 != block_headers[i].blockElemType )
2071  MB_SET_ERR( MB_FAILURE, "Invalid block element type: " << block_headers[i].blockElemType );
2072  }
2073  }
2074 
2075  // Set the material set tag and id tag both to id
2076  result = instance->mdbImpl->tag_set_data( instance->blockTag, &( block_headers[i].setHandle ), 1,
2077  &( block_headers[i].blockID ) );
2078  if( MB_SUCCESS != result ) return result;
2079  result = instance->mdbImpl->tag_set_data( instance->globalIdTag, &( block_headers[i].setHandle ), 1,
2080  &( block_headers[i].blockID ) );
2081  if( MB_SUCCESS != result ) return result;
2082  result = instance->mdbImpl->tag_set_data( instance->categoryTag, &( block_headers[i].setHandle ), 1,
2083  material_category );
2084  if( MB_SUCCESS != result ) return result;
2085 
2086  // If this block is empty, continue
2087  if( !block_headers[i].memCt ) continue;
2088 
2089  // Check the number of vertices in the element type, and set the has mid nodes tag
2090  // accordingly; if element type wasn't set, they're unlikely to have mid nodes
2091  // 52 is for CUBIT versions below 14.1, 55 for CUBIT version 14.9 and above
2092  if( 52 != block_headers[i].blockElemType && 55 != block_headers[i].blockElemType )
2093  {
2094  int num_verts = cub_elem_num_verts[block_headers[i].blockElemType];
2095  block_headers[i].blockEntityType = block_type_to_mb_type[block_headers[i].blockElemType];
2096  if( ( block_headers[i].blockEntityType < MBMAXTYPE ) &&
2097  ( num_verts != CN::VerticesPerEntity( block_headers[i].blockEntityType ) ) )
2098  {
2099  // Not a linear element; try to find hasMidNodes values
2100  for( int j = 0; j < 4; j++ )
2101  block_headers[i].hasMidNodes[j] = 0;
2102  if( 0 == instance->hasMidNodesTag )
2103  {
2104  result = instance->mdbImpl->tag_get_handle( HAS_MID_NODES_TAG_NAME, 4, MB_TYPE_INTEGER,
2105  instance->hasMidNodesTag, MB_TAG_SPARSE | MB_TAG_CREAT,
2106  block_headers[i].hasMidNodes );
2107  if( MB_SUCCESS != result ) return result;
2108  }
2109 
2110  CN::HasMidNodes( block_headers[i].blockEntityType, num_verts, block_headers[i].hasMidNodes );
2111 
2112  // Now set the tag on this set
2113  result = instance->mdbImpl->tag_set_data( instance->hasMidNodesTag, &block_headers[i].setHandle, 1,
2114  block_headers[i].hasMidNodes );
2115  if( MB_SUCCESS != result ) return result;
2116  }
2117  }
2118  }
2119 
2120  return MB_SUCCESS;
2121 }

References attribOrder, BLOCK_HEADER, moab::Tqdcfr::block_type_to_mb_type, blockCol, blockDim, blockElemType, blockID, blockLength, blockMat, blockMixElemType, blockPyrType, moab::Tqdcfr::blockTag, CATEGORY_TAG_NAME, CATEGORY_TAG_SIZE, moab::Tqdcfr::categoryTag, moab::Tqdcfr::create_set(), moab::Tqdcfr::cub_elem_num_verts, moab::Tqdcfr::cub_elem_num_verts_len, ErrorCode, moab::Tqdcfr::FREADI(), moab::Tqdcfr::FSEEK(), moab::Tqdcfr::globalIdTag, HAS_MID_NODES_TAG_NAME, moab::CN::HasMidNodes(), moab::Tqdcfr::hasMidNodesTag, moab::major, MB_ALREADY_ALLOCATED, MB_SET_ERR, MB_SUCCESS, MB_TAG_BYTES, MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, MBMAXTYPE, moab::Tqdcfr::mdbImpl, memCt, memOffset, memTypeCt, moab::minor, moab::Tqdcfr::FEModelHeader::ArrayInfo::numEntities, setHandle, moab::Tqdcfr::FEModelHeader::ArrayInfo::tableOffset, moab::Interface::tag_get_handle(), moab::Interface::tag_set_data(), moab::Tqdcfr::uint_buf, and moab::CN::VerticesPerEntity().

Referenced by moab::Tqdcfr::ModelEntry::read_header_info().

Member Data Documentation

◆ attribOrder

unsigned int moab::Tqdcfr::BlockHeader::attribOrder

Definition at line 157 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().

◆ blockCol

unsigned int moab::Tqdcfr::BlockHeader::blockCol

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockDim

unsigned int moab::Tqdcfr::BlockHeader::blockDim

Definition at line 158 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockElemType

unsigned int moab::Tqdcfr::BlockHeader::blockElemType

Definition at line 157 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().

◆ blockEntityType

EntityType moab::Tqdcfr::BlockHeader::blockEntityType

Definition at line 162 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block().

◆ blockID

unsigned int moab::Tqdcfr::BlockHeader::blockID

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockLength

unsigned int moab::Tqdcfr::BlockHeader::blockLength

Definition at line 158 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockMat

unsigned int moab::Tqdcfr::BlockHeader::blockMat

Definition at line 158 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockMixElemType

unsigned int moab::Tqdcfr::BlockHeader::blockMixElemType

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ blockPyrType

unsigned int moab::Tqdcfr::BlockHeader::blockPyrType

Definition at line 158 of file Tqdcfr.hpp.

Referenced by read_info_header().

◆ hasMidNodes

int moab::Tqdcfr::BlockHeader::hasMidNodes[4]

Definition at line 164 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block().

◆ memCt

unsigned int moab::Tqdcfr::BlockHeader::memCt

Definition at line 157 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().

◆ memOffset

unsigned int moab::Tqdcfr::BlockHeader::memOffset

Definition at line 157 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().

◆ memTypeCt

unsigned int moab::Tqdcfr::BlockHeader::memTypeCt

Definition at line 157 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().

◆ setHandle

EntityHandle moab::Tqdcfr::BlockHeader::setHandle

Definition at line 160 of file Tqdcfr.hpp.

Referenced by moab::Tqdcfr::read_block(), and read_info_header().


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