Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : #ifdef FFTW3_ENABLED 9 : 10 : #pragma once 11 : 12 : #include "GeneralVectorPostprocessor.h" 13 : #include <memory> 14 : 15 : class FourierTransform; 16 : 17 : /** 18 : * Compute the power spectrum from the data of a FourierTransform object. 19 : */ 20 : class FourierPowerSpectrum : public GeneralVectorPostprocessor 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : FourierPowerSpectrum(const InputParameters & parameters); 26 : 27 4 : virtual void initialize() override{}; 28 : virtual void execute() override; 29 : virtual void finalize() override; 30 : 31 : protected: 32 : void computePowerSpectrum(std::vector<int> & c, std::vector<Real> & F, std::size_t i); 33 : 34 : /// Fourier Transform to provide the data 35 : const FourierTransform & _fourier_transform; 36 : 37 : /// mesh dimension 38 : const unsigned int _dim; 39 : 40 : /// grid size for FFT (needs to be signed for FFTW) 41 : const std::vector<int> & _grid; 42 : 43 : /// simulation box extents 44 : const Point _box_size; 45 : 46 : /// FFTW data buffer 47 : const std::vector<double> & _buffer; 48 : 49 : ///{@ power spectrum data 50 : std::size_t _spectrum_size; 51 : Real _max_frequency; 52 : VectorPostprocessorValue & _power_spectrum; 53 : VectorPostprocessorValue & _frequency; 54 : std::vector<int> _n_samples; 55 : ///@} 56 : }; 57 : 58 : #endif // FFTW3_ENABLED