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

Converts linear surface elements to quadratic surface elements via either linear subdivision of laplacian (butterfly) subdivision. More...

#include <vtkvmtkLinearToQuadraticSurfaceMeshFilter.h>

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

Public Types

typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkLinearToQuadraticSurfaceMeshFilter * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
void SetSubdivisionMethodToLinear ()
void SetSubdivisionMethodToButterfly ()
virtual void SetSubdivisionMethod (int)
virtual int GetSubdivisionMethod ()

Static Public Member Functions

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

Protected Types

enum  { LINEAR_SUBDIVISION , BUTTERFLY_SUBDIVISION }

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkLinearToQuadraticSurfaceMeshFilter ()
 ~vtkvmtkLinearToQuadraticSurfaceMeshFilter ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Protected Attributes

int SubdivisionMethod

Detailed Description

Converts linear surface elements to quadratic surface elements via either linear subdivision of laplacian (butterfly) subdivision.

This filter takes a pure surface (triangulated) mesh, given as an unstructured grid, and produces the corresponding 6-node quadratic triangle mesh (VTK_QUADRATIC_TRIANGLE) by inserting one mid-edge node per triangle edge. Internally it uses one subdivision pass of a VTK interpolating subdivision filter – either vtkLinearSubdivisionFilter (new nodes placed exactly at edge midpoints) or vtkButterflySubdivisionFilter (new nodes placed using the butterfly stencil, which also perturbs the existing vertex positions towards a smoother, curved surface) – selected through SubdivisionMethod, and reassembles the subdivided triangles into quadratic cells while carrying over point and cell data.

This is one of the filters behind the vmtklineartoquadratic pype script (used, instead of vtkvmtkLinearToQuadraticMeshFilter, when the input is a pure surface mesh rather than a volumetric mesh), typically used to upgrade a linear triangulated surface to a curved, second-order surface mesh.

See also
vtkvmtkLinearToQuadraticMeshFilter

Definition at line 46 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.h.

Member Typedef Documentation

◆ Superclass

typedef vtkUnstructuredGridAlgorithm vtkvmtkLinearToQuadraticSurfaceMeshFilter::Superclass

Definition at line 49 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.h.

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ vtkvmtkLinearToQuadraticSurfaceMeshFilter()

vtkvmtkLinearToQuadraticSurfaceMeshFilter::vtkvmtkLinearToQuadraticSurfaceMeshFilter ( )
protected

Definition at line 40 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.cxx.

41{
42}

◆ ~vtkvmtkLinearToQuadraticSurfaceMeshFilter()

vtkvmtkLinearToQuadraticSurfaceMeshFilter::~vtkvmtkLinearToQuadraticSurfaceMeshFilter ( )
protected

Definition at line 44 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.cxx.

45{
46}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkLinearToQuadraticSurfaceMeshFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkLinearToQuadraticSurfaceMeshFilter * vtkvmtkLinearToQuadraticSurfaceMeshFilter::NewInstance ( ) const

◆ PrintSelf()

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

Definition at line 152 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.cxx.

153{
154 this->Superclass::PrintSelf(os,indent);
155}

◆ New()

vtkvmtkLinearToQuadraticSurfaceMeshFilter * vtkvmtkLinearToQuadraticSurfaceMeshFilter::New ( )
static

◆ SetSubdivisionMethod()

virtual void vtkvmtkLinearToQuadraticSurfaceMeshFilter::SetSubdivisionMethod ( int )
virtual

Set/Get the subdivision method used to place the new mid-edge nodes: LINEAR_SUBDIVISION (exact edge midpoints) or BUTTERFLY_SUBDIVISION (butterfly-stencil interpolation, which also smooths the existing vertex positions). Prefer the SetSubdivisionMethodToLinear / SetSubdivisionMethodToButterfly convenience methods over setting this enum value directly.

◆ GetSubdivisionMethod()

virtual int vtkvmtkLinearToQuadraticSurfaceMeshFilter::GetSubdivisionMethod ( )
virtual

Set/Get the subdivision method used to place the new mid-edge nodes: LINEAR_SUBDIVISION (exact edge midpoints) or BUTTERFLY_SUBDIVISION (butterfly-stencil interpolation, which also smooths the existing vertex positions). Prefer the SetSubdivisionMethodToLinear / SetSubdivisionMethodToButterfly convenience methods over setting this enum value directly.

◆ SetSubdivisionMethodToLinear()

void vtkvmtkLinearToQuadraticSurfaceMeshFilter::SetSubdivisionMethodToLinear ( )
inline

