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

Construct a vorticity based finite element calculation on a mesh. More...

#include <vtkvmtkUnstructuredGridFEVorticityAssembler.h>

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

Public Types

typedef vtkvmtkFEAssembler Superclass
Public Types inherited from vtkvmtkFEAssembler
typedef vtkObject Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkUnstructuredGridFEVorticityAssembler * NewInstance () const
virtual void Build () override
virtual void SetVelocityArrayName (const char *)
virtual char * GetVelocityArrayName ()
virtual void SetDirection (int)
virtual int GetDirection ()
Public Member Functions inherited from vtkvmtkFEAssembler
vtkvmtkFEAssembler * NewInstance () const
virtual int GetNumberOfVariables ()
void DeepCopy (vtkvmtkFEAssembler *src)
void ShallowCopy (vtkvmtkFEAssembler *src)
virtual void SetDataSet (vtkDataSet *)
virtual vtkDataSet * GetDataSet ()
virtual void SetMatrix (vtkvmtkSparseMatrix *)
virtual vtkvmtkSparseMatrix * GetMatrix ()
virtual void SetRHSVector (vtkvmtkDoubleVector *)
virtual vtkvmtkDoubleVector * GetRHSVector ()
virtual void SetSolutionVector (vtkvmtkDoubleVector *)
virtual vtkvmtkDoubleVector * GetSolutionVector ()
virtual void SetQuadratureOrder (int)
virtual int GetQuadratureOrder ()

Static Public Member Functions

static vtkvmtkUnstructuredGridFEVorticityAssembler * New ()
static int IsTypeOf (const char *type)
static vtkvmtkUnstructuredGridFEVorticityAssembler * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkFEAssembler
static int IsTypeOf (const char *type)
static vtkvmtkFEAssembler * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkUnstructuredGridFEVorticityAssembler ()
 ~vtkvmtkUnstructuredGridFEVorticityAssembler ()
Protected Member Functions inherited from vtkvmtkFEAssembler
 vtkvmtkFEAssembler ()
 ~vtkvmtkFEAssembler ()
void Initialize (int numberOfVariables)

Protected Attributes

char * VelocityArrayName
int Direction
Protected Attributes inherited from vtkvmtkFEAssembler
vtkDataSet * DataSet
vtkvmtkSparseMatrix * Matrix
vtkvmtkDoubleVector * RHSVector
vtkvmtkDoubleVector * SolutionVector
int NumberOfVariables
int QuadratureOrder

Detailed Description

Construct a vorticity based finite element calculation on a mesh.

Assembles, over a vtkUnstructuredGrid, the finite-element right-hand side for a single component (Direction) of the vorticity field (curl) of the 3-component point data velocity array named VelocityArrayName. Used internally by vtkvmtkUnstructuredGridVorticityFilter.

See also
vtkvmtkFEAssembler, vtkvmtkUnstructuredGridVorticityFilter

Definition at line 35 of file vtkvmtkUnstructuredGridFEVorticityAssembler.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkUnstructuredGridFEVorticityAssembler()

vtkvmtkUnstructuredGridFEVorticityAssembler::vtkvmtkUnstructuredGridFEVorticityAssembler ( )
protected

◆ ~vtkvmtkUnstructuredGridFEVorticityAssembler()

vtkvmtkUnstructuredGridFEVorticityAssembler::~vtkvmtkUnstructuredGridFEVorticityAssembler ( )
protected

Definition at line 40 of file vtkvmtkUnstructuredGridFEVorticityAssembler.cxx.

41{
42 if (this->VelocityArrayName)
43 {
44 delete[] this->VelocityArrayName;
45 this->VelocityArrayName = NULL;
46 }
47}

Member Function Documentation

◆ New()

vtkvmtkUnstructuredGridFEVorticityAssembler * vtkvmtkUnstructuredGridFEVorticityAssembler::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

Reimplemented from vtkvmtkFEAssembler.

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkUnstructuredGridFEVorticityAssembler::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkvmtkFEAssembler.

◆ NewInstance()

vtkvmtkUnstructuredGridFEVorticityAssembler * vtkvmtkUnstructuredGridFEVorticityAssembler::NewInstance ( ) const

◆ Build()

void vtkvmtkUnstructuredGridFEVorticityAssembler::Build ( )
overridevirtual

Assemble the vorticity right-hand side for component Direction.

Implements vtkvmtkFEAssembler.

Definition at line 49 of file vtkvmtkUnstructuredGridFEVorticityAssembler.cxx.

