1#ifndef PSPG_R_FIELD_COMPARISON_TPP
2#define PSPG_R_FIELD_COMPARISON_TPP
11#include "RFieldComparison.h"
27 cudaReal* temp_a =
new cudaReal[nPoints];
28 cudaReal* temp_b =
new cudaReal[nPoints];
29 cudaMemcpy(temp_a, a.
cDField(), nPoints*
sizeof(cudaReal),
30 cudaMemcpyDeviceToHost);
31 cudaMemcpy(temp_b, b.
cDField(), nPoints*
sizeof(cudaReal),
32 cudaMemcpyDeviceToHost);
37 for (
int j = 0; j < nPoints; j++) {
41 fieldComparison_.compare(h_a,h_b);
44 return fieldComparison_.maxDiff();
52 int nFields = a.capacity();
53 int nPoints = a[0].capacity();
65 for (
int i = 0; i < nFields; i++) {
66 temp_a[i] =
new cudaReal[nPoints];
67 temp_b[i] =
new cudaReal[nPoints];
68 cudaMemcpy(temp_a[i], a[i].cDField(), nPoints*
sizeof(cudaReal),
69 cudaMemcpyDeviceToHost);
70 cudaMemcpy(temp_b[i], b[i].cDField(), nPoints*
sizeof(cudaReal),
71 cudaMemcpyDeviceToHost);
76 for (
int j = 0; j < nPoints; j++) {
77 h_a[i][j] = temp_a[i][j];
78 h_b[i][j] = temp_b[i][j];
83 fieldComparison_.compare(h_a,h_b);
86 return fieldComparison_.maxDiff();
Data * cDField()
Return pointer to underlying C array.
int capacity() const
Return allocated size.
Field of real single precision values on an FFT mesh on a device.
double compare(RDField< D > const &a, RDField< D > const &b)
Comparator for individual fields.
RFieldComparison()
Constructor.
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
C++ namespace for polymer self-consistent field theory (PSCF).