Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
FftwReal2dDftData< F > Class Template Reference

#include <FftwReal2dDftData.h>

Inheritance diagram for FftwReal2dDftData< F >:
Real2dDftData< F >

Public Types

using IndexArrayVector = std::vector< IndexArray >
 
using ComplexVector = std::vector< Complex >
 
- Public Types inherited from Real2dDftData< F >
using Float = F
 
using Index = unsigned int
 
using IndexArray = std::array< Index, 2 >
 
using Norm = RealDftNormalization
 
using Complex = std::complex< Float >
 

Public Member Functions

 FftwReal2dDftData (Norm norm, const IndexArray &nsams)
 
Norm normalization () const override
 
Index rank () const
 
void clear () override
 
void reset (const IndexArray &nsams) override
 
const IndexArraynSamples () const override
 
Index size () const
 
Index nSamples (Index idim) const
 
Index size (Index idim) const
 
Complexdata ()
 
const Complexdata () const
 
FloatfloatData ()
 
const FloatfloatData () const
 
Index globalIndex (const IndexArray &ifrqs) const
 
IndexArrayVector indexArrays (Index idat) const
 
Complex value (Index idat) const
 
Complex value (const IndexArray &isams) const override
 
int moveIn (const IndexArray nsams, ComplexVector &data)
 
int copyIn (const IndexArray nsams, const ComplexVector &data)
 
int moveOut (ComplexVector &data)
 
int copyOut (ComplexVector &data) const
 
- Public Member Functions inherited from Real2dDftData< F >
virtual ~Real2dDftData ()=default
 
Index rank () const
 
virtual Index nSample (Index idim) const
 
Index size (Index idim) const
 
bool inRange (Index idim, Index ifrq) const
 
bool isZero (Index ifrq) const
 
bool isNyquist (Index idim, Index ifrq) const
 
virtual bool isValid () const
 
Complex badValue () const
 
virtual F power (const IndexArray &ifrqs) const
 
virtual F amplitude (const IndexArray &ifrqs) const
 
virtual F phase (const IndexArray &ifrqs) const
 
virtual F real (const IndexArray &ifrqs) const
 
virtual F imag (const IndexArray &ifrqs) const
 
power () const
 

Static Public Member Functions

template<std::size_t N>
static Index dftComplexDataSize (const std::array< Index, N > &nsams)
 
template<std::size_t N>
static Index dftFloatDataSize (const std::array< Index, N > &nsams)
 
- Static Public Member Functions inherited from Real2dDftData< F >
template<std::size_t N>
static Index dataSize (const std::array< Index, N > &nsams)
 

Private Attributes

Norm m_norm
 
IndexArray m_nsams
 
ComplexVector m_data
 

Detailed Description

template<typename F>
class FftwReal2dDftData< F >

Definition at line 23 of file FftwReal2dDftData.h.

Member Typedef Documentation

template<typename F >
using FftwReal2dDftData< F >::ComplexVector = std::vector<Complex>

Definition at line 39 of file FftwReal2dDftData.h.

template<typename F >
using FftwReal2dDftData< F >::IndexArrayVector = std::vector<IndexArray>

Definition at line 36 of file FftwReal2dDftData.h.

Constructor & Destructor Documentation

template<typename F >
FftwReal2dDftData< F >::FftwReal2dDftData ( Norm  norm,
const IndexArray nsams 
)
inline

Definition at line 64 of file FftwReal2dDftData.h.

65  : m_norm(norm) {
66  reset(nsams);
67  }
void reset(const IndexArray &nsams) override
auto norm(Vector const &v)
Return norm of the specified vector.

Member Function Documentation

template<typename F >
void FftwReal2dDftData< F >::clear ( )
inlineoverridevirtual

Implements Real2dDftData< F >.

Definition at line 76 of file FftwReal2dDftData.h.

76  {
77  for ( Index& nsam : m_nsams ) nsam = 0;
78  m_data.clear();
79  }
unsigned int Index
ComplexVector m_data
template<typename F >
int FftwReal2dDftData< F >::copyIn ( const IndexArray  nsams,
const ComplexVector data 
)
inline

