本文整理汇总了C++中vtkSmartPointer::GetCell方法的典型用法代码示例。如果您正苦于以下问题:C++ vtkSmartPointer::GetCell方法的具体用法?C++ vtkSmartPointer::GetCell怎么用?C++ vtkSmartPointer::GetCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtkSmartPointer
的用法示例。
在下文中一共展示了vtkSmartPointer::GetCell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Mesh
//.........这里部分代码省略.........
// for ( int k=0; k<boundaryPoints.size(); k++ )
// std::cout << boundaryPoints[k] << std::endl;
// std::cout << "WWW" << std::endl;
// poly->Print( std::cout );
// vtkCellArray * verts = poly->GetVerts();
// verts->Print( std::cout );
// std::cout << "XXX" << std::endl;
// poly->GetData()->Print( std::cout );
// int numBoundaryPoints = poly->GetNumberOfPoints();
// Teuchos::ArrayRCP<Teuchos::Tuple<double,3> > boundaryPoints( numBoundaryPoints );
// for ( unsigned int k=0; k<numBoundaryPoints; k++ )
// poly->GetPoint( k, boundaryPoints[k].getRawPtr() );
// mesh->setBoundaryNodes( boundaryPoints );
// for ( int k=0; k<points.size(); k++ )
// std::cout << boundaryPoints[k] << std::endl;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// get cells
int globalNumElems = vtkMesh->GetNumberOfCells();
// create an appropriate map
Teuchos::RCP<const Epetra_Map> elemsMap =
Teuchos::rcp ( new Epetra_Map ( globalNumElems, 0, *comm ) );
int localNumElems = elemsMap->NumMyElements();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<int> > elems( localNumElems );
Teuchos::ArrayRCP<Mesh::ElementType> elemTypes( localNumElems );
for ( unsigned int k=0; k<localNumElems; k++ )
{
// set the connectivity table
vtkCell * cell = vtkMesh->GetCell( elemsMap->GID(k) );
int numPoints = cell->GetNumberOfPoints();
elems[k] = Teuchos::ArrayRCP<int>( numPoints );
for ( unsigned int l=0; l<numPoints; l++ )
elems[k][l] = cell->GetPointId( l );
// set the element type
switch( cell->GetCellType() )
{
case VTK_LINE:
elemTypes[k] = Mesh::EDGE2;
break;
case VTK_QUADRATIC_EDGE:
elemTypes[k] = Mesh::EDGE3;
break;
case VTK_TRIANGLE:
elemTypes[k] = Mesh::TRI3;
break;
case VTK_QUADRATIC_TRIANGLE:
elemTypes[k] = Mesh::TRI6;
break;
case VTK_QUAD:
elemTypes[k] = Mesh::QUAD4;
break;
case VTK_QUADRATIC_QUAD:
elemTypes[k] = Mesh::QUAD8;
break;
case VTK_BIQUADRATIC_QUAD:
elemTypes[k] = Mesh::QUAD9;
break;
case VTK_TETRA:
elemTypes[k] = Mesh::TET4;
break;
case VTK_QUADRATIC_TETRA:
elemTypes[k] = Mesh::TET10;
break;
case VTK_HEXAHEDRON:
elemTypes[k] = Mesh::HEX8;
break;
case VTK_QUADRATIC_HEXAHEDRON:
elemTypes[k] = Mesh::HEX20;
break;
case VTK_WEDGE:
elemTypes[k] = Mesh::PRISM6;
break;
case VTK_HIGHER_ORDER_WEDGE:
elemTypes[k] = Mesh::PRISM15;
break;
case VTK_PYRAMID:
elemTypes[k] = Mesh::PYRAMID5;
break;
default:
TEST_FOR_EXCEPTION( true,
std::logic_error,
"Unknown type \""<< cell->GetCellType() <<"\"." );
}
}
mesh->setElems( elems );
mesh->setElemTypes( elemTypes );
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return mesh;
}