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

Project point data from a reference mesh onto a query mesh. More...

#include <vtkvmtkMeshProjection.h>

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

Public Types

typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkMeshProjection * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetReferenceMesh (vtkUnstructuredGrid *)
virtual vtkUnstructuredGrid * GetReferenceMesh ()
virtual void SetTolerance (double)
virtual double GetTolerance ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

vtkUnstructuredGrid * ReferenceMesh
double Tolerance

Detailed Description

Project point data from a reference mesh onto a query mesh.

For each point of the input (query) mesh, finds the enclosing cell (within Tolerance) of ReferenceMesh and interpolates every point data array present there onto the query point. Used, e.g., to transfer a computed solution (velocity, pressure, wall shear stress) from one mesh discretization onto another (differently meshed or remeshed) geometry.

Definition at line 35 of file vtkvmtkMeshProjection.h.

Member Typedef Documentation

◆ Superclass

typedef vtkUnstructuredGridAlgorithm vtkvmtkMeshProjection::Superclass

Definition at line 38 of file vtkvmtkMeshProjection.h.

Constructor & Destructor Documentation

◆ vtkvmtkMeshProjection()

vtkvmtkMeshProjection::vtkvmtkMeshProjection ( )
protected

Definition at line 37 of file vtkvmtkMeshProjection.cxx.

38{
39 this->ReferenceMesh = NULL;
40 this->Tolerance = 1E-6;
41}
vtkUnstructuredGrid * ReferenceMesh

◆ ~vtkvmtkMeshProjection()

vtkvmtkMeshProjection::~vtkvmtkMeshProjection ( )
protected

Definition at line 43 of file vtkvmtkMeshProjection.cxx.

44{
45 if (this->ReferenceMesh)
46 {
47 this->ReferenceMesh->Delete();
48 this->ReferenceMesh = NULL;
49 }
50}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkMeshProjection::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkMeshProjection * vtkvmtkMeshProjection::NewInstance ( ) const

◆ PrintSelf()

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

Definition at line 114 of file vtkvmtkMeshProjection.cxx.

115{
116 this->Superclass::PrintSelf(os,indent);
117}

◆ New()

vtkvmtkMeshProjection * vtkvmtkMeshProjection::New ( )
static

◆ SetReferenceMesh()

virtual void vtkvmtkMeshProjection::SetReferenceMesh ( vtkUnstructuredGrid * )
virtual

Set/Get the mesh whose point data is projected onto the input (query) mesh. Required input.

◆ GetReferenceMesh()

virtual vtkUnstructuredGrid * vtkvmtkMeshProjection::GetReferenceMesh ( )
virtual

Set/Get the mesh whose point data is projected onto the input (query) mesh. Required input.

◆ SetTolerance()

virtual void vtkvmtkMeshProjection::SetTolerance ( double )
virtual

Set/Get the parametric-coordinate tolerance used when locating the ReferenceMesh cell enclosing each query point.

◆ GetTolerance()

virtual double vtkvmtkMeshProjection::GetTolerance ( )
virtual

Set/Get the parametric-coordinate tolerance used when locating the ReferenceMesh cell enclosing each query point.

◆ RequestData()

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

Definition at line 52 of file vtkvmtkMeshProjection.cxx.

56{
57 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
58 vtkInformation *outInfo = outputVector->GetInformationObject(0);
59
60 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
61 inInfo->Get(vtkDataObject::DATA_OBJECT()));
62 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
63 outInfo->Get(vtkDataObject::DATA_OBJECT()));
64
65 vtkIdType i;
66 vtkIdType cellId;
67 int subId;
68 double point[3], closestPoint[3];
69 double pcoords[3];
70 double distance2;
71 vtkCellLocator *locator;
72 vtkGenericCell *genericCell;
73
74 if (!this->ReferenceMesh)
75 {
76 vtkErrorMacro(<<"No reference mesh!");
77 return 1;
78 }
79
80 int numberOfPoints = input->GetNumberOfPoints();
81
82 output->DeepCopy(input);
83
84 vtkPointData* outputPointData = output->GetPointData();
85 vtkPointData* referencePointData = this->ReferenceMesh->GetPointData();
86
87 outputPointData->InterpolateAllocate(referencePointData,numberOfPoints);
88
89 locator = vtkCellLocator::New();
90 genericCell = vtkGenericCell::New();
91
92 locator->SetDataSet(this->ReferenceMesh);
93 locator->BuildLocator();
94 locator->SetTolerance(this->Tolerance);
95
96 for (i=0; i<numberOfPoints; i++)
97 {
98 input->GetPoint(i,point);
99 locator->FindClosestPoint(point,closestPoint,genericCell,cellId,subId,distance2);
100 double* weights = new double[genericCell->GetNumberOfPoints()];
101 genericCell->EvaluatePosition(closestPoint,NULL,subId,pcoords,distance2,weights);
102
103 outputPointData->InterpolatePoint(referencePointData,i,genericCell->GetPointIds(),weights);
104
105 delete[] weights;
106 }
107
108 locator->Delete();
109 genericCell->Delete();
110
111 return 1;
112}

Member Data Documentation

◆ ReferenceMesh

vtkUnstructuredGrid* vtkvmtkMeshProjection::ReferenceMesh
protected

Definition at line 66 of file vtkvmtkMeshProjection.h.

◆ Tolerance

double vtkvmtkMeshProjection::Tolerance
protected

Definition at line 67 of file vtkvmtkMeshProjection.h.


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