VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataToUnstructuredGridFilter Class Reference

Repackage a vtkPolyData surface as a vtkUnstructuredGrid, unchanged otherwise. More...

#include <vtkvmtkPolyDataToUnstructuredGridFilter.h>

Inheritance diagram for vtkvmtkPolyDataToUnstructuredGridFilter:
[legend]
Collaboration diagram for vtkvmtkPolyDataToUnstructuredGridFilter:
[legend]

Public Types

typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataToUnstructuredGridFilter * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkPolyDataToUnstructuredGridFilter * SafeDownCast (vtkObjectBase *o)
static vtkvmtkPolyDataToUnstructuredGridFilter * New ()

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataToUnstructuredGridFilter ()
 ~vtkvmtkPolyDataToUnstructuredGridFilter ()
int FillInputPortInformation (int, vtkInformation *info) override
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Detailed Description

Repackage a vtkPolyData surface as a vtkUnstructuredGrid, unchanged otherwise.

This filter copies the points, cells (of whatever type they are – vertices, lines, polygons, triangle strips), point data, and cell data of the input poly data into an unstructured grid output, without altering geometry, topology, or connectivity. It performs no interpolation, subdivision, or tetrahedralization: the output has exactly the same cells as the input, only represented with the more general vtkUnstructuredGrid data structure.

This is used by the vmtksurfacetomesh pype script to turn a (typically triangulated) surface into the mesh representation ("vtkUnstructuredGrid") expected by vmtk's mesh I/O and mesh processing scripts, e.g. as a lightweight way to obtain a "surface mesh" prior to volumetric mesh generation.

Definition at line 42 of file vtkvmtkPolyDataToUnstructuredGridFilter.h.

Member Typedef Documentation

◆ Superclass

typedef vtkUnstructuredGridAlgorithm vtkvmtkPolyDataToUnstructuredGridFilter::Superclass

Definition at line 45 of file vtkvmtkPolyDataToUnstructuredGridFilter.h.

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataToUnstructuredGridFilter()

vtkvmtkPolyDataToUnstructuredGridFilter::vtkvmtkPolyDataToUnstructuredGridFilter ( )
inlineprotected

Definition at line 51 of file vtkvmtkPolyDataToUnstructuredGridFilter.h.

51{}

◆ ~vtkvmtkPolyDataToUnstructuredGridFilter()

vtkvmtkPolyDataToUnstructuredGridFilter::~vtkvmtkPolyDataToUnstructuredGridFilter ( )
inlineprotected

Definition at line 52 of file vtkvmtkPolyDataToUnstructuredGridFilter.h.

52{}

Member Function Documentation

◆ IsTypeOf()

int vtkvmtkPolyDataToUnstructuredGridFilter::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkPolyDataToUnstructuredGridFilter::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkPolyDataToUnstructuredGridFilter * vtkvmtkPolyDataToUnstructuredGridFilter::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataToUnstructuredGridFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataToUnstructuredGridFilter * vtkvmtkPolyDataToUnstructuredGridFilter::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkPolyDataToUnstructuredGridFilter::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 88 of file vtkvmtkPolyDataToUnstructuredGridFilter.cxx.

89{
90 this->Superclass::PrintSelf(os,indent);
91}

◆ New()

vtkvmtkPolyDataToUnstructuredGridFilter * vtkvmtkPolyDataToUnstructuredGridFilter::New ( )
static

◆ FillInputPortInformation()

int vtkvmtkPolyDataToUnstructuredGridFilter::FillInputPortInformation ( int ,
vtkInformation * info )
overrideprotected

Definition at line 37 of file vtkvmtkPolyDataToUnstructuredGridFilter.cxx.

38{
39 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
40 return 1;
41}

◆ RequestData()

int vtkvmtkPolyDataToUnstructuredGridFilter::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Definition at line 43 of file vtkvmtkPolyDataToUnstructuredGridFilter.cxx.

47{
48 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
49 vtkInformation *outInfo = outputVector->GetInformationObject(0);
50
51 vtkPolyData *input = vtkPolyData::SafeDownCast(
52 inInfo->Get(vtkDataObject::DATA_OBJECT()));
53 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
54 outInfo->Get(vtkDataObject::DATA_OBJECT()));
55
56 output->SetPoints(input->GetPoints());
57 output->GetPointData()->PassData(input->GetPointData());
58 output->GetCellData()->PassData(input->GetCellData());
59
60 vtkCellArray* cellArray = vtkCellArray::New();
61
62 int numberOfCells = input->GetNumberOfCells();
63
64 input->BuildCells();
65
66 int* cellTypes = new int[numberOfCells];
67
68 vtkIdType npts;
69 const vtkIdType *pts;
70 int cellType;
71 for (int i=0; i<numberOfCells; i++)
72 {
73 input->GetCellPoints(i,npts,pts);
74 cellType = input->GetCellType(i);
75
76 cellArray->InsertNextCell(npts,pts);
77 cellTypes[i] = cellType;
78 }
79
80 output->SetCells(cellTypes,cellArray);
81
82 cellArray->Delete();
83 delete[] cellTypes;
84
85 return 1;
86}

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