12#include <pscf/math/IntVec.h>
14#include <pspg/math/GpuResources.h>
91 template <
class Archive>
92 void serialize(Archive& ar,
const unsigned int version);
95 using DField<cudaReal>::operator=;
111 for (
int i = 0; i < D; ++i) {
113 meshDimensions_[i] = meshDimensions[i];
114 size *= meshDimensions[i];
124 {
return meshDimensions_; }
130 template <
class Archive>
134 if (Archive::is_saving()) {
135 capacity = capacity_;
138 if (Archive::is_loading()) {
139 if (!isAllocated()) {
144 if (capacity != capacity_) {
151 double* tempData =
new double[capacity];
152 cudaMemcpy(tempData, data_, capacity *
sizeof(cudaReal),
153 cudaMemcpyDeviceToHost);
154 for (
int i = 0; i < capacity_; ++i) {
159 ar & meshDimensions_;
168#include "RDField.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.
Field of real single precision values on an FFT mesh on a device.
void allocate(const IntVec< D > &meshDimensions)
Allocate the underlying C array for an FFT grid.
RDField()
Default constructor.
void serialize(Archive &ar, const unsigned int version)
Serialize a Field to/from an Archive.
RDField & operator=(const RDField &other)
Assignment operator.
virtual ~RDField()
Destructor.
const IntVec< D > & meshDimensions() const
Return mesh dimensions by constant reference.
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.