Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::LibUtilities::NekFFTW Class Reference

#include <NekFFTW.h>

Inheritance diagram for Nektar::LibUtilities::NekFFTW:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::NekFFTW:
Collaboration graph
[legend]

Public Member Functions

 NekFFTW (int N)
virtual ~NekFFTW ()
virtual void v_FFTFwdTrans (Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_FFTBwdTrans (Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
- Public Member Functions inherited from Nektar::LibUtilities::NektarFFT
 NektarFFT (int N)
 Initialises NektarFFT class members.
 ~NektarFFT ()
void FFTFwdTrans (Array< OneD, NekDouble > &phy, Array< OneD, NekDouble > &coef)
void FFTBwdTrans (Array< OneD, NekDouble > &coef, Array< OneD, NekDouble > &phys)

Static Public Member Functions

static NektarFFTSharedPtr create (int N)
 Creates an instance of this class.

Static Public Attributes

static std::string className
 Name of class.

Protected Member Functions

void Reshuffle_FFTW2Nek (Array< OneD, NekDouble > &coef)
void Reshuffle_Nek2FFTW (Array< OneD, NekDouble > &coef)

Protected Attributes

Array< OneD, NekDoublem_FFTW_w
Array< OneD, NekDoublem_FFTW_w_inv
Array< OneD, NekDoublephys
Array< OneD, NekDoublecoef
Array< OneD, NekDoublem_wsp
fftw_plan plan_backward
fftw_plan plan_forward

Additional Inherited Members

- Public Attributes inherited from Nektar::LibUtilities::NektarFFT
int m_N

Detailed Description

Definition at line 61 of file NekFFTW.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::NekFFTW::NekFFTW ( int  N)

Definition at line 48 of file NekFFTW.cpp.

References coef, m_FFTW_w, m_FFTW_w_inv, Nektar::LibUtilities::NektarFFT::m_N, m_wsp, phys, plan_backward, and plan_forward.

: NektarFFT(N)
{
m_wsp = Array<OneD, NekDouble>(m_N);
phys = Array<OneD,NekDouble>(m_N);
coef = Array<OneD,NekDouble>(m_N);
plan_forward = fftw_plan_r2r_1d(m_N, &phys[0], &coef[0],
FFTW_R2HC, FFTW_ESTIMATE);
plan_backward = fftw_plan_r2r_1d(m_N, &coef[0], &phys[0],
FFTW_HC2R, FFTW_ESTIMATE);
m_FFTW_w = Array<OneD,NekDouble>(m_N);
m_FFTW_w_inv = Array<OneD,NekDouble>(m_N);
m_FFTW_w[0] = 1.0/(NekDouble)m_N;
m_FFTW_w[1] = 0.0;
m_FFTW_w_inv[0] = m_N;
m_FFTW_w_inv[1] = 0.0;
for(int i=2;i<m_N;i++)
{
m_FFTW_w[i] = m_FFTW_w[0];
m_FFTW_w_inv[i] = m_FFTW_w_inv[0];
}
}
Nektar::LibUtilities::NekFFTW::~NekFFTW ( )
virtual

Definition at line 77 of file NekFFTW.cpp.

{
}

Member Function Documentation

static NektarFFTSharedPtr Nektar::LibUtilities::NekFFTW::create ( int  N)
inlinestatic

Creates an instance of this class.

Definition at line 66 of file NekFFTW.h.

{
return MemoryManager<NekFFTW>::AllocateSharedPtr(N);
}
void Nektar::LibUtilities::NekFFTW::Reshuffle_FFTW2Nek ( Array< OneD, NekDouble > &  coef)
protected

Reshuffling routines to put the coefficients in Nektar++/FFTW format. The routines take as an input the number of points N, the vector of coeffcients and the vector containing the weights of the numerical integration. The routines modify directly the coef vector.

Definition at line 111 of file NekFFTW.cpp.

References m_FFTW_w, Nektar::LibUtilities::NektarFFT::m_N, m_wsp, Vmath::Vcopy(), and Vmath::Vmul().

Referenced by v_FFTFwdTrans().

{
int halfN = m_N/2;
m_wsp[1] = coef[halfN];
Vmath::Vcopy(halfN, coef, 1, m_wsp, 2);
for(int i = 0; i < (halfN - 1); i++)
{
m_wsp[(m_N-1)-2*i] = coef[halfN+1+i];
}
return;
}
void Nektar::LibUtilities::NekFFTW::Reshuffle_Nek2FFTW ( Array< OneD, NekDouble > &  coef)
protected

Definition at line 130 of file NekFFTW.cpp.

References m_FFTW_w_inv, Nektar::LibUtilities::NektarFFT::m_N, m_wsp, Vmath::Smul(), Vmath::Vcopy(), and Vmath::Vmul().

Referenced by v_FFTBwdTrans().

{
int halfN = m_N/2;
m_wsp[halfN] = coef[1];
Vmath::Vcopy(halfN, coef, 2, m_wsp, 1);
for(int i = 0; i < (halfN-1); i++)
{
m_wsp[halfN+1+i] = coef[(m_N-1)-2*i];
}
Vmath::Smul(m_N, 1.0/m_N, m_wsp, 1, coef, 1);
return;
}
void Nektar::LibUtilities::NekFFTW::v_FFTBwdTrans ( Array< OneD, NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray 
)
virtual

Reimplemented from Nektar::LibUtilities::NektarFFT.

Definition at line 97 of file NekFFTW.cpp.

References coef, Nektar::LibUtilities::NektarFFT::m_N, phys, plan_backward, Reshuffle_Nek2FFTW(), and Vmath::Vcopy().

{
Vmath::Vcopy(m_N, inarray, 1, coef, 1);
fftw_execute(plan_backward);
Vmath::Vcopy(m_N, phys, 1, outarray, 1);
}
void Nektar::LibUtilities::NekFFTW::v_FFTFwdTrans ( Array< OneD, NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray 
)
virtual

Reimplemented from Nektar::LibUtilities::NektarFFT.

Definition at line 83 of file NekFFTW.cpp.

References coef, Nektar::LibUtilities::NektarFFT::m_N, phys, plan_forward, Reshuffle_FFTW2Nek(), and Vmath::Vcopy().

{
Vmath::Vcopy(m_N, inarray, 1, phys, 1);
fftw_execute(plan_forward);
Vmath::Vcopy(m_N, coef, 1, outarray, 1);
}

Member Data Documentation

string Nektar::LibUtilities::NekFFTW::className
static
Initial value:

Name of class.

Definition at line 72 of file NekFFTW.h.

Array<OneD,NekDouble> Nektar::LibUtilities::NekFFTW::coef
protected

Definition at line 94 of file NekFFTW.h.

Referenced by NekFFTW(), v_FFTBwdTrans(), and v_FFTFwdTrans().

Array<OneD,NekDouble> Nektar::LibUtilities::NekFFTW::m_FFTW_w
protected

Definition at line 90 of file NekFFTW.h.

Referenced by NekFFTW(), and Reshuffle_FFTW2Nek().

Array<OneD,NekDouble> Nektar::LibUtilities::NekFFTW::m_FFTW_w_inv
protected

Definition at line 91 of file NekFFTW.h.

Referenced by NekFFTW(), and Reshuffle_Nek2FFTW().

Array<OneD,NekDouble> Nektar::LibUtilities::NekFFTW::m_wsp
protected

Definition at line 96 of file NekFFTW.h.

Referenced by NekFFTW(), Reshuffle_FFTW2Nek(), and Reshuffle_Nek2FFTW().

Array<OneD,NekDouble> Nektar::LibUtilities::NekFFTW::phys
protected

Definition at line 93 of file NekFFTW.h.

Referenced by NekFFTW(), v_FFTBwdTrans(), and v_FFTFwdTrans().

fftw_plan Nektar::LibUtilities::NekFFTW::plan_backward
protected

Definition at line 98 of file NekFFTW.h.

Referenced by NekFFTW(), and v_FFTBwdTrans().

fftw_plan Nektar::LibUtilities::NekFFTW::plan_forward
protected

Definition at line 99 of file NekFFTW.h.

Referenced by NekFFTW(), and v_FFTFwdTrans().