MOAB: Mesh Oriented datABase  (version 5.4.1)
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

Definition at line 2933 of file Tqdcfr.cpp.

    : blockID( 0 ), blockElemType( 0 ), memCt( 0 ), memOffset( 0 ), memTypeCt( 0 ), attribOrder( 0 ), blockCol( 0 ),
      blockMixElemType( 0 ), blockPyrType( 0 ), blockMat( 0 ), blockLength( 0 ), blockDim( 0 ), setHandle( 0 ),
      blockEntityType( MBMAXTYPE )
{
}

Member Function Documentation

Definition at line 2940 of file Tqdcfr.cpp.

{
    std::cout << "blockID = " << blockID << std::endl;
    std::cout << "blockElemType = " << blockElemType << std::endl;
    std::cout << "memCt = " << memCt << std::endl;
    std::cout << "memOffset = " << memOffset << std::endl;
    std::cout << "memTypeCt = " << memTypeCt << std::endl;
    std::cout << "attribOrder = " << attribOrder << std::endl;
    std::cout << "blockCol = " << blockCol << std::endl;
    std::cout << "blockMixElemType = " << blockMixElemType << std::endl;
    std::cout << "blockPyrType = " << blockPyrType << std::endl;
    std::cout << "blockMat = " << blockMat << std::endl;
    std::cout << "blockLength = " << blockLength << std::endl;
    std::cout << "blockDim = " << blockDim << std::endl;
    std::cout << "setHandle = " << setHandle << std::endl;
    std::cout << "blockEntityType = " << blockEntityType << std::endl;
}
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.

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

