PSCF v1.5.0
cpp/CFieldComparison.h
1#ifndef PSCF_C_FIELD_COMPARISON_CP_H
2#define PSCF_C_FIELD_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 identifier class
12
13// Forward declarations
14namespace Util {
15 template <typename T> class DArray;
16}
17namespace Pscf {
18 template <int D, class T> class CField;
19}
20
21namespace Pscf {
22
23 using namespace Util;
24
25 // Declare primary template
26 template <int D, class T> class CFieldComparison;
27
33 template <int D>
35 {
36
37 public:
38
45
46 // Use compiler defined destructor and assignment operator.
47
58 double compare(CField<D,CPT> const& a, CField<D,CPT> const& b);
59
74 double compare(DArray< CField<D,CPT> > const& a,
75 DArray< CField<D,CPT> > const& b);
76
83 double maxDiff() const
84 { return maxDiff_; }
85
92 double rmsDiff() const
93 { return rmsDiff_; }
94
95 private:
96
97 // Maximum element-by-element difference.
98 double maxDiff_;
99
100 // Room-mean-squared element-by-element difference.
101 double rmsDiff_;
102
103 };
104
105 // Explicit instantiation declarations
106 extern template class CFieldComparison<1,CPT>;
107 extern template class CFieldComparison<2,CPT>;
108 extern template class CFieldComparison<3,CPT>;
109
110
111} // namespace Pscf
112#endif
double rmsDiff() const
Return the precomputed root-mean-squared difference.
double maxDiff() const
Return the precomputed maximum element-by-element difference.
double compare(CField< D, CPT > const &a, CField< D, CPT > const &b)
Compare individual fields.
Backend identifier class for the C++ serial CPU backend.
Definition CPT.h:32
Dynamically allocatable contiguous array template.
Definition DArray.h:32
PSCF package top-level namespace.
Utility classes for scientific computation.