MOAB: Mesh Oriented datABase  (version 5.3.0)
MBMesquite::VtkTypeInfo Struct Reference

#include <VtkTypeInfo.hpp>

Public Member Functions

void mesquiteToVtkOrder (std::vector< size_t > &connectivity_list) const

Static Public Member Functions

static const VtkTypeInfofind_type (unsigned vtk_type, MsqError &err)
static const VtkTypeInfofind_type (EntityTopology msq_type, unsigned num_nodes, MsqError &err)

Public Attributes

const char * name
unsigned vtkType
 The VTK type number.
EntityTopology msqType
 The Mesquite element topology for the VTK type.
unsigned numNodes
 The number of nodes in the VTK type.
const unsigned * vtkConnOrder

Detailed Description

A struct describing a mapping between a Mesquite type/node_count combination an a VTK element type.

Definition at line 41 of file VtkTypeInfo.hpp.


Member Function Documentation

const VtkTypeInfo * MBMesquite::VtkTypeInfo::find_type ( unsigned  vtk_type,
MsqError err 
) [static]

Get VtkTypeInfo from VTK type number

Definition at line 108 of file VtkTypeInfo.cpp.

References MBMesquite::MsqError::INVALID_ARG, MSQ_SETERR, MBMesquite::typeInfoList, and MBMesquite::typeInfoListLen.

Referenced by MBMesquite::MeshImpl::vtk_read_unstructured_grid(), and MBMesquite::MeshImpl::write_vtk().

{
    if( vtk_type >= typeInfoListLen )
    {
        MSQ_SETERR( err )( "Type out of bounds", MsqError::INVALID_ARG );
        return 0;
    }

    return &typeInfoList[vtk_type];
}
const VtkTypeInfo * MBMesquite::VtkTypeInfo::find_type ( EntityTopology  msq_type,
unsigned  num_nodes,
MsqError err 
) [static]

Get VtkTypeInfo from Mesquite type and number of nodes

Definition at line 119 of file VtkTypeInfo.cpp.

References MSQ_SETERR, numNodes, MBMesquite::POLYGON, MBMesquite::reverseIndexList, MBMesquite::typeInfoList, and MBMesquite::MsqError::UNSUPPORTED_ELEMENT.

{
    if( typeInfoList[reverseIndexList[msq_type][0]].numNodes == num_nodes )
        return &typeInfoList[reverseIndexList[msq_type][0]];
    else if( typeInfoList[reverseIndexList[msq_type][1]].numNodes == num_nodes )
        return &typeInfoList[reverseIndexList[msq_type][1]];
    else if( typeInfoList[reverseIndexList[msq_type][2]].numNodes == num_nodes )
        return &typeInfoList[reverseIndexList[msq_type][2]];

    if( msq_type == POLYGON && num_nodes >= 3 && num_nodes <= 12 ) return &typeInfoList[reverseIndexList[msq_type][0]];

    MSQ_SETERR( err )
    ( MsqError::UNSUPPORTED_ELEMENT, "VTK file does not support element type %d with %u nodes", (int)msq_type,
      num_nodes );
    return 0;
}
void MBMesquite::VtkTypeInfo::mesquiteToVtkOrder ( std::vector< size_t > &  connectivity_list) const

Reorder element connectivty list for writing to a VTK file

If the VTK node ordering is the same as Mesquite's node ordering for the type, the input list is not changed. If the canonical ordering for the elment differs, the passed list will be reordered for writing to a VTK file.

Definition at line 136 of file VtkTypeInfo.cpp.

References numNodes, swap(), and vtkConnOrder.

Referenced by MBMesquite::MeshImpl::write_vtk(), and MBMesquite::MeshWriter::write_vtk().

{
    assert( conn_list.size() == numNodes );
    if( vtkConnOrder )
    {
        std::vector< size_t > temp_list( numNodes );
        std::swap( temp_list, conn_list );
        for( size_t i = 0; i < numNodes; ++i )
            conn_list[vtkConnOrder[i]] = temp_list[i];
    }
}

Member Data Documentation

The number of nodes in the VTK type.

Definition at line 48 of file VtkTypeInfo.hpp.

Referenced by find_type(), mesquiteToVtkOrder(), and MBMesquite::MeshImpl::vtk_read_unstructured_grid().

NULL if VTK node ordering is the same as Mesquite's internal ordering. If non-null, an array of length VtkTypeInfo::numNodes, indexed with the Mesquite connectivity offset and containing the corresponding VTK connectivity offset

Definition at line 49 of file VtkTypeInfo.hpp.

Referenced by mesquiteToVtkOrder(), and MBMesquite::MeshImpl::vtk_read_unstructured_grid().

The VTK type number.

Definition at line 46 of file VtkTypeInfo.hpp.

Referenced by MBMesquite::MeshImpl::write_vtk(), and MBMesquite::MeshWriter::write_vtk().

List of all members.


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