1#ifndef PSCF_SWEEP_TMPL_H
2#define PSCF_SWEEP_TMPL_H
11#include <util/param/ParamComposite.h>
12#include <util/containers/DArray.h>
13#include <util/containers/GArray.h>
14#include <pscf/sweep/ParameterModifier.h>
15#include <pscf/sweep/ParameterType.h>
26 template <
typename State>
110 return *stateHistory_[i];
122 double s(
int i)
const
147 double c(
int i)
const
158 {
return historySize_; }
169 {
return historyCapacity_; }
263 virtual int solve(
bool isContinuation) = 0;
328 int historyCapacity_;
349 void accept(
double s);
359#include "SweepTmpl.tpp"
Base class allowing subclasses to define sweepable parameters.
int historySize() const
Get the current number of stored previous states.
virtual void getSolution()=0
Update state(0) and output data after successful solution.
void addParameterTypes(GArray< ParameterType > paramTypes)
Declare an array of specialized sweep parameter types.
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_
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.
SweepTmpl(int historyCapacity)
Constructor (protected).
int nAccept() const
Get the number of converged solutions accepted thus far.
void setCoefficients(double sNew)
Compute coefficients of previous states for continuation.
void addParameterType(std::string name, int nId, ParameterModifier &modifier)
Declare a specialized parameter type.
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.
GArray< ParameterType > parameterTypes_
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.
void addParameterType(ParameterType paramType)
Declare a single specialized sweep parameter type.
int historyCapacity() const
Dynamically allocatable contiguous array template.
An automatically growable array, analogous to a std::vector.
ParamComposite()
Constructor.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.
Declaration of a specialized sweep parameter type.