Definition at line 172 of file FftwReal2dDftData.h.

172  {
173  m_nsams = nsams;
174  m_data = data;
175  return 0;
176  }
ComplexVector m_data
template<typename F >
int FftwReal2dDftData< F >::copyOut ( ComplexVector data) const
inline

Definition at line 186 of file FftwReal2dDftData.h.

186  {
187  data = m_data;
188  return 0;
189  }
ComplexVector m_data
template<typename F >
Complex* FftwReal2dDftData< F >::data ( )
inline

Definition at line 101 of file FftwReal2dDftData.h.

101 { return m_data.data(); }
ComplexVector m_data
template<typename F >
const Complex* FftwReal2dDftData< F >::data ( ) const
inline

Definition at line 102 of file FftwReal2dDftData.h.

102 { return m_data.data(); }
ComplexVector m_data
template<typename F >
template<std::size_t N>
static Index FftwReal2dDftData< F >::dftComplexDataSize ( const std::array< Index, N > &  nsams)
inlinestatic

Definition at line 45 of file FftwReal2dDftData.h.

45  {
46  Index ndat = 1;
47  Index ndim = nsams.size();
48  for ( Index idim=0; idim<ndim; ++idim ) {
49  Index nsam = nsams[idim];
50  Index fac = idim == ndim - 1 ? nsam/2 + 1 : nsam;
51  ndat *= fac;
52  }
53  return ndat;
54  }
unsigned int Index
template<typename F >
template<std::size_t N>
static Index FftwReal2dDftData< F >::dftFloatDataSize ( const std::array< Index, N > &  nsams)
inlinestatic

Definition at line 59 of file FftwReal2dDftData.h.

59  {
60  return 2*dftComplexDataSize(nsams);
61  }
static Index dftComplexDataSize(const std::array< Index, N > &nsams)
template<typename F >
Float* FftwReal2dDftData< F >::floatData ( )
inline

Definition at line 105 of file FftwReal2dDftData.h.

105 { return reinterpret_cast<Float*>(m_data.data()); }
ComplexVector m_data
DftData::Float Float
template<typename F >
const Float* FftwReal2dDftData< F >::floatData ( ) const
inline

Definition at line 106 of file FftwReal2dDftData.h.

106 { return reinterpret_cast<const Float*>(m_data.data()); }
ComplexVector m_data
DftData::Float Float
template<typename F >
Index FftwReal2dDftData< F >::globalIndex ( const IndexArray ifrqs) const
inline

Definition at line 110 of file FftwReal2dDftData.h.

110  {
111  Index ifrq0 = ifrqs[0];
112  Index ifrq1 = ifrqs[1];
113  Index nfrq0 = m_nsams[0];
114  Index nfrq1 = m_nsams[1];
115  Index n1 = nfrq1/2 + 1;
116  if ( ifrq0 >= nfrq0 ) {
117  return size();
118  }
119  if ( ifrq1 >= nfrq1 ) {
120  return size();
121  }
122  if ( ifrq1 >= n1 ) {
123  if ( ifrq0 > 0 ) ifrq0 = nfrq0 - ifrq0;
124  ifrq1 = nfrq1 - ifrq1;
125  }
126  return n1*ifrq0 + ifrq1;
127  }
unsigned int Index
Index size() const
template<typename F >
IndexArrayVector FftwReal2dDftData< F >::indexArrays ( Index  idat) const
inline

Definition at line 132 of file FftwReal2dDftData.h.

132  {
133  IndexArrayVector arrs;
134  Index nfrq0 = m_nsams[0];
135  Index nfrq1 = m_nsams[1];
136  Index n1 = nfrq1/2 + 1;
137  Index ifrq0 = idat/n1;
138  if ( ifrq0 >= nfrq0 ) return arrs;
139  Index ifrq1 = idat%n1;
140  arrs.push_back(IndexArray({ifrq0, ifrq1}));
141  Index jfrq0 = ifrq0 > 0 ? nfrq0 - ifrq0 : 0;
142  if ( ifrq1 == 0 ) return arrs;
143  Index jfrq1 = nfrq1 - ifrq1;
144  if ( jfrq1 == ifrq1 ) return arrs;
145  arrs.push_back(IndexArray({jfrq0, jfrq1}));
146  return arrs;
147  }
std::array< Index, 2 > IndexArray
Definition: Real2dDftData.h:27
DftData::IndexArrayVector IndexArrayVector
unsigned int Index
template<typename F >
int FftwReal2dDftData< F >::moveIn ( const IndexArray  nsams,
ComplexVector data 
)
inline