50{
51 if (!this->VelocityArrayName)
52 {
53 vtkErrorMacro("VelocityArrayName not specified!");
54 return;
55 }
56
57 vtkDataArray* velocityArray = this->DataSet->GetPointData()->GetArray(this->VelocityArrayName);
58
59 if (!velocityArray)
60 {
61 vtkErrorMacro("VelocityArray with name specified does not exist!");
62 return;
63 }
64
65 if (velocityArray->GetNumberOfComponents() != 3)
66 {
67 vtkErrorMacro("VelocityArray must have 3 components!");
68 return;
69 }
70
71// int numberOfVariables = 3;
72 int numberOfVariables = 1;
73 this->Initialize(numberOfVariables);
74
75 vtkvmtkGaussQuadrature* gaussQuadrature = vtkvmtkGaussQuadrature::New();
76 gaussQuadrature->SetOrder(this->QuadratureOrder);
77
78 vtkvmtkFEShapeFunctions* feShapeFunctions = vtkvmtkFEShapeFunctions::New();
79
80 int dimension = 3;
81
82 int numberOfCells = this->DataSet->GetNumberOfCells();
83 int k;
84 for (k=0; k<numberOfCells; k++)
85 {
86 vtkCell* cell = this->DataSet->GetCell(k);
87 if (cell->GetCellDimension() != dimension)
88 {
89 continue;
90 }
91 gaussQuadrature->Initialize(cell->GetCellType());
92 feShapeFunctions->Initialize(cell,gaussQuadrature->GetQuadraturePoints());
93 int numberOfQuadraturePoints = gaussQuadrature->GetNumberOfQuadraturePoints();
94 double quadraturePCoords[3];
95 int numberOfCellPoints = cell->GetNumberOfPoints();
96 int i, j;
97 int q;
98 for (q=0; q<numberOfQuadraturePoints; q++)
99 {
100 gaussQuadrature->GetQuadraturePoint(q,quadraturePCoords);
101 double quadratureWeight = gaussQuadrature->GetQuadratureWeight(q);
102 double jacobian = feShapeFunctions->GetJacobian(q);
103 double phii, phij;
104 double dphii[3];
105 double velocityValue[3];
106// double vorticityValue[3];
107// vorticityValue[0] = vorticityValue[1] = vorticityValue[2] = 0.0;
108 double vorticityComponent = 0.0;
109 for (i=0; i<numberOfCellPoints; i++)
110 {
111 vtkIdType iId = cell->GetPointId(i);
112 feShapeFunctions->GetDPhi(q,i,dphii);
113 velocityArray->GetTuple(iId,velocityValue);
114// vorticityValue[0] += velocityValue[2] * dphii[1] - velocityValue[1] * dphii[2];
115// vorticityValue[1] += velocityValue[0] * dphii[2] - velocityValue[2] * dphii[0];
116// vorticityValue[2] += velocityValue[1] * dphii[0] - velocityValue[0] * dphii[1];
117 if (this->Direction == 0)
118 {
119 vorticityComponent += velocityValue[2] * dphii[1] - velocityValue[1] * dphii[2];
120 }
121 else if (this->Direction == 1)
122 {
123 vorticityComponent += velocityValue[0] * dphii[2] - velocityValue[2] * dphii[0];
124 }
125 else if (this->Direction == 2)
126 {
127 vorticityComponent += velocityValue[1] * dphii[0] - velocityValue[0] * dphii[1];
128 }
129 }
130 for (i=0; i<numberOfCellPoints; i++)
131 {
132 vtkIdType iId = cell->GetPointId(i);
133 phii = feShapeFunctions->GetPhi(q,i);
134// double value0 = jacobian * quadratureWeight * vorticityValue[0] * phii;
135// double value1 = jacobian * quadratureWeight * vorticityValue[1] * phii;
136// double value2 = jacobian * quadratureWeight * vorticityValue[2] * phii;
137 double value = jacobian * quadratureWeight * vorticityComponent * phii;
138// this->RHSVector->AddElement(iId,value0);
139// this->RHSVector->AddElement(iId+numberOfPoints,value1);
140// this->RHSVector->AddElement(iId+2*numberOfPoints,value2);
141 this->RHSVector->AddElement(iId,value);
142 for (j=0; j<numberOfCellPoints; j++)
143 {
144 vtkIdType jId = cell->GetPointId(j);
145 phij = feShapeFunctions->GetPhi(q,j);
146 double value = jacobian * quadratureWeight * phii * phij;
147// this->Matrix->AddElement(iId,jId,value);
148// this->Matrix->AddElement(iId+numberOfPoints,jId+numberOfPoints,value);
149// this->Matrix->AddElement(iId+2*numberOfPoints,jId+2*numberOfPoints,value);
150 this->Matrix->AddElement(iId,jId,value);
151 }
152 }
153 }
154 }
155
156 gaussQuadrature->Delete();
157 feShapeFunctions->Delete();
158}
vtkvmtkSparseMatrix * Matrix
vtkvmtkDoubleVector * RHSVector
void Initialize(int numberOfVariables)
void Initialize(vtkCell *cell, vtkDoubleArray *pcoords)
static vtkvmtkFEShapeFunctions * New()
double GetPhi(vtkIdType id, vtkIdType i)
double * GetDPhi(vtkIdType id, vtkIdType i)
double * GetQuadraturePoint(vtkIdType id)
virtual vtkDoubleArray * GetQuadraturePoints()
static vtkvmtkGaussQuadrature * New()
void Initialize(vtkIdType cellType)
double GetQuadratureWeight(vtkIdType id)
virtual void SetOrder(int)

◆ SetVelocityArrayName()

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

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

◆ GetVelocityArrayName()

virtual char * vtkvmtkUnstructuredGridFEVorticityAssembler::GetVelocityArrayName ( )
virtual

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

◆ SetDirection()

virtual void vtkvmtkUnstructuredGridFEVorticityAssembler::SetDirection ( int )
virtual

Set/Get the coordinate direction (0=x, 1=y, 2=z) of the vorticity component being assembled for.

◆ GetDirection()

virtual int vtkvmtkUnstructuredGridFEVorticityAssembler::GetDirection ( )
virtual

Set/Get the coordinate direction (0=x, 1=y, 2=z) of the vorticity component being assembled for.

Member Data Documentation

◆ VelocityArrayName

char* vtkvmtkUnstructuredGridFEVorticityAssembler::VelocityArrayName
protected

◆ Direction

int vtkvmtkUnstructuredGridFEVorticityAssembler::Direction
protected

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