PSCF v1.3.1
rpc/scft/sweep/Sweep.h
1#ifndef RPC_SWEEP_H
2#define RPC_SWEEP_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/sweep/SweepTmpl.h> // base class template
12#include <rpc/scft/sweep/BasisFieldState.h> // base class argument
13#include <util/global.h> // inline functions
14
15namespace Pscf {
16namespace Rpc {
17
18 using namespace Util;
19
25 template <int D>
26 class Sweep : public SweepTmpl< BasisFieldState<D> >
27 {
28
29 public:
30
34 Sweep();
35
42
46 ~Sweep();
47
56
62 virtual void readParameters(std::istream& in);
63
64 // Public members inherited from base class template SweepTmpl
73
74 protected:
75
76 // Protected member functions
77
84
88 virtual void setup();
89
95 virtual void setParameters(double sNew) = 0;
96
106 virtual void extrapolate(double sNew);
107
115 virtual int solve(bool isContinuation);
116
123 virtual void reset();
124
132 virtual void getSolution();
133
137 virtual void cleanup();
138
143 { return (bool)(systemPtr_); }
144
149 {
150 UTIL_CHECK(systemPtr_);
151 return *systemPtr_;
152 }
153
154 // Protected variables writeCGrid_, writeCBasis_ and writeWGrid_
155 // control which converged fields will be written to files after
156 // solution of each SCFT solution within a sweep.
157
162
167
172
173 // Protected inherited member variables
179
180 private:
181
183 BasisFieldState<D> trial_;
184
186 FSArray<double, 6> unitCellParameters_;
187
189 std::ofstream logFile_;
190
192 System<D>* systemPtr_;
193
195 void outputSolution();
196
198 void outputSummary(std::ostream&);
199
200 };
201
202} // namespace Rpc
203} // namespace Pscf
204#endif
FieldState for fields in symmetry-adapted basis format.
virtual int solve(bool isContinuation)
Call current iterator to solve SCFT problem.
virtual void extrapolate(double sNew)
Create a guess for adjustable variables by continuation.
void setSystem(System< D > &system)
Set association with parent System.
Sweep()
Default Constructor.
virtual void getSolution()
Update state(0) and output data after successful convergence.
virtual void checkAllocation(BasisFieldState< D > &state)
Check allocation of fields in one state, allocate if necessary.
System< D > & system()
Return the parent system by reference.
virtual void reset()
Reset system to previous solution after iterature failure.
bool writeCRGrid_
Should concentration fields be written to file in r-grid format?
virtual void cleanup()
Cleanup operation at the beginning of a sweep.
bool writeCBasis_
Should concentration fields be written to file in basis format?
virtual void readParameters(std::istream &in)
Read parameters from param file.
virtual void setParameters(double sNew)=0
Set system parameters to new values.
bool writeWRGrid_
Should converged w fields be written to file in r-grid format?
bool hasSystem()
Does an association with the parent System exist?
virtual void setup()
Setup operation at the beginning of a sweep.
Main class, representing a complete physical system.
void addParameterTypes(GArray< ParameterType > paramTypes)
BasisFieldState< D > & state(int i)
Definition SweepTmpl.h:127
void addParameterType(std::string name, int nId, ParameterModifier &modifier)
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
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