1#ifndef PRDC_CPU_C_FIELD_TPP
2#define PRDC_CPU_C_FIELD_TPP
46 FftwDArray<fftw_complex>::allocate(other.capacity_);
47 meshDimensions_ = other.meshDimensions_;
48 for (int i = 0; i < capacity_; ++i) {
49 data_[i][0] = other.data_[i][0];
50 data_[i][1] = other.data_[i][1];
64 if (
this == &other)
return *
this;
68 UTIL_THROW(
"Other CField must be allocated in assignment.");
75 UTIL_CHECK(meshDimensions_ == other.meshDimensions_);
93 for (
int i = 0; i < D; ++i) {
108 for (
int i = 0; i < D; ++i) {
109 meshDimensions_[i] = 0;
An IntVec<D, T> is a D-component vector of elements of integer type T.
const IntVec< D > & meshDimensions() const
Return mesh dimensions by constant reference.
CField()
Default constructor.
void allocate(const IntVec< D > &meshDimensions)
Allocate the underlying C array for an FFT grid.
virtual void deallocate()
Deallocate underlying C array and clear mesh dimensions.
CField & operator=(const CField &other)
Assignment operator.
virtual ~CField()
Destructor.
void allocate(int capacity)
Allocate the underlying C array.
virtual void deallocate()
Dellocate the underlying C array.
bool isAllocated() const
Return true if the FftwDArray has been allocated, false otherwise.
int capacity_
Allocated size of the data_ array.
#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.
Fields and FFTs for periodic boundary conditions (CPU)
Periodic fields and crystallography.
PSCF package top-level namespace.