Select LINEAR_SUBDIVISION (new nodes placed exactly at edge midpoints) as the SubdivisionMethod.

Definition at line 67 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.h.

◆ SetSubdivisionMethodToButterfly()

void vtkvmtkLinearToQuadraticSurfaceMeshFilter::SetSubdivisionMethodToButterfly ( )
inline

Select BUTTERFLY_SUBDIVISION (new nodes placed using the butterfly stencil, which also smooths existing vertex positions) as the SubdivisionMethod.

Definition at line 73 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.h.

◆ RequestData()

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

Definition at line 48 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.cxx.

52{
53 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
54 vtkInformation *outInfo = outputVector->GetInformationObject(0);
55
56 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
57 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
58
59 vtkIdType nqpts, *qpts, npts0, npts1;
60 const vtkIdType *pts0, *pts1;
61 vtkIdType numberOfInputCells;
62 vtkPolyData* subdividedSurface;
63 vtkCellArray* quadraticTriangles;
64 vtkIdList* quadraticTriangleCellTypes;
65
66 vtkGeometryFilter* geometryFilter;
67 vtkInterpolatingSubdivisionFilter* subdivisionFilter;
68
69 geometryFilter = vtkGeometryFilter::New();
70 geometryFilter->SetInputData(input);
71 geometryFilter->MergingOff();
72
73 switch (this->SubdivisionMethod)
74 {
76 subdivisionFilter = vtkLinearSubdivisionFilter::New();
77 break;
79 subdivisionFilter = vtkButterflySubdivisionFilter::New();
80 break;
81 default:
82 vtkErrorMacro(<<"Unsupported subdivision method.");
83 return 1;
84 }
85
86 subdivisionFilter->SetInputConnection(geometryFilter->GetOutputPort());
87 subdivisionFilter->SetNumberOfSubdivisions(1);
88 subdivisionFilter->Update();
89
90 subdividedSurface = subdivisionFilter->GetOutput();
91
92 output->SetPoints(subdividedSurface->GetPoints());
93 output->GetPointData()->PassData(subdividedSurface->GetPointData());
94 output->GetCellData()->PassData(subdividedSurface->GetCellData());
95
96 // input->BuildCells();
97 subdividedSurface->BuildCells();
98
99 numberOfInputCells = input->GetNumberOfCells();
100
101 quadraticTriangles = vtkCellArray::New();
102 quadraticTriangleCellTypes = vtkIdList::New();
103
104 nqpts = 6;
105 qpts = new vtkIdType[nqpts];
106
107 // strongly based on the way output cells are built in vtkInterpolatingSubdivisionFilter !!!
108 for (int i=0; i<numberOfInputCells; i++)
109 {
110 input->GetCellPoints(i,npts0,pts0);
111 subdividedSurface->GetCellPoints(4*i+3,npts1,pts1);
112
113 qpts[0] = pts0[0];
114 qpts[1] = pts0[1];
115 qpts[2] = pts0[2];
116 qpts[3] = pts1[0];
117 qpts[4] = pts1[1];
118 qpts[5] = pts1[2];
119
120 // old PolyDataToPolyData version
121// qpts[0] = pts0[0];
122// qpts[1] = pts1[0];
123// qpts[2] = pts0[1];
124// qpts[3] = pts1[1];
125// qpts[4] = pts0[2];
126// qpts[5] = pts1[2];
127
128 quadraticTriangles->InsertNextCell(nqpts,qpts);
129 quadraticTriangleCellTypes->InsertNextId(VTK_QUADRATIC_TRIANGLE);
130 }
131
132 delete[] qpts;
133
134 int* quadraticTriangleCellTypesInt = new int[quadraticTriangleCellTypes->GetNumberOfIds()];
135 for (int i=0; i<quadraticTriangleCellTypes->GetNumberOfIds(); i++)
136 {
137 quadraticTriangleCellTypesInt[i] = quadraticTriangleCellTypes->GetId(i);
138 }
139
140 output->SetCells(quadraticTriangleCellTypesInt,quadraticTriangles);
141
142 delete[] quadraticTriangleCellTypesInt;
143
144 geometryFilter->Delete();
145 subdivisionFilter->Delete();
146 quadraticTriangles->Delete();
147 quadraticTriangleCellTypes->Delete();
148
149 return 1;
150}

Member Data Documentation

◆ SubdivisionMethod

int vtkvmtkLinearToQuadraticSurfaceMeshFilter::SubdivisionMethod
protected

Definition at line 82 of file vtkvmtkLinearToQuadraticSurfaceMeshFilter.h.


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