MOAB: Mesh Oriented datABase  (version 5.5.0)
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. More...
 
ErrorCode leaf (EntityHandle)
 Process a leaf node during tree traversal. More...
 
- Public Member Functions inherited from moab::OrientedBoxTreeTool::Op
virtual ~Op ()
 

Private Attributes

FILE * file
 
OrientedBoxTreeTooltool
 

Detailed Description

Definition at line 631 of file obb_test.cpp.

Constructor & Destructor Documentation

◆ CubitWriter()

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

Definition at line 634 of file obb_test.cpp.

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

Member Function Documentation

◆ leaf()

ErrorCode CubitWriter::leaf ( EntityHandle  node)
inlinevirtual

Process a leaf node during tree traversal.

Implements moab::OrientedBoxTreeTool::Op.

Definition at line 637 of file obb_test.cpp.

638  {
639  return MB_SUCCESS;
640  }

References MB_SUCCESS.

◆ visit()

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.

648 {
649  descend = true;
651  ErrorCode rval = tool->box( node, box );
652  if( rval != MB_SUCCESS ) return rval;
653 
654  double sign[] = { -1, 1 };
655  for( int i = 0; i < 2; ++i )
656  for( int j = 0; j < 2; ++j )
657  for( int k = 0; k < 2; ++k )
658  {
659 #if MB_ORIENTED_BOX_UNIT_VECTORS
660  CartVect corner = box.center + box.length[0] * sign[i] * box.axis( 0 ) +
661  box.length[1] * sign[j] * box.axis( 1 ) + box.length[2] * sign[k] * box.axis( 2 );
662 #else
663  CartVect corner =
664  box.center + sign[i] * box.axis( 0 ) + sign[j] * box.axis( 1 ) + sign[k] * box.axis( 2 );
665 #endif
666  fprintf( file, "create vertex %f %f %f\n", corner[0], corner[1], corner[2] );
667  }
668  fprintf( file, "#{i=Id(\"vertex\")-7}\n" );
669  fprintf( file, "create surface vertex {i } {i+1} {i+3} {i+2}\n" );
670  fprintf( file, "create surface vertex {i+4} {i+5} {i+7} {i+6}\n" );
671  fprintf( file, "create surface vertex {i+1} {i+0} {i+4} {i+5}\n" );
672  fprintf( file, "create surface vertex {i+3} {i+2} {i+6} {i+7}\n" );
673  fprintf( file, "create surface vertex {i+2} {i+0} {i+4} {i+6}\n" );
674  fprintf( file, "create surface vertex {i+3} {i+1} {i+5} {i+7}\n" );
675  fprintf( file, "delete vertex {i}-{i+7}\n" );
676  fprintf( file, "#{s=Id(\"surface\")-5}\n" );
677  fprintf( file, "create volume surface {s} {s+1} {s+2} {s+3} {s+4} {s+5} noheal\n" );
678  int id = tool->get_moab_instance()->id_from_handle( node );
679  fprintf( file, "volume {Id(\"volume\")} name \"cell%d\"\n", id );
680 
681  return MB_SUCCESS;
682 }

References box(), ErrorCode, and MB_SUCCESS.

Member Data Documentation

◆ file

FILE* CubitWriter::file
private

Definition at line 643 of file obb_test.cpp.

◆ tool

OrientedBoxTreeTool* CubitWriter::tool
private

Definition at line 644 of file obb_test.cpp.


The documentation for this class was generated from the following file: