MOAB: Mesh Oriented datABase  (version 5.4.1)
CubitWriter Class Reference
+ Inheritance diagram for CubitWriter:
+ Collaboration diagram for CubitWriter:

Public Member Functions

 CubitWriter (FILE *file_ptr, OrientedBoxTreeTool *tool_ptr)
ErrorCode visit (EntityHandle node, int depth, bool &descend)
 Visit a node in the tree during a traversal.
ErrorCode leaf (EntityHandle)
 Process a leaf node during tree traversal.

Private Attributes

FILE * file
OrientedBoxTreeTooltool

Detailed Description

Definition at line 631 of file obb_test.cpp.


Constructor & Destructor Documentation

CubitWriter::CubitWriter ( FILE *  file_ptr,
OrientedBoxTreeTool tool_ptr 
) [inline]

Definition at line 634 of file obb_test.cpp.

: file( file_ptr ), tool( tool_ptr ) {}

Member Function Documentation

ErrorCode CubitWriter::leaf ( EntityHandle  node) [inline, virtual]

Process a leaf node during tree traversal.

Implements moab::OrientedBoxTreeTool::Op.

Definition at line 637 of file obb_test.cpp.

References MB_SUCCESS.

    {
        return MB_SUCCESS;
    }
ErrorCode CubitWriter::visit ( EntityHandle  node,
int  depth,
bool &  descend 
) [virtual]

Visit a node in the tree during a traversal.

This method is called for each node in the tree visited during a pre-order traversal.

Parameters:
nodeThe EntityHandle for the entity set for the tree node.
depthThe current depth in the tree.
descendOutput: if false, traversal will skip children of the current node, or if the current node is a leaf, the 'leaf' method will not be called.

Implements moab::OrientedBoxTreeTool::Op.

Definition at line 647 of file obb_test.cpp.

References moab::OrientedBox::axis(), box(), moab::OrientedBox::center, ErrorCode, moab::OrientedBox::length, and MB_SUCCESS.

{
    descend = true;
    OrientedBox box;
    ErrorCode rval = tool->box( node, box );
    if( rval != MB_SUCCESS ) return rval;

    double sign[] = { -1, 1 };
    for( int i = 0; i < 2; ++i )
        for( int j = 0; j < 2; ++j )
            for( int k = 0; k < 2; ++k )
            {
#if MB_ORIENTED_BOX_UNIT_VECTORS
                CartVect corner = box.center + box.length[0] * sign[i] * box.axis( 0 ) +
                                  box.length[1] * sign[j] * box.axis( 1 ) + box.length[2] * sign[k] * box.axis( 2 );
#else
                CartVect corner =
                    box.center + sign[i] * box.axis( 0 ) + sign[j] * box.axis( 1 ) + sign[k] * box.axis( 2 );
#endif
                fprintf( file, "create vertex %f %f %f\n", corner[0], corner[1], corner[2] );
            }
    fprintf( file, "#{i=Id(\"vertex\")-7}\n" );
    fprintf( file, "create surface vertex {i  } {i+1} {i+3} {i+2}\n" );
    fprintf( file, "create surface vertex {i+4} {i+5} {i+7} {i+6}\n" );
    fprintf( file, "create surface vertex {i+1} {i+0} {i+4} {i+5}\n" );
    fprintf( file, "create surface vertex {i+3} {i+2} {i+6} {i+7}\n" );
    fprintf( file, "create surface vertex {i+2} {i+0} {i+4} {i+6}\n" );
    fprintf( file, "create surface vertex {i+3} {i+1} {i+5} {i+7}\n" );
    fprintf( file, "delete vertex {i}-{i+7}\n" );
    fprintf( file, "#{s=Id(\"surface\")-5}\n" );
    fprintf( file, "create volume surface {s} {s+1} {s+2} {s+3} {s+4} {s+5} noheal\n" );
    int id = tool->get_moab_instance()->id_from_handle( node );
    fprintf( file, "volume {Id(\"volume\")} name \"cell%d\"\n", id );

    return MB_SUCCESS;
}

Member Data Documentation

FILE* CubitWriter::file [private]

Definition at line 643 of file obb_test.cpp.

Definition at line 644 of file obb_test.cpp.

List of all members.


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