-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExamplePlugin.cpp
43 lines (34 loc) · 1.12 KB
/
ExamplePlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "ExamplePlugin.h"
#include <vtkFieldData.h>
#include <vtkInformationVector.h>
#include <vtkInformation.h>
#include <vtkObjectFactory.h>
#include <vtkSmartPointer.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkIntArray.h>
#include <vtkUnstructuredGrid.h>
vtkStandardNewMacro(ExamplePlugin);
ExamplePlugin::ExamplePlugin()
{
this->SetNumberOfInputPorts(1);
this->SetNumberOfOutputPorts(1);
}
ExamplePlugin::~ExamplePlugin() = default;
int ExamplePlugin::RequestData(vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
auto input = vtkUnstructuredGrid::GetData(inputVector[0],0);
auto output = vtkUnstructuredGrid::GetData(outputVector,0);
output->ShallowCopy(input);
auto array = vtkSmartPointer<vtkIntArray>::New();
array->SetNumberOfValues(1);
array->SetValue(0, 42);
array->SetName("Answer");
output->GetFieldData()->AddArray(array);
return 1;
}
void ExamplePlugin::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}