PSCF v1.3.1
rpc/scft/iterator/Iterator.h
1#ifndef RPC_ITERATOR_H
2#define RPC_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#include <util/global.h>
14
15namespace Pscf {
16namespace Rpc {
17
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 { return (isSymmetric_); }
73
77 bool isFlexible() const
78 { return (isFlexible_); }
79
88
92 int nFlexibleParams() const;
93
99 void setFlexibleParams(FSArray<bool,6> const & flexParams);
100
109 virtual double stress(int paramId) const;
110
111 protected:
112
117
122
127
131 System<D> const & system() const;
132
136 System<D>& system();
137
138 private:
139
141 System<D>* sysPtr_;
142
143 };
144
145 // Inline member functions
146
150 template <int D> inline
152 {
153 UTIL_CHECK(sysPtr_);
154 return *sysPtr_;
155 }
156
160 template <int D> inline
162 {
163 UTIL_CHECK(sysPtr_);
164 return *sysPtr_;
165 }
166
167 // Explicit instantiation declarations
168 extern template class Iterator<1>;
169 extern template class Iterator<2>;
170 extern template class Iterator<3>;
171
172} // namespace Rpc
173} // namespace Pscf
174#endif
Base class for iterative solvers for SCF equations.
virtual void outputTimers(std::ostream &out) const =0
Log output timing results.
bool isSymmetric_
Does this iterator use a symmetry-adapted basis?
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.
int nFlexibleParams() const
Get the number of flexible lattice parameters.
System< D > const & system() const
Get parent system by const reference.
bool isFlexible_
Are any lattice parameters flexible during iteration?
virtual double stress(int paramId) const
Return the stress used by this Iterator, for one lattice parameter.
bool isSymmetric() const
Does this iterator use a symmetry-adapted Fourier basis?
bool isFlexible() const
Return true iff unit cell has any flexible lattice parameters.
FSArray< bool, 6 > flexibleParams_
Array of indices of the lattice parameters that are flexible.
virtual void clearTimers()=0
Clear timers.
FSArray< bool, 6 > flexibleParams() const
Get the array indicating which lattice parameters are flexible.
Main class, representing a complete physical system.
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
ParamComposite()
Constructor.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1