AccFFT
Functions
operators.cpp File Reference
#include <mpi.h>
#include <omp.h>
#include <iostream>
#include <cmath>
#include <math.h>
#include <string.h>
#include <accfft.h>
#include <../src/operators.txx>
#include <pnetcdf.h>
#include <cstdlib>
#include <string>

Functions

void accfft_grad (double *A_x, double *A_y, double *A_z, double *A, accfft_plan *plan, std::bitset< 3 > *pXYZ, double *timer)
 
void accfft_laplace (double *LA, double *A, accfft_plan *plan, double *timer)
 
void accfft_divergence (double *divA, double *A_x, double *A_y, double *A_z, accfft_plan *plan, double *timer)
 
void accfft_biharmonic (double *BA, double *A, accfft_plan *plan, double *timer)
 
void accfft_inv_laplace (double *invLA, double *A, accfft_plan *plan, double *timer)
 
void accfft_inv_biharmonic (double *invBA, double *A, accfft_plan *plan, double *timer)
 
void read_pnetcdf (const std::string &filename, MPI_Offset starts[3], MPI_Offset counts[3], int gsizes[3], double *localData)
 
void write_pnetcdf (const std::string &filename, MPI_Offset starts[3], MPI_Offset counts[3], int gsizes[3], double *localData)
 

Detailed Description

CPU functions of AccFFT operators

Function Documentation

void accfft_biharmonic ( double *  BA,
double *  A,
accfft_plan *  plan,
double *  timer 
)

Computes double precision biharmonic of its input real data A, and writes the output into LA.

Parameters
BA$\Delta^2 A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_divergence ( double *  divA,
double *  A_x,
double *  A_y,
double *  A_z,
accfft_plan *  plan,
double *  timer 
)

Computes double precision divergence of its input vector data A_x, A_y, and A_x. The output data is written to divA.

Parameters
divA$\nabla\cdot(A_x i + A_y j+ A_z k)$
A_xThe x component of $\nabla A$
A_yThe y component of $\nabla A$
A_zThe z component of $\nabla A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_grad ( double *  A_x,
double *  A_y,
double *  A_z,
double *  A,
accfft_plan *  plan,
std::bitset< 3 > *  pXYZ,
double *  timer 
)

Computes double precision gradient of its input real data A, and returns the x, y, and z components and writes the output into A_x, A_y, and A_z respectively.

Parameters
A_xThe x component of $\nabla A$
A_yThe y component of $\nabla A$
A_zThe z component of $\nabla A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
pXYZa bit set pointer field of size 3 that determines which gradient components are needed. If XYZ={111} then all the components are computed and if XYZ={100}, then only the x component is computed. This can save the user some time, when just one or two of the gradient components are needed.
timerSee Timing AccFFT for more details.
void accfft_inv_biharmonic ( double *  invBA,
double *  A,
accfft_plan *  plan,
double *  timer 
)

Computes double precision inverse biharmonic of its input real data A, and writes the output into invBA.

Parameters
invBA$\Delta^{-2} A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_inv_laplace ( double *  invLA,
double *  A,
accfft_plan *  plan,
double *  timer 
)

Computes double precision inverse Laplacian of its input real data A, and writes the output into invLA.

Parameters
invLA$\Delta^{-1} A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_laplace ( double *  LA,
double *  A,
accfft_plan *  plan,
double *  timer 
)

Computes double precision Laplacian of its input real data A, and writes the output into LA.

Parameters
LA$\Delta A$
planFFT plan created by accfft_plan_dft_3d_r2c. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void read_pnetcdf ( const std::string &  filename,
MPI_Offset  starts[3],
MPI_Offset  counts[3],
int  gsizes[3],
double *  localData 
)

Read a parallel-nedcdf file.

We assume here that localData is a scalar.

Pnetcdf uses row-major format (same as FFTW).

Parameters
[in]filename: PnetCDF filename
[in]starts: offset to where to start reading data
[in]counts: number of elements read (3D sub-domain inside global)
[in]gsizes: global sizes
[out]localData: actual data buffer (size : nx*ny*nz*sizeof(double))

localData must have been allocated prior to calling this routine.

void write_pnetcdf ( const std::string &  filename,
MPI_Offset  starts[3],
MPI_Offset  counts[3],
int  gsizes[3],
double *  localData 
)

Write a parallel-nedcdf file.

We assume here that localData is a scalar.

Pnetcdf uses row-major format (same as FFTW).

Parameters
[in]filename: PnetCDF filename
[in]starts: offset to where to start reading data
[in]counts: number of elements read (3D sub-domain inside global)
[in]gsizes: global sizes
[in]localData: actual data buffer (size : nx*ny*nz*sizeof(double))