1
/*=========================================================================
3
Program: Visualization Toolkit
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
14
=========================================================================*/
15
#include "vtkUnstructuredGridToReebGraphFilter.h"
17
#include "vtkElevationFilter.h"
18
#include "vtkInformation.h"
19
#include "vtkInformationVector.h"
20
#include "vtkObjectFactory.h"
21
#include "vtkPointData.h"
22
#include "vtkReebGraph.h"
23
#include "vtkUnstructuredGrid.h"
25
vtkStandardNewMacro(vtkUnstructuredGridToReebGraphFilter);
27
//----------------------------------------------------------------------------
28
vtkUnstructuredGridToReebGraphFilter::vtkUnstructuredGridToReebGraphFilter()
31
this->SetNumberOfInputPorts(1);
34
//----------------------------------------------------------------------------
35
vtkUnstructuredGridToReebGraphFilter::~vtkUnstructuredGridToReebGraphFilter()
39
//----------------------------------------------------------------------------
40
int vtkUnstructuredGridToReebGraphFilter::FillInputPortInformation( int vtkNotUsed(portNumber), vtkInformation *info)
42
info->Remove(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE());
43
info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGrid");
47
//----------------------------------------------------------------------------
48
int vtkUnstructuredGridToReebGraphFilter::FillOutputPortInformation(
49
int, vtkInformation *info)
51
info->Set(vtkDirectedGraph::DATA_TYPE_NAME(), "vtkReebGraph");
55
//----------------------------------------------------------------------------
56
void vtkUnstructuredGridToReebGraphFilter::PrintSelf(ostream& os, vtkIndent indent)
58
this->Superclass::PrintSelf(os,indent);
59
os << indent << "Field Id: " << this->FieldId << "\n";
62
//----------------------------------------------------------------------------
63
vtkReebGraph* vtkUnstructuredGridToReebGraphFilter::GetOutput()
65
return vtkReebGraph::SafeDownCast(this->GetOutputDataObject(0));
68
//----------------------------------------------------------------------------
69
int vtkUnstructuredGridToReebGraphFilter::RequestData(vtkInformation*,
70
vtkInformationVector** inputVector,
71
vtkInformationVector* outputVector)
74
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
76
vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
77
inInfo->Get(vtkUnstructuredGrid::DATA_OBJECT()));
79
vtkInformation *outInfo = outputVector->GetInformationObject(0);
80
vtkReebGraph *output = vtkReebGraph::SafeDownCast(
81
outInfo->Get(vtkReebGraph::DATA_OBJECT()));
83
// check for the presence of a scalar field
84
vtkDataArray *scalarField = input->GetPointData()->GetArray(FieldId);
87
vtkElevationFilter* eFilter = vtkElevationFilter::New();
88
eFilter->SetInputData(input);
90
output->Build(vtkUnstructuredGrid::SafeDownCast(eFilter->GetOutput()),
96
output->Build(input, FieldId);