PSCF v1.4.0
scft/iterator/AmIteratorGrid.h
1#ifndef RP_AM_ITERATOR_GRID_H
2#define RP_AM_ITERATOR_GRID_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
12#include <pscf/iterator/AmbdInteraction.h> // member
13#include <iostream>
14
15namespace Pscf {
16namespace Rp {
17
18 using namespace Util;
19
45 template <int D, class T>
47 : public AmIteratorTmpl< typename T::Iterator, typename T::Vector >
48 {
49
50 public:
51
57 void readParameters(std::istream& in) override;
58
64 void outputTimers(std::ostream& out) const override;
65
66 protected:
67
73 AmIteratorGrid(typename T::System& system);
74
78 virtual ~AmIteratorGrid();
79
85 void setup(bool isContinuation) override;
86
88 using IteratorT = typename T::Iterator;
89
91 using VectorT = typename T::Vector;
92
95
96 // Inherited protected members
97 using IteratorT::system;
98 using IteratorT::flexibleParams_;
99
100 private:
101
103 AmbdInteraction interaction_;
104
106 double scaleStress_;
107
108 // Private overridden virtual functions
109
115 int nElements() override;
116
120 bool hasInitialGuess() override;
121
127 void getCurrent(VectorT& curr) override;
128
135 void evaluate() override;
136
142 void getResidual(VectorT& resid) override;
143
149 void update(VectorT& newGuess) override;
150
154 void outputToLog() override;
155
156 // Private type aliases
157 using RealT = double;
158 using RFieldT = typename T::RField;
159
160 //template <typename Data>
161 //using HostArrayT = (typename T::HostDArray)<Data>;
162
163 };
164
165} // namespace Rp
166} // namespace Pscf
167#endif
Modified interaction to compute residual defn.
AmIteratorGrid(typename T::System &system)
Constructor.
void readParameters(std::istream &in) override
Read all parameters and initialize.
AmIteratorTmpl< IteratorT, VectorT > AmIterTmplT
Alias for base class.
virtual ~AmIteratorGrid()
Destructor.
void outputTimers(std::ostream &out) const override
Output timing results to log file.
typename T::Vector VectorT
Alias for type of state and residual vectors.
typename T::Iterator IteratorT
Alias for Iterator type.
void setup(bool isContinuation) override
Setup iterator just before entering iteration loop.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.