3#ifndef HDFTestUtilities_h
4#define HDFTestUtilities_h
39 this->Descriptors = descriptors;
41 void SetMasks(
const std::vector<std::string>& masks) { this->Masks = masks; }
44 this->Dimensions = dimensions;
65 std::vector<double> timeSteps(this->Descriptors.size());
66 std::iota(timeSteps.begin(), timeSteps.end(), 0);
67 double timeRange[2] = { timeSteps.front(), timeSteps.back() };
69 static_cast<int>(timeSteps.size()));
71 static_cast<int>(
sizeof(timeRange) /
sizeof(timeRange[0])));
79 intSource->SetDimensions(3, 3, 2);
80 intSource->SetBranchFactor(2);
81 intSource->SetMaxDepth(4);
82 intSource->SetUseMask(!this->Masks.empty());
83 intSource->SetDimensions(this->Dimensions.data());
84 intSource->SetBranchFactor(BranchFactor);
85 if (intSource->GetUseMask())
87 intSource->SetMask(this->Masks.at(
static_cast<int>(this->RequestedTime)).c_str());
90 intSource->SetDescriptor(this->Descriptors.at(
static_cast<int>(this->RequestedTime)).c_str());
114 if (outInfo->
Has(vtkSDDP::UPDATE_PIECE_NUMBER()))
116 intSource->UpdatePiece(outInfo->
Get(vtkSDDP::UPDATE_PIECE_NUMBER()),
117 outInfo->
Get(vtkSDDP::UPDATE_NUMBER_OF_PIECES()), 0);
124 output->ShallowCopy(intSource->GetOutputDataObject(0));
133 std::vector<std::string> Descriptors;
134 std::vector<std::string> Masks;
135 std::array<unsigned int, 3> Dimensions;
136 unsigned int BranchFactor = 2;
138 double RequestedTime = 0.0;
155 this->IntCols.insert({ name, values });
160 this->DoubleCols.insert({ name, values });
180 std::vector<double> timeSteps(this->IntCols.begin()->second.size());
181 std::iota(timeSteps.begin(), timeSteps.end(), 0);
182 double timeRange[2] = { timeSteps.front(), timeSteps.back() };
184 static_cast<int>(timeSteps.size()));
186 static_cast<int>(
sizeof(timeRange) /
sizeof(timeRange[0])));
201 for (
const auto& it : IntCols)
204 arr->SetName(it.first.c_str());
205 arr->SetNumberOfTuples(it.second.at(RequestedTime).size());
206 for (
int i = 0; i < arr->GetNumberOfTuples(); i++)
208 arr->SetValue(i, it.second.at(RequestedTime).at(i));
210 output->AddColumn(arr);
213 for (
const auto& it : DoubleCols)
216 arr->SetName(it.first.c_str());
217 arr->SetNumberOfTuples(it.second.at(RequestedTime).size());
218 for (
int i = 0; i < arr->GetNumberOfTuples(); i++)
220 arr->SetValue(i, it.second.at(RequestedTime).at(i));
222 output->AddColumn(arr);
232 std::map<std::string, std::vector<std::vector<int>>> IntCols;
233 std::map<std::string, std::vector<std::vector<double>>> DoubleCols;
Custom source to generate time-dependent HTG.
vtkHTGChangingDescriptorSource()
static vtkHTGChangingDescriptorSource * New()
void SetDimensions(const std::array< unsigned int, 3 > &dimensions)
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) override
void SetMasks(const std::vector< std::string > &masks)
int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *) override
Main routine to process individual trees in the grid This is pure virtual method to be implemented by...
void SetBranchFactor(const unsigned int bf)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) override
This is called by the superclass.
void SetDescriptors(const std::vector< std::string > &descriptors)
int FillOutputPortInformation(int, vtkInformation *info) override
Custom source to generate time-dependent vtkTable.
int FillOutputPortInformation(int, vtkInformation *info) override
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) override
This is called by the superclass.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) override
void AddTemporalColumn(const std::string &name, const std::vector< std::vector< double > > &values)
static vtkTemporalTableSource * New()
void AddTemporalColumn(const std::string &name, const std::vector< std::vector< int > > &values)
general representation of visualization data
vtkHyperTreeGridAlgorithm()
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
static vtkHyperTreeGrid * SafeDownCast(vtkObjectBase *o)
Allocate and hold a VTK object.
Executive supporting partial updates.
static vtkTable * SafeDownCast(vtkObjectBase *o)
virtual void SetNumberOfOutputPorts(int n)
Set the number of output ports provided by the algorithm.
virtual void SetNumberOfInputPorts(int n)
Set the number of input ports used by the algorithm.