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

Build the one-ring neighborhood of a point on a vtkPolyData surface mesh. More...

#include <vtkvmtkPolyDataNeighborhood.h>

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

Public Types

typedef vtkvmtkNeighborhood Superclass
Public Types inherited from vtkvmtkNeighborhood
typedef vtkvmtkDataSetItem Superclass
Public Types inherited from vtkvmtkDataSetItem
typedef vtkvmtkItem Superclass
Public Types inherited from vtkvmtkItem
typedef vtkObject Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataNeighborhood * NewInstance () const
virtual vtkIdType GetItemType () override
virtual void Build () override
Public Member Functions inherited from vtkvmtkNeighborhood
vtkvmtkNeighborhood * NewInstance () const
virtual bool GetIsBoundary ()
vtkIdType GetNumberOfPoints ()
vtkIdType GetPointId (vtkIdType i)
vtkIdType * GetPointer (vtkIdType i)
virtual void DeepCopy (vtkvmtkItem *src) override
Public Member Functions inherited from vtkvmtkDataSetItem
vtkvmtkDataSetItem * NewInstance () const
void SetDataSet (vtkDataSet *dataSet)
vtkDataSet * GetDataSet ()
virtual void SetDataSetPointId (vtkIdType)
virtual vtkIdType GetDataSetPointId ()
virtual void SetReallocateOnBuild (int)
virtual int GetReallocateOnBuild ()
virtual void ReallocateOnBuildOn ()
virtual void ReallocateOnBuildOff ()
Public Member Functions inherited from vtkvmtkItem
vtkvmtkItem * NewInstance () const

Static Public Member Functions

static vtkvmtkPolyDataNeighborhood * New ()
static int IsTypeOf (const char *type)
static vtkvmtkPolyDataNeighborhood * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkNeighborhood
static int IsTypeOf (const char *type)
static vtkvmtkNeighborhood * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkDataSetItem
static int IsTypeOf (const char *type)
static vtkvmtkDataSetItem * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkItem
static int IsTypeOf (const char *type)
static vtkvmtkItem * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataNeighborhood ()
 ~vtkvmtkPolyDataNeighborhood ()
Protected Member Functions inherited from vtkvmtkNeighborhood
 vtkvmtkNeighborhood ()
 ~vtkvmtkNeighborhood ()
void ResizePointList (vtkIdType ptId, int size)
Protected Member Functions inherited from vtkvmtkDataSetItem
 vtkvmtkDataSetItem ()
 ~vtkvmtkDataSetItem ()
Protected Member Functions inherited from vtkvmtkItem
 vtkvmtkItem ()
 ~vtkvmtkItem ()

Additional Inherited Members

Protected Attributes inherited from vtkvmtkNeighborhood
vtkIdType NPoints
vtkIdType * PointIds
bool IsBoundary
Protected Attributes inherited from vtkvmtkDataSetItem
vtkDataSet * DataSet
vtkIdType DataSetPointId
int ReallocateOnBuild

Detailed Description

Build the one-ring neighborhood of a point on a vtkPolyData surface mesh.

Given a point id set on the underlying vtkvmtkNeighborhood (via SetDataSet/SetDataSetPointId) and a vtkPolyData data set, Build() collects the ids of all points connected to that point by a shared cell (its one-ring / umbrella neighborhood) and stores them for later access through the inherited vtkvmtkNeighborhood point-id array. This is the neighborhood implementation used by mesh-processing classes that operate on triangulated surfaces, and is instantiated internally by classes such as vtkvmtkSparseMatrix when building neighborhoods from a vtkPolyData input.

See also
vtkvmtkNeighborhood, vtkvmtkUnstructuredGridNeighborhood, vtkvmtkStencil

Definition at line 41 of file vtkvmtkPolyDataNeighborhood.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataNeighborhood()

vtkvmtkPolyDataNeighborhood::vtkvmtkPolyDataNeighborhood ( )
inlineprotected

Definition at line 60 of file vtkvmtkPolyDataNeighborhood.h.

60{};

◆ ~vtkvmtkPolyDataNeighborhood()

vtkvmtkPolyDataNeighborhood::~vtkvmtkPolyDataNeighborhood ( )
inlineprotected

Definition at line 61 of file vtkvmtkPolyDataNeighborhood.h.

61{};

Member Function Documentation

◆ New()

vtkvmtkPolyDataNeighborhood * vtkvmtkPolyDataNeighborhood::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

Reimplemented from vtkvmtkNeighborhood.

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataNeighborhood::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkvmtkNeighborhood.

◆ NewInstance()

vtkvmtkPolyDataNeighborhood * vtkvmtkPolyDataNeighborhood::NewInstance ( ) const

◆ GetItemType()

virtual vtkIdType vtkvmtkPolyDataNeighborhood::GetItemType ( )
inlineoverridevirtual

Return the neighborhood item type identifier (VTK_VMTK_POLYDATA_NEIGHBORHOOD), used by vtkvmtkNeighborhoods/vtkvmtkItems factories to instantiate the correct neighborhood subclass.

Implements vtkvmtkItem.

Definition at line 52 of file vtkvmtkPolyDataNeighborhood.h.

@ VTK_VMTK_POLYDATA_NEIGHBORHOOD

◆ Build()

void vtkvmtkPolyDataNeighborhood::Build ( )
overridevirtual

Build the neighborhood.

Implements vtkvmtkNeighborhood.

Definition at line 31 of file vtkvmtkPolyDataNeighborhood.cxx.

32{
33 vtkIdType i, j;
34 vtkIdType numCellsInStencil;
35 vtkIdList *cellIds, *ptIds, *stencilIds;
36 vtkPolyData* pdata = vtkPolyData::SafeDownCast(this->DataSet);
37
38 if (pdata==NULL)
39 {
40 vtkErrorMacro(<< "Input data NULL or not poly data");
41 }
42
43 vtkIdType pointId = this->DataSetPointId;
44
45 this->NPoints = 0;
46
47 cellIds = vtkIdList::New();
48 ptIds = vtkIdList::New();
49 stencilIds = vtkIdList::New();
50
51 pdata->GetPointCells (pointId, cellIds);
52 numCellsInStencil = cellIds->GetNumberOfIds();
53 if (numCellsInStencil < 1)
54 {
55 // vtkWarningMacro("numCellsInStencil < 1: " << numCellsInStencil);
56 cellIds->Delete();
57 ptIds->Delete();
58 stencilIds->Delete();
59 return;
60 }
61
62 vtkIdType cellPointId;
63 for (i=0; i<numCellsInStencil; i++)
64 {
65 pdata->GetCellPoints(cellIds->GetId(i),ptIds);
66 for (j=0; j<ptIds->GetNumberOfIds(); j++)
67 {
68 cellPointId = ptIds->GetId(j);
69 if (cellPointId != pointId)
70 {
71 stencilIds->InsertUniqueId(ptIds->GetId(j));
72 }
73 }
74 }
75
76 this->NPoints = stencilIds->GetNumberOfIds();
77 if (this->PointIds!=NULL)
78 {
79 delete[] this->PointIds;
80 this->PointIds = NULL;
81 }
82 this->PointIds = new vtkIdType[this->NPoints];
83 memcpy(this->PointIds,stencilIds->GetPointer(0),this->NPoints*sizeof(vtkIdType));
84
85 cellIds->Delete();
86 ptIds->Delete();
87 stencilIds->Delete();
88}

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