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

Functions

void accfft_gradf (float *A_x, float *A_y, float *A_z, float *A, accfft_planf *plan, std::bitset< 3 > *pXYZ, double *timer)
 
void accfft_laplacef (float *LA, float *A, accfft_planf *plan, double *timer)
 
void accfft_divergencef (float *divA, float *A_x, float *A_y, float *A_z, accfft_planf *plan, double *timer)
 
void accfft_biharmonicf (float *BA, float *A, accfft_planf *plan, double *timer)
 
void read_pnetcdf (const std::string &filename, MPI_Offset starts[3], MPI_Offset counts[3], int gsizes[3], float *localData)
 
void write_pnetcdf (const std::string &filename, MPI_Offset starts[3], MPI_Offset counts[3], int gsizes[3], float *localData)
 

Detailed Description

Single Precision CPU functions of AccFFT operators

Function Documentation

void accfft_biharmonicf ( float *  BA,
float *  A,
accfft_planf *  plan,
double *  timer 
)

Computes single 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_r2cf. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_divergencef ( float *  divA,
float *  A_x,
float *  A_y,
float *  A_z,
accfft_planf *  plan,
double *  timer 
)

Computes single 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_r2cf. Must be an outplace plan, otherwise the function will return without computing the gradient.
timerSee Timing AccFFT for more details.
void accfft_gradf ( float *  A_x,
float *  A_y,
float *  A_z,
float *  A,
accfft_planf *  plan,
std::bitset< 3 > *  pXYZ,
double *  timer 
)

Computes single 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_r2cf. 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_laplacef ( float *  LA,
float *  A,
accfft_planf *  plan,
double *  timer 
)

Computes single 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_r2cf. 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],
float *  localData 
)

Read a single-precision 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(float))

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],
float *  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(float))