Mesh Oriented datABase  (version 5.6.0)
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 2939 of file Tqdcfr.cpp.

2940  : blockID( 0 ), blockElemType( 0 ), memCt( 0 ), memOffset( 0 ), memTypeCt( 0 ), attribOrder( 0 ), blockCol( 0 ),
2941  blockMixElemType( 0 ), blockPyrType( 0 ), blockMat( 0 ), blockLength( 0 ), blockDim( 0 ), setHandle( 0 ),
2943 {
2944 }

Member Function Documentation

◆ print()

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

Definition at line 2946 of file Tqdcfr.cpp.

2947 {
2948  std::cout << "blockID = " << blockID << std::endl;
2949  std::cout << "blockElemType = " << blockElemType << std::endl;
2950  std::cout << "memCt = " << memCt << std::endl;
2951  std::cout << "memOffset = " << memOffset << std::endl;
2952  std::cout << "memTypeCt = " << memTypeCt << std::endl;
2953  std::cout << "attribOrder = " << attribOrder << std::endl;
2954  std::cout << "blockCol = " << blockCol << std::endl;
2955  std::cout << "blockMixElemType = " << blockMixElemType << std::endl;
2956  std::cout << "blockPyrType = " << blockPyrType << std::endl;
2957  std::cout << "blockMat = " << blockMat << std::endl;
2958  std::cout << "blockLength = " << blockLength << std::endl;
2959  std::cout << "blockDim = " << blockDim << std::endl;
2960  std::cout << "setHandle = " << setHandle << std::endl;
2961  std::cout << "blockEntityType = " << blockEntityType << std::endl;
2962 }

◆ 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 2006 of file Tqdcfr.cpp.

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

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: