PSCF v1.2
|
Template for propagator classes. More...
#include <PropagatorTmpl.h>
Public Member Functions | |
PropagatorTmpl () | |
Constructor. | |
Mutators | |
void | setDirectionId (int directionId) |
Associate this propagator with a direction index. | |
void | setPartner (const TP &partner) |
Set the partner of this propagator. | |
void | addSource (const TP &source) |
Add a propagator to the list of sources for this one. | |
void | setIsSolved (bool isSolved) |
Set the isSolved flag to true or false. | |
Accessors | |
const TP & | source (int id) const |
Get a source propagator. | |
const TP & | partner () const |
Get partner propagator. | |
int | directionId () const |
Get direction index for this propagator. | |
int | nSource () const |
Number of source / prerequisite propagators. | |
bool | hasPartner () const |
Does this have a partner propagator? | |
bool | isSolved () const |
Has the modified diffusion equation been solved? | |
bool | isReady () const |
Are all source propagators solved? | |
Template for propagator classes.
The template argument TP should be a concrete propagator class that is derived from the template PropagatorTmpl<TP>. By convention, each implementation of SCFT is defined in a different sub-namespace of namespace Pscf. For each such implementation, there is a concrete propagator class, named Propagator by convention, that is a subclass of the template instance PropagatorTmpl<Propagator>, using the syntax shown below:
This usage is an example of the so-called "curiously recurring template pattern" (CRTP). It is used here to allow the template PropagatorTmpl<Propagator> to have member variables that store pointers to other instances of the derived class Propagator (or TP).
The concrete Propagator class is used in templates BlockTmpl, PolymerTmpl and SystemTmpl. The usage in those templates require that the Propagator class define typedefs named WField and CField. Propagator must also provide member functions named solve() and computeQ(), neither of which takes any arguments.
The typedefs WField and CField must be aliases for the type of containers used to a single chemical potential or concentration field, respectively.
The function void solve() must solve the modified diffusion equation for this propapagator, using information that is accessible to the concrete propagator class. Upon return, the solution must be stored in an internal data structures that is read-accessible through the public class interface, and the function isSolved() must return true.
The function computeQ() must compute and return the molecular partition function Q using information available to this propagator.
An example of the required interface is shown below:
In the above example, the field container typenames WField and CField are defined to be synonyms for DArrray<double>, i.e., for dynamically allocated arrays of double precision floating point numbers. Other implementations may use more specialized types.
Definition at line 91 of file PropagatorTmpl.h.
Pscf::PropagatorTmpl< TP >::PropagatorTmpl | ( | ) |
Constructor.
Definition at line 241 of file PropagatorTmpl.h.
void Pscf::PropagatorTmpl< TP >::setDirectionId | ( | int | directionId | ) |
Associate this propagator with a direction index.
directionId | direction = 0 or 1. |
Definition at line 252 of file PropagatorTmpl.h.
void Pscf::PropagatorTmpl< TP >::setPartner | ( | const TP & | partner | ) |
Set the partner of this propagator.
The partner of a propagator is the propagator for the same block that propagates in the opposite direction.
partner | reference to partner propagator |
Definition at line 259 of file PropagatorTmpl.h.
void Pscf::PropagatorTmpl< TP >::addSource | ( | const TP & | source | ) |
Add a propagator to the list of sources for this one.
A source is a propagator that terminates at the root vertex of this one and is needed to compute the initial condition for this one, and that thus must be computed before this.
source | reference to source propagator |
Definition at line 266 of file PropagatorTmpl.h.
void Pscf::PropagatorTmpl< TP >::setIsSolved | ( | bool | isSolved | ) |
Set the isSolved flag to true or false.
Definition at line 284 of file PropagatorTmpl.h.
|
inline |
Get a source propagator.
id | index of source propagator, < nSource |
Definition at line 217 of file PropagatorTmpl.h.
const TP & Pscf::PropagatorTmpl< TP >::partner | ( | ) | const |
|
inline |
Get direction index for this propagator.
Definition at line 202 of file PropagatorTmpl.h.
|
inline |
Number of source / prerequisite propagators.
Definition at line 209 of file PropagatorTmpl.h.
References Util::GArray< Data >::size().
|
inline |
Does this have a partner propagator?
Definition at line 225 of file PropagatorTmpl.h.
|
inline |
Has the modified diffusion equation been solved?
Definition at line 232 of file PropagatorTmpl.h.
bool Pscf::PropagatorTmpl< TP >::isReady | ( | ) | const |
Are all source propagators solved?
Definition at line 291 of file PropagatorTmpl.h.
Referenced by pscfpp.text.FileEditor::__init__(), pscfpp.text.RecordEditor::__init__(), pscfpp.text.FileEditor::editFile(), pscfpp.text.RecordEditor::editFile(), pscfpp.text.FileEditor::editFileBlocks(), pscfpp.text.FileEditor::editFiles(), pscfpp.text.FileEditor::setFilter(), pscfpp.text.RecordEditor::setFilter(), pscfpp.text.FileEditor::setNew(), pscfpp.text.RecordEditor::setNew(), and pscfpp.text.FileEditor::setOld().