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 "GeneralPostprocessor.h" 13 : 14 : #include <memory> 15 : 16 : class FourierTransform; 17 : 18 : /** 19 : * Compute the average length scale form a fast fourier transform 20 : */ 21 : class FourierLengthScale : public GeneralPostprocessor 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : FourierLengthScale(const InputParameters & parameters); 27 : 28 8 : virtual void initialize() override{}; 29 : virtual void execute() override; 30 : virtual void finalize() override; 31 : 32 : using Postprocessor::getValue; 33 8 : virtual PostprocessorValue getValue() const override { return _length_scale; } 34 : 35 : protected: 36 : void computeLengthScale(std::vector<int> & c, std::vector<Real> & F, std::size_t i); 37 : 38 : /// Fourier Transform to provide the data 39 : const FourierTransform & _fourier_transform; 40 : 41 : /// mesh dimension 42 : const unsigned int _dim; 43 : 44 : /// grid size for FFT (needs to be signed for FFTW) 45 : const std::vector<int> & _grid; 46 : 47 : /// simulation box extents 48 : const Point _box_size; 49 : 50 : /// FFTW data buffer 51 : const std::vector<double> & _buffer; 52 : 53 : /// length scale computed from the fourier transform 54 : PostprocessorValue _length_scale; 55 : 56 : /// averaging weight 57 : Real _weight_sum; 58 : 59 : /// index variable for recursive buffer traversal 60 : std::size_t _index; 61 : }; 62 : 63 : #endif // FFTW3_ENABLED