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

Calculates vorticity from velocity gradients in a mesh. More...

#include <vtkvmtkMeshVorticity.h>

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

Public Types

typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkMeshVorticity * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetVelocityArrayName (const char *)
virtual char * GetVelocityArrayName ()
virtual void SetVorticityArrayName (const char *)
virtual char * GetVorticityArrayName ()
virtual void SetComputeIndividualPartialDerivatives (int)
virtual int GetComputeIndividualPartialDerivatives ()
virtual void ComputeIndividualPartialDerivativesOn ()
virtual void ComputeIndividualPartialDerivativesOff ()
virtual void SetConvergenceTolerance (double)
virtual double GetConvergenceTolerance ()
virtual void SetQuadratureOrder (int)
virtual int GetQuadratureOrder ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

char * VelocityArrayName
char * VorticityArrayName
int ComputeIndividualPartialDerivatives
double ConvergenceTolerance
int QuadratureOrder

Detailed Description

Calculates vorticity from velocity gradients in a mesh.

Computes the full 3x3 velocity gradient tensor of the 3-component point data array named VelocityArrayName using vtkvmtkUnstructuredGridGradientFilter (finite-element L2 projection, Gauss quadrature order QuadratureOrder, solved to ConvergenceTolerance), then derives the vorticity (curl) from the antisymmetric part of that tensor and stores it in the point data array named VorticityArrayName. Unlike vtkvmtkUnstructuredGridVorticityFilter (which assembles the curl directly, one component at a time, via vtkvmtkUnstructuredGridFEVorticityAssembler), this class goes through the full gradient tensor.

See also
vtkvmtkUnstructuredGridGradientFilter, vtkvmtkUnstructuredGridVorticityFilter

Definition at line 40 of file vtkvmtkMeshVorticity.h.

Member Typedef Documentation

◆ Superclass

typedef vtkUnstructuredGridAlgorithm vtkvmtkMeshVorticity::Superclass

Definition at line 43 of file vtkvmtkMeshVorticity.h.

Constructor & Destructor Documentation

◆ vtkvmtkMeshVorticity()

vtkvmtkMeshVorticity::vtkvmtkMeshVorticity ( )
protected

◆ ~vtkvmtkMeshVorticity()

vtkvmtkMeshVorticity::~vtkvmtkMeshVorticity ( )
protected

Definition at line 47 of file vtkvmtkMeshVorticity.cxx.

48{
49 if (this->VelocityArrayName)
50 {
51 delete[] this->VelocityArrayName;
52 this->VelocityArrayName = NULL;
53 }
54 if (this->VorticityArrayName)
55 {
56 delete[] this->VorticityArrayName;
57 this->VorticityArrayName = NULL;
58 }
59}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkMeshVorticity::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkMeshVorticity * vtkvmtkMeshVorticity::NewInstance ( ) const

◆ PrintSelf()

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

Definition at line 136 of file vtkvmtkMeshVorticity.cxx.

137{
138 this->Superclass::PrintSelf(os,indent);
139}

◆ New()

vtkvmtkMeshVorticity * vtkvmtkMeshVorticity::New ( )
static

◆ SetVelocityArrayName()

virtual void vtkvmtkMeshVorticity::SetVelocityArrayName ( const char * )
virtual

Set/Get the name of the 3-component point data array holding the velocity field. Required input.

◆ GetVelocityArrayName()

virtual char * vtkvmtkMeshVorticity::GetVelocityArrayName ( )
virtual

Set/Get the name of the 3-component point data array holding the velocity field. Required input.

◆ SetVorticityArrayName()

virtual void vtkvmtkMeshVorticity::SetVorticityArrayName ( const char * )
virtual

Set/Get the name of the output 3-component point data array where the computed vorticity is stored. If not set, "Vorticity" is used.

◆ GetVorticityArrayName()

virtual char * vtkvmtkMeshVorticity::GetVorticityArrayName ( )
virtual

Set/Get the name of the output 3-component point data array where the computed vorticity is stored. If not set, "Vorticity" is used.

◆ SetComputeIndividualPartialDerivatives()

virtual void vtkvmtkMeshVorticity::SetComputeIndividualPartialDerivatives ( int )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ GetComputeIndividualPartialDerivatives()

virtual int vtkvmtkMeshVorticity::GetComputeIndividualPartialDerivatives ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ ComputeIndividualPartialDerivativesOn()

virtual void vtkvmtkMeshVorticity::ComputeIndividualPartialDerivativesOn ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ ComputeIndividualPartialDerivativesOff()

virtual void vtkvmtkMeshVorticity::ComputeIndividualPartialDerivativesOff ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ SetConvergenceTolerance()

virtual void vtkvmtkMeshVorticity::SetConvergenceTolerance ( double )
virtual