{
    block_headers = new BlockHeader[info.numEntities];
    instance->FSEEK( model_offset + info.tableOffset );
    ErrorCode result;

    if( 0 == instance->categoryTag )
    {
        static const char val[CATEGORY_TAG_SIZE] = { 0 };
        result = instance->mdbImpl->tag_get_handle( CATEGORY_TAG_NAME, CATEGORY_TAG_SIZE, MB_TYPE_OPAQUE,
                                                    instance->categoryTag, MB_TAG_SPARSE | MB_TAG_CREAT, val );
        if( MB_SUCCESS != result && MB_ALREADY_ALLOCATED != result ) return result;
    }

    for( unsigned int i = 0; i < info.numEntities; i++ )
    {
        // Create an entity set for this entity
        result = instance->create_set( block_headers[i].setHandle );
        if( MB_SUCCESS != result ) return result;
        static const char material_category[CATEGORY_TAG_SIZE] = "Material Set\0";

        instance->FREADI( 12 );
        block_headers[i].blockID          = instance->uint_buf[0];
        block_headers[i].blockElemType    = instance->uint_buf[1];
        block_headers[i].memCt            = instance->uint_buf[2];
        block_headers[i].memOffset        = instance->uint_buf[3];
        block_headers[i].memTypeCt        = instance->uint_buf[4];
        block_headers[i].attribOrder      = instance->uint_buf[5];  // Attrib order
        block_headers[i].blockCol         = instance->uint_buf[6];
        block_headers[i].blockMixElemType = instance->uint_buf[7];  // Mixed elem type
        block_headers[i].blockPyrType     = instance->uint_buf[8];
        block_headers[i].blockMat         = instance->uint_buf[9];
        block_headers[i].blockLength      = instance->uint_buf[10];
        block_headers[i].blockDim         = instance->uint_buf[11];

        Tag bhTag_header;
        {
            std::vector< int > def_uint_zero( 3, 0 );
            result = instance->mdbImpl->tag_get_handle( BLOCK_HEADER, 3 * sizeof( unsigned int ), MB_TYPE_INTEGER,
                                                        bhTag_header, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES,
                                                        &def_uint_zero[0] );
            if( MB_SUCCESS != result ) return result;
            int block_header_data[] = { static_cast< int >( block_headers[i].blockCol ),
                                        static_cast< int >( block_headers[i].blockMat ),
                                        static_cast< int >( block_headers[i].blockDim ) };
            result =
                instance->mdbImpl->tag_set_data( bhTag_header, &( block_headers[i].setHandle ), 1, block_header_data );
        }

        if( MB_SUCCESS != result ) return result;

        // Adjust element type for data version; older element types didn't include
        // 4 new trishell element types
        if( data_version <= 1.0 && block_headers[i].blockElemType >= 15 ) block_headers[i].blockElemType += 4;

        if( block_headers[i].blockElemType >= (unsigned)cub_elem_num_verts_len )
        {
            // Block element type unassigned, will have to infer from verts/element; make sure it's
            // the expected value of 52
            if( ( 14 == major && 2 < minor ) || 15 <= major )
            {
                if( 55 != block_headers[i].blockElemType )
                    MB_SET_ERR( MB_FAILURE, "Invalid block element type: " << block_headers[i].blockElemType );
            }
            else
            {
                if( 52 != block_headers[i].blockElemType )
                    MB_SET_ERR( MB_FAILURE, "Invalid block element type: " << block_headers[i].blockElemType );
            }
        }

        // Set the material set tag and id tag both to id
        result = instance->mdbImpl->tag_set_data( instance->blockTag, &( block_headers[i].setHandle ), 1,
                                                  &( block_headers[i].blockID ) );
        if( MB_SUCCESS != result ) return result;
        result = instance->mdbImpl->tag_set_data( instance->globalIdTag, &( block_headers[i].setHandle ), 1,
                                                  &( block_headers[i].blockID ) );
        if( MB_SUCCESS != result ) return result;
        result = instance->mdbImpl->tag_set_data( instance->categoryTag, &( block_headers[i].setHandle ), 1,
                                                  material_category );
        if( MB_SUCCESS != result ) return result;

        // If this block is empty, continue
        if( !block_headers[i].memCt ) continue;

        // Check the number of vertices in the element type, and set the has mid nodes tag
        // accordingly; if element type wasn't set, they're unlikely to have mid nodes
        // 52 is for CUBIT versions below 14.1, 55 for CUBIT version 14.9 and above
        if( 52 != block_headers[i].blockElemType && 55 != block_headers[i].blockElemType )
        {
            int num_verts                    = cub_elem_num_verts[block_headers[i].blockElemType];
            block_headers[i].blockEntityType = block_type_to_mb_type[block_headers[i].blockElemType];
            if( ( block_headers[i].blockEntityType < MBMAXTYPE ) &&
                ( num_verts != CN::VerticesPerEntity( block_headers[i].blockEntityType ) ) )
            {
                // Not a linear element; try to find hasMidNodes values
                for( int j = 0; j < 4; j++ )
                    block_headers[i].hasMidNodes[j] = 0;
                if( 0 == instance->hasMidNodesTag )
                {
                    result = instance->mdbImpl->tag_get_handle( HAS_MID_NODES_TAG_NAME, 4, MB_TYPE_INTEGER,
                                                                instance->hasMidNodesTag, MB_TAG_SPARSE | MB_TAG_CREAT,
                                                                block_headers[i].hasMidNodes );
                    if( MB_SUCCESS != result ) return result;
                }

                CN::HasMidNodes( block_headers[i].blockEntityType, num_verts, block_headers[i].hasMidNodes );

                // Now set the tag on this set
                result = instance->mdbImpl->tag_set_data( instance->hasMidNodesTag, &block_headers[i].setHandle, 1,
                                                          block_headers[i].hasMidNodes );
                if( MB_SUCCESS != result ) return result;
            }
        }
    }

    return MB_SUCCESS;
}

Member Data Documentation

Definition at line 157 of file Tqdcfr.hpp.

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

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

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

Definition at line 162 of file Tqdcfr.hpp.

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

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 157 of file Tqdcfr.hpp.

Referenced by read_info_header().

Definition at line 164 of file Tqdcfr.hpp.

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

Definition at line 157 of file Tqdcfr.hpp.

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

Definition at line 157 of file Tqdcfr.hpp.

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

Definition at line 157 of file Tqdcfr.hpp.

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

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