1#ifndef PSCF_SWEEP_TMPL_H
2#define PSCF_SWEEP_TMPL_H
11#include <util/param/ParamComposite.h>
22 template <
typename State>
78 return *stateHistory_[i];
115 double c(
int i)
const
126 {
return historySize_; }
137 {
return historyCapacity_; }
231 virtual int solve(
bool isContinuation) = 0;
274 int historyCapacity_;
295 void accept(
double s);
305#include "SweepTmpl.tpp"
Solve a sequence of problems along a path through parameter space.
int historySize() const
Get the current number of stored previous states.
virtual void getSolution()=0
Update state(0) and output data after successful solution.
virtual void extrapolate(double sNew)=0
Create initial guess for the next state by extrapolation.
virtual void checkAllocation(State &state)=0
Check allocation of one state, allocate if necessary.
State & state(int i)
Get reference to a stored state, with i=0 being most recent.
std::string baseFileName_
Base name for output files.
double c(int i) const
Get a coefficient of a previous state in a continuation.
virtual void cleanup()
Clean up operation at the end of a sweep.
void initialize()
Initialize variables that track history of solutions.
virtual void setup()=0
Setup operation at the beginning of a sweep.
int nAccept() const
Get the number of converged solutions accepted thus far.
void setCoefficients(double sNew)
Compute coefficients of previous states for continuation.
virtual void sweep()
Iterate to solution.
virtual void setParameters(double sNew)=0
Set non-adjustable system parameters to new values.
virtual int solve(bool isContinuation)=0
Call current iterator to solve SCFT problem.
virtual void readParameters(std::istream &in)
Read ns and baseFileName parameters.
double s(int i) const
Get the value of s for a stored solution, with i = 0 most recent.
virtual void reset()=0
Reset system to previous solution after iterature failure.
int historyCapacity() const
Get the maximum number of stored previous states.
Dynamically allocatable contiguous array template.
An object that can read multiple parameters from file.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.