Set/Get the convergence tolerance of the iterative linear solver used to solve the finite-element gradient projection.

◆ GetConvergenceTolerance()

virtual double vtkvmtkMeshVorticity::GetConvergenceTolerance ( )
virtual

Set/Get the convergence tolerance of the iterative linear solver used to solve the finite-element gradient projection.

◆ SetQuadratureOrder()

virtual void vtkvmtkMeshVorticity::SetQuadratureOrder ( int )
virtual

Set/Get the order of the Gauss quadrature rule used to integrate the finite-element gradient matrices.

◆ GetQuadratureOrder()

virtual int vtkvmtkMeshVorticity::GetQuadratureOrder ( )
virtual

Set/Get the order of the Gauss quadrature rule used to integrate the finite-element gradient matrices.

◆ RequestData()

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

Definition at line 61 of file vtkvmtkMeshVorticity.cxx.

65{
66 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
67 vtkInformation *outInfo = outputVector->GetInformationObject(0);
68
69 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
70 inInfo->Get(vtkDataObject::DATA_OBJECT()));
71 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
72 outInfo->Get(vtkDataObject::DATA_OBJECT()));
73
74 if (this->VelocityArrayName == NULL)
75 {
76 vtkErrorMacro("VelocityArrayName not specified");
77 return 1;
78 }
79
80 vtkDataArray* velocityArray = input->GetPointData()->GetArray(this->VelocityArrayName);
81
82 if (velocityArray == NULL)
83 {
84 vtkErrorMacro("VelocityArray with name specified does not exist");
85 return 1;
86 }
87
88 char gradientArrayName[] = "VelocityGradient";
89
90 vtkvmtkUnstructuredGridGradientFilter* gradientFilter = vtkvmtkUnstructuredGridGradientFilter::New();
91 gradientFilter->SetInputData(input);
92 gradientFilter->SetInputArrayName(this->VelocityArrayName);
93 gradientFilter->SetGradientArrayName(gradientArrayName);
94 gradientFilter->SetQuadratureOrder(this->QuadratureOrder);
95 gradientFilter->SetConvergenceTolerance(this->ConvergenceTolerance);
97 gradientFilter->Update();
98
99 vtkDataArray* velocityGradientArray = gradientFilter->GetOutput()->GetPointData()->GetArray(gradientArrayName);
100
101 int numberOfPoints = input->GetNumberOfPoints();
102
103 vtkDoubleArray* vorticityArray = vtkDoubleArray::New();
104 if (this->VorticityArrayName)
105 {
106 vorticityArray->SetName(this->VorticityArrayName);
107 }
108 else
109 {
110 vorticityArray->SetName("Vorticity");
111 }
112 vorticityArray->SetNumberOfComponents(3);
113 vorticityArray->SetNumberOfTuples(numberOfPoints);
114
115 double velocityGradient[9];
116 double vorticity[3];
117
118 int i;
119 for (i=0; i<numberOfPoints; i++)
120 {
121 velocityGradientArray->GetTuple(i,velocityGradient);
122 vorticity[0] = velocityGradient[7] - velocityGradient[5];
123 vorticity[1] = velocityGradient[2] - velocityGradient[6];
124 vorticity[2] = velocityGradient[3] - velocityGradient[1];
125 vorticityArray->SetTuple(i,vorticity);
126 }
127
128 output->DeepCopy(input);
129 output->GetPointData()->AddArray(vorticityArray);
130
131 vorticityArray->Delete();
132
133 return 1;
134}
virtual void SetComputeIndividualPartialDerivatives(int)
virtual void SetInputArrayName(const char *)
virtual void SetGradientArrayName(const char *)
virtual void SetConvergenceTolerance(double)
static vtkvmtkUnstructuredGridGradientFilter * New()

Member Data Documentation

◆ VelocityArrayName

char* vtkvmtkMeshVorticity::VelocityArrayName
protected

Definition at line 101 of file vtkvmtkMeshVorticity.h.

◆ VorticityArrayName

char* vtkvmtkMeshVorticity::VorticityArrayName
protected

Definition at line 102 of file vtkvmtkMeshVorticity.h.

◆ ComputeIndividualPartialDerivatives

int vtkvmtkMeshVorticity::ComputeIndividualPartialDerivatives
protected

Definition at line 104 of file vtkvmtkMeshVorticity.h.

◆ ConvergenceTolerance

double vtkvmtkMeshVorticity::ConvergenceTolerance
protected

Definition at line 106 of file vtkvmtkMeshVorticity.h.

◆ QuadratureOrder

int vtkvmtkMeshVorticity::QuadratureOrder
protected

Definition at line 107 of file vtkvmtkMeshVorticity.h.


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