MOAB: Mesh Oriented datABase  (version 5.4.1)
smoab::detail::LoadGeometry Class Reference

#include <LoadGeometry.h>

+ Collaboration diagram for smoab::detail::LoadGeometry:

Public Member Functions

 LoadGeometry (const smoab::Range &cells, int topologyDim, const smoab::Interface &interface)
const smoab::RangemoabPoints () const
template<typename vtkDataSetType >
void fill (vtkDataSetType *dataSet)

Private Member Functions

void addCoordinates (vtkPointSet *grid)
template<typename vtkDataSetType >
void addGridsTopology (vtkDataSetType *grid, vtkIdType numCells, vtkIdType numConnectivity) const

Private Attributes

int TopologyDim
smoab::detail::MixedCellConnectivity MixConn
smoab::Range Points

Detailed Description

Definition at line 73 of file LoadGeometry.h.

Constructor & Destructor Documentation

smoab::detail::LoadGeometry::LoadGeometry ( const smoab::Range cells,
int  topologyDim,
const smoab::Interface interface 
) [inline]

Definition at line 83 of file LoadGeometry.h.

            : Interface( interface.Moab ), TopologyDim( topologyDim ), MixConn( cells, interface.Moab ), Points()

Member Function Documentation

void smoab::detail::LoadGeometry::addCoordinates ( vtkPointSet *  grid) [inline, private]

Definition at line 109 of file LoadGeometry.h.

References MixConn, smoab::detail::MixedCellConnectivity::moabPoints(), Points, and moab::Range::size().

Referenced by fill().

            //this is sorta of hackish as moabPoints is only valid
            //after compactIds has been called
            this->MixConn.moabPoints( this->Points );

            //since the smoab::range are always unique and sorted
            //we can use the more efficient coords_iterate
            //call in moab, which returns moab internal allocated memory
            vtkNew< vtkPoints > newPoints;
            newPoints->SetNumberOfPoints( this->Points.size() );

            //need a pointer to the allocated vtkPoints memory so that we
            //don't need to use an extra copy and we can bypass all vtk's check
            //on out of bounds
            double* rawPoints = static_cast< double* >( newPoints->GetVoidPointer( 0 ) );
            this->Interface->get_coords( this->Points, rawPoints );

            grid->SetPoints( newPoints.GetPointer() );
template<typename vtkDataSetType >
void smoab::detail::LoadGeometry::addGridsTopology ( vtkDataSetType *  grid,
vtkIdType  numCells,
vtkIdType  numConnectivity 
) const [inline, private]

Definition at line 133 of file LoadGeometry.h.

References smoab::detail::MixedCellConnectivity::copyToVtkCellInfo(), MixConn, and TopologyDim.

Referenced by fill().

            //correct the connectivity size to account for the vtk padding
            const vtkIdType vtkConnectivity = numCells + numConnectivity;

            vtkNew< vtkIdTypeArray > cellArray;
            vtkNew< vtkIdTypeArray > cellLocations;
            vtkNew< vtkUnsignedCharArray > cellTypes;

            cellArray->SetNumberOfValues( vtkConnectivity );
            cellLocations->SetNumberOfValues( numCells );
            cellTypes->SetNumberOfValues( numCells );

            vtkIdType* rawArray     = static_cast< vtkIdType* >( cellArray->GetVoidPointer( 0 ) );
            vtkIdType* rawLocations = static_cast< vtkIdType* >( cellLocations->GetVoidPointer( 0 ) );
            unsigned char* rawTypes = static_cast< unsigned char* >( cellTypes->GetVoidPointer( 0 ) );

            this->MixConn.copyToVtkCellInfo( rawArray, rawLocations, rawTypes );

            vtkNew< vtkCellArray > cells;
            cells->SetCells( numCells, cellArray.GetPointer() );

            setCells< vtkDataSetType >()( grid, this->TopologyDim, cellTypes.GetPointer(), cellLocations.GetPointer(),
                                          cells.GetPointer() );
template<typename vtkDataSetType >
void smoab::detail::LoadGeometry::fill ( vtkDataSetType *  dataSet) [inline]

Definition at line 96 of file LoadGeometry.h.

References addCoordinates(), addGridsTopology(), smoab::detail::MixedCellConnectivity::compactIds(), and MixConn.

Referenced by smoab::DataSetConverter::fill().

            //now that mixConn has all the cells properly stored, lets fixup
            //the ids so that they start at zero and keep the same logical ordering
            //as before.
            vtkIdType numCells, connLen;
            this->MixConn.compactIds( numCells, connLen );
            this->addGridsTopology( dataSet, numCells, connLen );
            this->addCoordinates( dataSet );

Definition at line 88 of file LoadGeometry.h.

References Points.

Referenced by smoab::DataSetConverter::fill().

            return this->Points;

Member Data Documentation

Definition at line 78 of file LoadGeometry.h.

Referenced by addCoordinates(), and moabPoints().

Definition at line 76 of file LoadGeometry.h.

Referenced by addGridsTopology().

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