1#ifndef PRDC_CFIELD_IO_TPP
2#define PRDC_CFIELD_IO_TPP
11#include <pscf/mesh/MeshIterator.h>
12#include <pscf/math/IntVec.h>
13#include <pscf/math/arithmetic.h>
15#include <util/containers/DArray.h>
16#include <util/format/Dbl.h>
21 template <
int D,
class AT>
31 for (j = 0; j < nMonomer; ++j) {
38 assign(fields[j][rank], x, y);
44 template <
int D,
class AT>
63 template <
int D,
class AT,
typename CT,
typename RT>
73 for (j = 0; j < nMonomer; ++j) {
76 x =
real( fields[j][rank] );
77 y =
imag( fields[j][rank] );
78 out <<
" " <<
Dbl(x, 21, 13)
79 <<
" " <<
Dbl(y, 21, 13);
85 template <
int D,
class AT,
typename CT,
typename RT>
95 x =
real( field[rank] );
96 y =
imag( field[rank] );
97 out <<
" " <<
Dbl(x, 21, 13)
98 <<
" " <<
Dbl(y, 21, 13)
An IntVec<D, T> is a D-component vector of elements of integer type T.
Iterator over points in a Mesh<D>.
int rank() const
Get the rank of current element.
void begin()
Set iterator to the first point in the mesh.
bool atEnd() const
Is this the end (i.e., one past the last point)?
int capacity() const
Return allocated size.
Dynamically allocatable contiguous array template.
Wrapper for a double precision number, for formatted ostream output.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
void writeCFieldsData(std::ostream &out, DArray< AT > const &fields, IntVec< D > const &dimensions)
Write data for an array of complex fields, with no header section.
void readCFieldData(std::istream &in, AT &field, IntVec< D > const &dimensions)
Read data for a single complex field, with no header section.
void writeCFieldData(std::ostream &out, AT const &field, IntVec< D > const &dimensions)
Write data for a single complex field, with no header section.
void readCFieldsData(std::istream &in, DArray< AT > &fields, IntVec< D > const &dimensions)
Read data for an array of complex fields, with no header section.
double imag(fftw_complex const &a)
Return the imaginary part of an fftw_complex number.
void assign(fftw_complex &z, double const &a, double const &b)
Create an fftw_complex from real and imaginary parts, z = a + ib.
double real(fftw_complex const &a)
Return the real part of an fftw_complex number.
Periodic fields and crystallography.
PSCF package top-level namespace.