Definition at line 165 of file FftwReal2dDftData.h.

165  {
166  m_nsams = nsams;
167  m_data = std::move(data);
168  return 0;
169  }
ComplexVector m_data
def move(depos, offset)
Definition: depos.py:107
template<typename F >
int FftwReal2dDftData< F >::moveOut ( ComplexVector data)
inline

Definition at line 179 of file FftwReal2dDftData.h.

179  {
180  data = m_data;
181  clear();
182  return 0;
183  }
void clear() override
ComplexVector m_data
template<typename F >
Norm FftwReal2dDftData< F >::normalization ( ) const
inlineoverridevirtual

Implements Real2dDftData< F >.

Definition at line 70 of file FftwReal2dDftData.h.

70 { return m_norm; }
template<typename F >
const IndexArray& FftwReal2dDftData< F >::nSamples ( ) const
inlineoverridevirtual

Implements Real2dDftData< F >.

Definition at line 90 of file FftwReal2dDftData.h.

90  {
91  return m_nsams;
92  }
template<typename F >
Index FftwReal2dDftData< F >::nSamples ( Index  idim) const
inline

Definition at line 94 of file FftwReal2dDftData.h.

94  {
95  if ( idim > rank() ) return 0;
96  return nSamples()[idim];
97  }
Index rank() const
const IndexArray & nSamples() const override
template<typename F >
Index FftwReal2dDftData< F >::rank ( ) const
inline

Definition at line 73 of file FftwReal2dDftData.h.

73 { return 2; }
template<typename F >
void FftwReal2dDftData< F >::reset ( const IndexArray nsams)
inlineoverridevirtual

Implements Real2dDftData< F >.

Definition at line 82 of file FftwReal2dDftData.h.

82  {
83  clear();
84  m_nsams = nsams;
85  Index ndat = dftComplexDataSize(nsams);
86  m_data.resize(ndat, 0.0);
87  }
void clear() override
unsigned int Index
static Index dftComplexDataSize(const std::array< Index, N > &nsams)
ComplexVector m_data
template<typename F >
Index FftwReal2dDftData< F >::size ( ) const
inline

Definition at line 93 of file FftwReal2dDftData.h.

93 { return m_data.size(); }
ComplexVector m_data
template<typename F >
Index FftwReal2dDftData< F >::size ( Index  idim) const
inline

Definition at line 98 of file FftwReal2dDftData.h.

98 { return nSamples(idim); }
const IndexArray & nSamples() const override
template<typename F >
Complex FftwReal2dDftData< F >::value ( Index  idat) const
inline

Definition at line 150 of file FftwReal2dDftData.h.

150  {
151  if ( idat >= size() ) return this->badValue();
152  return m_data[idat];
153  }
ComplexVector m_data
Index size() const
Complex badValue() const
Definition: Real2dDftData.h:83
template<typename F >
Complex FftwReal2dDftData< F >::value ( const IndexArray isams) const
inlineoverridevirtual

Implements Real2dDftData< F >.

Definition at line 159 of file FftwReal2dDftData.h.

159  {
160  Index idat = globalIndex(isams);
161  return value(idat);
162  }
unsigned int Index
Index globalIndex(const IndexArray &ifrqs) const
Complex value(Index idat) const

Member Data Documentation

template<typename F >
ComplexVector FftwReal2dDftData< F >::m_data
private

Definition at line 196 of file FftwReal2dDftData.h.

template<typename F >
Norm FftwReal2dDftData< F >::m_norm
private

Definition at line 194 of file FftwReal2dDftData.h.

template<typename F >
IndexArray FftwReal2dDftData< F >::m_nsams
private

Definition at line 195 of file FftwReal2dDftData.h.


The documentation for this class was generated from the following file: