PSCF v1.5.0
cpp/RFieldDftComparison.h
1#ifndef PSCF_R_FIELD_DFT_COMPARISON_CP_H
2#define PSCF_R_FIELD_DFT_COMPARISON_CP_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/backend/cpp/CPT.h> // backend type
12
13// Forward declarations
14namespace Util {
15 template <typename T> class DArray;
16}
17namespace Pscf {
18 template <int D, class T> class RFieldDft;
19}
20
21namespace Pscf {
22
23 using namespace Util;
24
25 // Declare primary template
26 template <int D, class T> class RFieldDftComparison;
27
33 template <int D>
35 {
36
37 public:
38
45
46 // Use compiler defined destructor and assignment operator.
47
58 double compare(RFieldDft<D,CPT> const& a,
59 RFieldDft<D,CPT> const& b);
60
75 double compare(DArray< RFieldDft<D,CPT> > const& a,
76 DArray< RFieldDft<D,CPT> > const& b);
77
84 double maxDiff() const
85 { return maxDiff_; }
86
93 double rmsDiff() const
94 { return rmsDiff_; }
95
96 private:
97
98 // Maximum element-by-element difference.
99 double maxDiff_;
100
101 // Room-mean-squared element-by-element difference.
102 double rmsDiff_;
103
104 };
105
106 // Explicit instantiation declarations
107 extern template class RFieldDftComparison<1,CPT>;
108 extern template class RFieldDftComparison<2,CPT>;
109 extern template class RFieldDftComparison<3,CPT>;
110
111} // namespace Pscf
112#endif
Backend identifier class for the C++ serial CPU backend.
Definition CPT.h:32
double rmsDiff() const
Return the precomputed root-mean-squared difference.
double maxDiff() const
Return the precomputed maximum element-by-element difference.
double compare(RFieldDft< D, CPT > const &a, RFieldDft< D, CPT > const &b)
Compare individual fields.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
PSCF package top-level namespace.
Utility classes for scientific computation.