PSCF v1.1
fd1d/sweep/Sweep.h
1#ifndef FD1D_SWEEP_H
2#define FD1D_SWEEP_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, 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
12#include <fd1d/SystemAccess.h> // base class
13#include <fd1d/misc/HomogeneousComparison.h> // member
14#include <fd1d/misc/FieldIo.h> // member
15#include <util/containers/DArray.h> // member
16
17#include <util/global.h>
18
19namespace Pscf {
20namespace Fd1d
21{
22
23 using namespace Util;
24
30 class Sweep : public SweepTmpl< DArray<System::WField> >,
31 public SystemAccess
32 {
33
34 public:
35
37
38 typedef SweepTmpl<State> Base;
39
46
50 ~Sweep();
51
57 virtual void readParameters(std::istream& in);
58
64 virtual void outputSolution(std::string const & stateFileName);
65
71 virtual void outputSummary(std::ostream& outFile);
72
73 protected:
74
77
83 virtual void checkAllocation(State & state);
84
88 virtual void setup();
89
95 virtual void setParameters(double s);
96
102 virtual void extrapolate(double s);
103
109 virtual int solve(bool isContinuation);
110
117 virtual void reset();
118
126 virtual void getSolution();
127
131 virtual void cleanup();
132
133 private:
134
136 HomogeneousComparison comparison_;
137
139 FieldIo fieldIo_;
140
142 std::ofstream logFile_;
143
145 void assignFields(State& lhs, State const & rhs) const;
146
147 };
148
149} // namespace Fd1d
150} // namespace Pscf
151#endif
Read and write fields to file.
Command to compute properties of homogeneous reference system.
Solve a sequence of problems along a line in parameter space.
virtual void outputSolution(std::string const &stateFileName)
Output information after obtaining a converged solution.
virtual void outputSummary(std::ostream &outFile)
Output data to a running summary.
virtual int solve(bool isContinuation)
Call the current iterator to solve one SCFT problem.
virtual void readParameters(std::istream &in)
Read ns and baseFileName parameters.
int homogeneousMode_
Mode for comparison to homogeneous system (none -> -1)
virtual void reset()
Reset system to previous solution after iterature failure.
virtual void cleanup()
Close log file after end of sweep.
virtual void checkAllocation(State &state)
Check allocation of w fields in one state, allocate if needed.
virtual void setParameters(double s)
Set non-adjustable system parameters to new values.
virtual void extrapolate(double s)
Create initial guess for new w fields by polynomial extrapolation.
virtual void getSolution()
Update state(0) and output data after successful convergence.
virtual void setup()
Setup operation at beginning sweep.
Concise accesss to an associated System.
Definition: SystemAccess.h:28
const System & system() const
Get parent System by reference.
Definition: SystemAccess.h:158
Main class in SCFT simulation of one system.
Definition: fd1d/System.h:63
Solve a sequence of problems along a path through parameter space.
Definition: SweepTmpl.h:24
DArray< System::WField > & state(int i)
Get reference to a stored state, with i=0 being most recent.
Definition: SweepTmpl.h:75
double s(int i) const
Get the value of s for a stored solution, with i = 0 most recent.
Definition: SweepTmpl.h:90
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
File containing preprocessor macros for error handling.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1