![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
#include <LoadPoly.h>
Public Member Functions | |
LoadPoly (const smoab::Range &cells, const smoab::Interface &interface) | |
const smoab::Range & | moabPoints () const |
void | fill (vtkPolyData *dataSet) |
Private Member Functions | |
void | addCoordinates (vtkPointSet *grid) |
void | addGridsTopology (vtkPolyData *data, vtkIdType numCells, vtkIdType numConnectivity) const |
Private Attributes | |
moab::Interface * | Interface |
smoab::detail::LinearCellConnectivity | CellConn |
smoab::Range | Points |
Definition at line 23 of file LoadPoly.h.
smoab::detail::LoadPoly::LoadPoly | ( | const smoab::Range & | cells, |
const smoab::Interface & | interface | ||
) | [inline] |
Definition at line 32 of file LoadPoly.h.
: Interface( interface.Moab ), CellConn( cells, interface.Moab ), Points()
{
}
void smoab::detail::LoadPoly::addCoordinates | ( | vtkPointSet * | grid | ) | [inline, private] |
Definition at line 57 of file LoadPoly.h.
References CellConn, smoab::detail::LinearCellConnectivity::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->CellConn.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->SetDataTypeToDouble();
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() );
}
void smoab::detail::LoadPoly::addGridsTopology | ( | vtkPolyData * | data, |
vtkIdType | numCells, | ||
vtkIdType | numConnectivity | ||
) | const [inline, private] |
Definition at line 80 of file LoadPoly.h.
References CellConn, and smoab::detail::LinearCellConnectivity::copyToVtkCellInfo().
Referenced by fill().
{
//correct the connectivity size to account for the vtk padding
const vtkIdType vtkConnectivity = numCells + numConnectivity;
vtkNew< vtkIdTypeArray > cellArray;
cellArray->SetNumberOfValues( vtkConnectivity );
vtkIdType* rawArray = static_cast< vtkIdType* >( cellArray->GetVoidPointer( 0 ) );
this->CellConn.copyToVtkCellInfo( rawArray );
vtkNew< vtkCellArray > cells;
cells->SetCells( numCells, cellArray.GetPointer() );
data->SetPolys( cells.GetPointer() );
}
void smoab::detail::LoadPoly::fill | ( | vtkPolyData * | dataSet | ) | [inline] |
Definition at line 44 of file LoadPoly.h.
References addCoordinates(), addGridsTopology(), CellConn, and smoab::detail::LinearCellConnectivity::compactIds().
{
//now that CellConn 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->CellConn.compactIds( numCells, connLen );
this->addGridsTopology( dataSet, numCells, connLen );
this->addCoordinates( dataSet );
}
const smoab::Range& smoab::detail::LoadPoly::moabPoints | ( | ) | const [inline] |
Definition at line 26 of file LoadPoly.h.
Referenced by addCoordinates(), addGridsTopology(), and fill().
Definition at line 25 of file LoadPoly.h.
smoab::Range smoab::detail::LoadPoly::Points [private] |
Definition at line 27 of file LoadPoly.h.
Referenced by addCoordinates(), and moabPoints().