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

Method Initialize

Filters/General/vtkTableFFT.cxx:209–262  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

207
208//------------------------------------------------------------------------------
209void vtkTableFFT::Initialize(vtkTable* input)
210{
211 // Find time array and compute sample rate
212 const std::size_t nsamples = input->GetNumberOfRows();
213 vtkDataArray* timeArray = nullptr;
214 bool complexColumnFound = false;
215 for (vtkIdType col = 0; col < input->GetNumberOfColumns(); col++)
216 {
217 vtkAbstractArray* column = input->GetColumn(col);
218
219 if (vtksys::SystemTools::Strucmp(column->GetName(), "time") == 0)
220 {
221 timeArray = vtkDataArray::SafeDownCast(input->GetColumn(col));
222 }
223
224 complexColumnFound |= (column->GetNumberOfComponents() == 2);
225 }
226
227 if (this->ReturnOnesided && complexColumnFound)
228 {
229 vtkWarningMacro("ReturnOnesided is True but found columns with 2 components"
230 " (interpreted as imaginary data). Imaginary columns will be ignored.");
231 }
232
233 if (timeArray && timeArray->GetNumberOfTuples() > 1)
234 {
235 double deltaT = timeArray->GetTuple1(1) - timeArray->GetTuple1(0);
236 this->Internals->SampleRate = 1.0 / deltaT;
237 }
238 else
239 {
240 this->Internals->SampleRate = this->DefaultSampleRate;
241 }
242
243 // Check if we can average and compute the size of the windowing function
244 std::size_t nfft = nsamples;
245 if (this->AverageFft)
246 {
247 nfft = std::min(static_cast<std::size_t>(this->BlockSize), nsamples);
248 }
249
250 // Generate windowing function
251 // We're caching the windowing function for more efficiency when applying this filter
252 // on different tables multiple times
253 if (this->Internals->WindowLastUpdated < this->Internals->WindowTimeStamp.GetMTime() ||
254 nfft != this->Internals->Window.size())
255 {
256 this->Internals->UpdateWindow(this->WindowingFunction, nfft);
257 this->Internals->WindowLastUpdated = this->Internals->WindowTimeStamp.GetMTime();
258 }
259
260 // Get output size
261 this->Internals->OutputSize = this->ReturnOnesided ? (nfft / 2) + 1 : nfft;
262}
263
264//------------------------------------------------------------------------------
265vtkSmartPointer<vtkDataArray> vtkTableFFT::DoFFT(vtkDataArray* input)

Callers 15

RequestDataMethod · 0.95
SpiralPointsMethod · 0.45
RequestDataMethod · 0.45
ProcessHTGMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45

Calls 10

GetTuple1Method · 0.80
minFunction · 0.50
GetNumberOfRowsMethod · 0.45
GetNumberOfColumnsMethod · 0.45
GetColumnMethod · 0.45
GetNameMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetMTimeMethod · 0.45
sizeMethod · 0.45

Tested by 15

RequestDataMethod · 0.36
RequestDataMethod · 0.36
PerformTestFunction · 0.36
MakeCubeFunction · 0.36
MakeDodecahedronFunction · 0.36
MakePolyhedralWedgeFunction · 0.36
MakeConcavePolyhedronFunction · 0.36
MakeLagrangeCurveFunction · 0.36
MakeLagrangeTriangleFunction · 0.36