Transform

Note

This class only holds an internal reference counted object. The object remains in a usable state even if the associated Grid object is destroyed. In addition, copying a transform only requires an internal copy of a shared pointer.

class spfft::Transform

A transform in double precision with fixed dimensions.

Shares memory with other transform created from the same Grid object.

Public Functions

Transform(const Transform&) = default

Default copy constructor.

Transform(Transform&&) = default

Default move constructor.

Transform &operator=(const Transform&) = default

Default copy operator.

Transform &operator=(Transform&&) = default

Default move operator.

Transform clone() const

Clone transform.

Return

Independent transform with the same parameters, but with new underlying grid.

SpfftTransformType type() const

Access a transform parameter.

Return

Type of transform.

int dim_x() const

Access a transform parameter.

Return

Dimension in x.

int dim_y() const

Access a transform parameter.

Return

Dimension in y.

int dim_z() const

Access a transform parameter.

Return

Dimension in z.

int local_z_length() const

Access a transform parameter.

Return

Length in z of the space domain slice held by the local MPI rank.

int local_z_offset() const

Access a transform parameter.

Return

Offset in z of the space domain slice held by the local MPI rank.

int local_slice_size() const

Access a transform parameter.

Return

Number of elements in the space domain slice held by the local MPI rank.

long long int global_size() const

Access a transform parameter.

Return

Global number of elements in space domain. Equals dim_x() * dim_y() * dim_z().

int num_local_elements() const

Access a transform parameter.

Return

Number of elements in frequency domain.

long long int num_global_elements() const

Access a transform parameter.

Return

Global number of elements in frequency domain.

SpfftProcessingUnitType processing_unit() const

Access a transform parameter.

Return

The processing unit used for calculations. Can be SPFFT_PU_HOST or SPFFT_PU_GPU.

int device_id() const

Access a transform parameter.

Return

The GPU device id used. Returns always 0, if no GPU support is enabled.

int num_threads() const

Access a transform parameter.

Return

The exact number of threads used by transforms created from this grid. May be less than the maximum given to the constructor. Always 1, if not compiled with OpenMP support.

MPI_Comm communicator() const

Access a transform parameter.

Return

The internal MPI communicator.

double *space_domain_data(SpfftProcessingUnitType dataLocation)

Provides access to the space domain data.

Return

Pointer to space domain data on given processing unit. Alignment is guaranteed to fulfill requirements for std::complex and C language complex types.

Parameters
  • [in] dataLocation: The processing unit to query for the data. Can be SPFFT_PU_HOST or SPFFT_PU_GPU (if GPU is set as execution unit).

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.

void forward(SpfftProcessingUnitType inputLocation, double *output, SpfftScalingType scaling = SPFFT_NO_SCALING)

Execute a forward transform from space domain to frequency domain.

Parameters
  • [in] inputLocation: The processing unit, to take the input from. Can be SPFFT_PU_HOST or SPFFT_PU_GPU (if GPU is set as execution unit).

  • [out] output: Pointer to memory, where the frequency domain elements are written to. Can be located at Host or GPU memory (if GPU is set as processing unit).

  • [in] scaling: Controls scaling of output. SPFFT_NO_SCALING to disable or SPFFT_FULL_SCALING to scale by factor 1 / (dim_x() * dim_y() * dim_z()).

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.

void backward(const double *input, SpfftProcessingUnitType outputLocation)

Execute a backward transform from frequency domain to space domain.

Parameters
  • [in] input: Input data in frequency domain. Must match the indices provided at transform creation. Can be located at Host or GPU memory, if GPU is set as processing unit.

  • [in] outputLocation: The processing unit, to place the output at. Can be SPFFT_PU_HOST or SPFFT_PU_GPU (if GPU is set as execution unit).

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.