1#ifndef PSPG_R_DFIELD_DFT_H
2#define PSPG_R_DFIELD_DFT_H
12#include <pspg/math/GpuResources.h>
13#include <pscf/math/IntVec.h>
101 template <
class Archive>
102 void serialize(Archive& ar,
const unsigned int version);
105 using DField<cudaComplex>::operator =;
124 for (
int i = 0; i < D; ++i) {
126 meshDimensions_[i] = meshDimensions[i];
128 dftDimensions_[i] = meshDimensions[i];
129 size *= meshDimensions[i];
131 dftDimensions_[i] = (meshDimensions[i]/2 + 1);
132 size *= (meshDimensions[i]/2 + 1);
143 {
return meshDimensions_; }
150 {
return dftDimensions_; }
156 template <
class Archive>
160 if (Archive::is_saving()) {
161 capacity = capacity_;
164 if (Archive::is_loading()) {
165 if (!isAllocated()) {
170 if (capacity != capacity_) {
177 cudaComplex* tempData =
new cudaComplex[capacity];
178 cudaMemcpy(tempData, data_, capacity *
sizeof(cudaComplex),
179 cudaMemcpyDeviceToHost);
180 for (
int i = 0; i < capacity_; ++i) {
186 ar & meshDimensions_;
191#include "RDFieldDft.tpp"
An IntVec<D, T> is a D-component vector of elements of integer type T.
Dynamic array on the GPU with alligned data.
void allocate(int capacity)
Allocate the underlying C array on the device.
Discrete Fourier Transform (DFT) of a real field on an FFT mesh.
virtual ~RDFieldDft()
Destructor.
void allocate(const IntVec< D > &meshDimensions)
Allocate the underlying C array for an FFT grid.
const IntVec< D > & meshDimensions() const
Return vector of mesh dimensions by constant reference.
RDFieldDft< D > & operator=(const RDFieldDft< D > &other)
Assignment operator.
RDFieldDft()
Default constructor.
const IntVec< D > & dftDimensions() const
Return vector of dft (Fourier) grid dimensions by const reference.
void serialize(Archive &ar, const unsigned int version)
Serialize a Field to/from an Archive.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.