PSCF v1.3.2
rpg/scft/iterator/Iterator.h
1#ifndef RPG_ITERATOR_H
2#define RPG_ITERATOR_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 <util/param/ParamComposite.h> // base class
12#include <util/containers/FSArray.h> // member
13
14namespace Pscf {
15namespace Rpg {
16
17 // Forward declaration
18 template <int D> class System;
19
20 using namespace Util;
21
27 template <int D>
28 class Iterator : public ParamComposite
29 {
30
31 public:
32
36 Iterator();
37
44
48 ~Iterator();
49
56 virtual int solve(bool isContinuation) = 0;
57
61 virtual void outputTimers(std::ostream& out) const = 0;
62
66 virtual void clearTimers() = 0;
67
71 bool isSymmetric() const;
72
76 bool isFlexible() const;
77
85
89 int nFlexibleParams() const;
90
96 void setFlexibleParams(FSArray<bool, 6> const & flexParams);
97
106 virtual double stress(int paramId) const;
107
108 protected:
109
114
119
124
128 System<D>& system();
129
133 System<D> const & system() const;
134
135 private:
136
138 System<D>* sysPtr_;
139
140 };
141
142 // Protected inline member functions
143
144 // Return reference to parent system.
145 template<int D> inline
147 { return *sysPtr_; }
148
149 // Return const reference to parent system.
150 template<int D> inline
152 { return *sysPtr_; }
153
154 // Explicit instantiation declarations
155 extern template class Iterator<1>;
156 extern template class Iterator<2>;
157 extern template class Iterator<3>;
158
159} // namespace Rpg
160} // namespace Pscf
161#endif
Base class for iterative solvers for SCF equations.
System< D > & system()
Return reference to parent system.
void setFlexibleParams(FSArray< bool, 6 > const &flexParams)
Set the array indicating which lattice parameters are flexible.
virtual int solve(bool isContinuation)=0
Iterate to solution.
virtual void clearTimers()=0
Clear timers.
bool isFlexible() const
Is the unit cell flexible (true) or rigid (false).
int nFlexibleParams() const
Get the number of flexible lattice parameters.
bool isSymmetric() const
Does this iterator use a symmetry-adapted Fourier basis?
bool isFlexible_
Is the unit cell flexible during iteration?
virtual double stress(int paramId) const
Return the stress used by this Iterator, for one lattice parameter.
FSArray< bool, 6 > flexibleParams() const
Get the array indicating which lattice parameters are flexible.
FSArray< bool, 6 > flexibleParams_
Array of indices of the lattice parameters that are flexible.
bool isSymmetric_
Does this iterator use a symmetry-adapted basis?
virtual void outputTimers(std::ostream &out) const =0
Log output timing results.
Main class, representing a complete physical system.
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
ParamComposite()
Constructor.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.