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

Method AllocateOutputData

Filters/Extraction/vtkExtractDataOverTime.cxx:143–182  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

141
142//------------------------------------------------------------------------------
143int vtkExtractDataOverTime::AllocateOutputData(vtkPointSet* input, vtkPointSet* output)
144{
145 // by default vtkPointSetAlgorithm::RequestDataObject already
146 // created an output of the same type as the input
147 if (!output)
148 {
149 vtkErrorMacro("Output not created as expected!");
150 return 0;
151 }
152
153 // 1st the points
154 vtkPoints* points = output->GetPoints();
155 if (!points)
156 {
157 points = vtkPoints::New();
158 output->SetPoints(points);
159 points->Delete();
160 }
161 points->SetNumberOfPoints(this->NumberOfTimeSteps);
162
163 // now the point data
164 output->GetPointData()->CopyAllocate(input->GetPointData(), this->NumberOfTimeSteps);
165
166 // and finally add an array to hold the time at each step
167 vtkDoubleArray* timeArray = vtkDoubleArray::New();
168 timeArray->SetNumberOfComponents(1);
169 timeArray->SetNumberOfTuples(this->NumberOfTimeSteps);
170 if (input->GetPointData()->GetArray("Time"))
171 {
172 timeArray->SetName("TimeData");
173 }
174 else
175 {
176 timeArray->SetName("Time");
177 }
178 output->GetPointData()->AddArray(timeArray);
179 timeArray->Delete();
180
181 return 1;
182}
183VTK_ABI_NAMESPACE_END

Callers 1

ProcessRequestMethod · 0.95

Calls 12

DeleteMethod · 0.65
NewFunction · 0.50
GetPointsMethod · 0.45
SetPointsMethod · 0.45
SetNumberOfPointsMethod · 0.45
CopyAllocateMethod · 0.45
GetPointDataMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetArrayMethod · 0.45
SetNameMethod · 0.45
AddArrayMethod · 0.45

Tested by

no test coverage detected