MCPcopy Create free account
hub / github.com/Kitware/VTK / Initialize

Method Initialize

Filters/FlowPaths/vtkAbstractInterpolatedVelocityField.cxx:84–195  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

82
83//------------------------------------------------------------------------------
84void vtkAbstractInterpolatedVelocityField::Initialize(vtkCompositeDataSet* compDS, int initStrategy)
85{
86 // Clear the datasets info, subclasses may want to put stuff into it.
87 this->DataSetsInfo.clear();
88
89 // See whether the subclass should take over the initialization process.
90 if (this->SelfInitialize())
91 {
92 return;
93 }
94
95 // Proceed to initialize the composite dataset
96 this->InitializationState = initStrategy;
97
98 // Obtain this find cell strategy or create the default one as necessary
99 vtkSmartPointer<vtkFindCellStrategy> strategy = this->FindCellStrategy;
100 vtkFindCellStrategy* strategyClone;
101 if (strategy == nullptr)
102 {
103 strategy = vtkSmartPointer<vtkClosestPointStrategy>::New(); // default strategy if not provided
104 }
105
106 // These are the datasets to process from the input to the filter.
107 auto datasets = vtkCompositeDataSet::GetDataSets(compDS);
108
109 // For each dataset in the list of datasets, make sure a FindCell
110 // strategy has been defined and initialized. The potential for composite
111 // datasets which may contain instances of (vtkPointSet) make the process
112 // more complex. We only care about find cell strategies if the dataset is
113 // a vtkPointSet because the other dataset types (e.g., volumes) have their
114 // own built-in FindCell() methods.
115 vtkDataArray* vectors;
116 for (auto& dataset : datasets)
117 {
118 if (!this->VectorsSelection) // if a selection is not specified,
119 {
120 // use the first one in the point set (this is a behavior for backward compatibility)
121 vectors = dataset->GetPointData()->GetVectors(nullptr);
122 }
123 else
124 {
125 vectors =
126 dataset->GetAttributesAsFieldData(this->VectorsType)->GetArray(this->VectorsSelection);
127 }
128
129 strategyClone = nullptr;
130 if (vtkPointSet::SafeDownCast(dataset))
131 {
132 strategyClone = strategy->NewInstance();
133 }
134 this->AddToDataSetsInfo(dataset, strategyClone, vectors);
135 } // for all datasets of composite dataset
136
137 // Now initialize the new strategies
138 for (auto& datasetInfo : this->DataSetsInfo)
139 {
140 if (auto pointSet = vtkPointSet::SafeDownCast(datasetInfo.DataSet))
141 {

Callers 1

CopyParametersMethod · 0.45

Calls 14

AddToDataSetsInfoMethod · 0.95
SelfInitializeMethod · 0.80
SetPointLocatorMethod · 0.80
SetCellLocatorMethod · 0.80
NewFunction · 0.50
clearMethod · 0.45
GetVectorsMethod · 0.45
GetPointDataMethod · 0.45
GetArrayMethod · 0.45
NewInstanceMethod · 0.45
ComputeBoundsMethod · 0.45

Tested by

no test coverage detected