PSCF v1.4.0
fts/compressor/LrAmCompressor.h
1#ifndef RP_LR_AM_COMPRESSOR_H
2#define RP_LR_AM_COMPRESSOR_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/iterator/AmIteratorTmpl.h> // base class template
12#include <pscf/math/IntVec.h> // member
13#include <util/containers/DArray.h> // member
14
15namespace Pscf {
16namespace Rp {
17
18 using namespace Util;
19
43 template <int D, class T, class V>
45 : public AmIteratorTmpl<typename T::Compressor, V>
46 {
47
48 public:
49
51 using VectorT = V;
52
58 void readParameters(std::istream& in) override;
59
69 void setup(bool isContinuation) override;
70
76 int compress() override;
77
83 void outputTimers(std::ostream& out) const override;
84
88 void clearTimers() override;
89
90 protected:
91
97 LrAmCompressor(typename T::System& system);
98
102 ~LrAmCompressor() = default;
103
104 // Alias for base class.
105 using CompressorT = typename T::Compressor;
106
107 // Inherited member function.
108 using CompressorT::system;
109
110 private:
111
116
121
125 typename T::RField resid_;
126
130 typename T::RFieldDft residK_;
131
135 typename T::RField intraCorrelationK_;
136
140 typename T::IntraCorrelation intra_;
141
145 IntVec<D> kMeshDimensions_;
146
150 int kSize_;
151
155 bool isIntraCalculated_;
156
160 bool isAllocated_;
161
162 // Private AM algorithm operations
163
169 int nElements() override;
170
174 bool hasInitialGuess() override;
175
181 void getCurrent(VectorT& curr) override;
182
189 void evaluate() override;
190
196 void getResidual(VectorT& resid) override;
197
204 void addCorrection(VectorT& fieldTrial,
205 VectorT const & resTrial) override;
206
212 void update(VectorT& newGuess) override;
213
217 void outputToLog() override;
218
220 using FFTT = typename T::FFT;
221
224
225 };
226
227} // namespace Rp
228} // namespace Pscf
229#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
void setup(bool isContinuation) override
Initialize just before entry to iterative loop.
int compress() override
Compress to obtain partial saddle point field.
void outputTimers(std::ostream &out) const override
Return compressor time contributions.
~LrAmCompressor()=default
Destructor.
V VectorT
Type of field and residual vectors.
LrAmCompressor(typename T::System &system)
Constructor.
void clearTimers() override
Clear all timers and MDE solution counter.
void readParameters(std::istream &in) override
Read body of parameter file block and initialize.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.