moab
moab::Tqdcfr::BlockHeader Class Reference

#include <Tqdcfr.hpp>

List of all members.

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 158 of file Tqdcfr.hpp.


Constructor & Destructor Documentation


Member Function Documentation

Definition at line 2789 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 1890 of file Tqdcfr.cpp.

{
  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
      assert(52 == block_headers[i].blockElemType);
      
//      std::cerr << "Invalid block element type: " << block_headers[i].blockElemType << std::endl;
//      instance->readUtilIface->report_error( "Invalid block element type: %d", block_headers[i].blockElemType );
//      return MB_FAILURE;
    }

      // 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
    if (52 != 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 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 166 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 168 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.

Definition at line 161 of file Tqdcfr.hpp.


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