8
8
9
9
#pragma once
10
10
11
+ #include " ComplexTypes.h"
11
12
#include " ElementUserObject.h"
13
+ #include " FFTData.h"
12
14
13
15
template <typename T>
14
16
class FFTBufferBase ;
15
17
16
18
#define usingFFTBufferBaseMembers \
17
19
using ElementUserObject::_perf_graph; \
18
20
using FFTBufferBase<T>::_dim; \
19
- using FFTBufferBase<T>::_grid; \
20
- using FFTBufferBase<T>::_buffer; \
21
- using FFTBufferBase<T>::_start; \
22
- using FFTBufferBase<T>::_stride; \
21
+ using FFTBufferBase<T>::_real_space_grid; \
22
+ using FFTBufferBase<T>::_reciprocal_space_grid; \
23
+ using FFTBufferBase<T>::_real_space_data; \
24
+ using FFTBufferBase<T>::_reciprocal_space_data; \
25
+ using FFTBufferBase<T>::_real_space_data_start; \
26
+ using FFTBufferBase<T>::_reciprocal_space_data_start; \
27
+ using FFTBufferBase<T>::_real_space_data_stride; \
28
+ using FFTBufferBase<T>::_reciprocal_space_data_stride; \
23
29
using FFTBufferBase<T>::_how_many
24
30
25
31
/* *
@@ -28,6 +34,8 @@ class FFTBufferBase;
28
34
template <typename T>
29
35
class FFTBufferBase : public ElementUserObject
30
36
{
37
+ using ComplexT = typename ComplexType<T>::type;
38
+
31
39
public:
32
40
static InputParameters validParams ();
33
41
@@ -43,31 +51,20 @@ class FFTBufferBase : public ElementUserObject
43
51
virtual void backward () = 0;
44
52
// /@}
45
53
46
- // /@{ data access by index
47
- const T & operator [](std::size_t i) const { return _buffer[i]; }
48
- T & operator [](std::size_t i) { return _buffer[i]; }
49
- // /@}
54
+ // /@{ buffer access
55
+ FFTData<T> & realSpace () { return _real_space_data; }
56
+ FFTData<ComplexT> & reciprocalSpace () { return _reciprocal_space_data; }
57
+ const FFTData<T> & realSpace () const { return _real_space_data; }
58
+ const FFTData<ComplexT> & reciprocalSpace () const { return _reciprocal_space_data; }
50
59
51
- // /@{ data access by location
60
+ // /@{ real space data access by location
52
61
const T & operator ()(const Point & p) const ;
53
62
T & operator ()(const Point & p);
54
63
// /@}
55
64
56
- // /@{ convenience math operators
57
- FFTBufferBase<T> & operator +=(FFTBufferBase<T> const & rhs);
58
- FFTBufferBase<T> & operator -=(FFTBufferBase<T> const & rhs);
59
- FFTBufferBase<T> & operator *=(FFTBufferBase<Real> const & rhs);
60
- FFTBufferBase<T> & operator /=(FFTBufferBase<Real> const & rhs);
61
- FFTBufferBase<T> & operator *=(Real rhs);
62
- FFTBufferBase<T> & operator /=(Real rhs);
63
- // /@}
64
-
65
65
// / return the number of grid cells along each dimension without padding
66
66
const std::vector<int > & grid () const { return _grid; }
67
67
68
- // / return the number of proper grid cells without padding
69
- const std::size_t & size () const { return _grid_size; }
70
-
71
68
// / return the buffer dimension
72
69
const unsigned int & dim () const { return _dim; }
73
70
@@ -79,12 +76,6 @@ class FFTBufferBase : public ElementUserObject
79
76
}
80
77
81
78
protected:
82
- // / get the addres of the first data element of the ith object in the bufefr
83
- Real * start (std::size_t i);
84
-
85
- // / get the number of transforms required for type T
86
- std::size_t howMany () const ;
87
-
88
79
// /@{ mesh data
89
80
MooseMesh & _mesh;
90
81
unsigned int _dim;
@@ -103,15 +94,17 @@ class FFTBufferBase : public ElementUserObject
103
94
Real _cell_volume;
104
95
105
96
// /@{ FFT data buffer and unpadded number of grid cells
106
- std::vector <T> _buffer ;
107
- std:: size_t _grid_size ;
97
+ FFTData <T> _real_space_data ;
98
+ FFTData<ComplexT> _reciprocal_space_data ;
108
99
// /@}
109
100
110
101
// / pointer to the start of the data
111
- Real * _start;
102
+ Real * _real_space_data_start;
103
+ Complex * _reciprocal_space_data_start;
112
104
113
105
// / stride in units of double size
114
- std::ptrdiff_t _stride;
106
+ std::ptrdiff_t _real_space_data_stride;
107
+ std::ptrdiff_t _reciprocal_space_data_stride;
115
108
116
109
// / optional moose sister variabe (to obtain IC from)
117
110
std::vector<const VariableValue *> _moose_variable;
0 commit comments