PSCF v1.3
|
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 QT &partner) |
Set the partner of this propagator. | |
void | addSource (const QT &source) |
Add a propagator to the list of sources for this one. | |
void | setIsSolved (bool isSolved) |
Set the isSolved flag to true or false. | |
void | setEndFlags (bool isHeadEnd, bool isTailEnd) |
Set flags indicating whether vertices are chain ends. | |
Accessors | |
const QT & | source (int id) const |
Get a source propagator. | |
const QT & | 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 | isHeadEnd () const |
Is the head vertex a chain end? | |
bool | isTailEnd () const |
Is the tail vertex a chain end? | |
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 QT should be a concrete propagator class that is derived from the template PropagatorTmpl<QT>. By convention, each implementation of field theory 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" (CRQT). 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 QT).
The concrete Propagator class is used in templates BlockTmpl, PolymerTmpl and MixtureTmpl. The usage in those templates require that the Propagator class define an alias named FieldT for the field type. Propagator must also provide member functions named solve() and computeQ(), neither of which takes any arguments.
The type FieldT must be an aliases for the type of containers used to store a single chemical potential or concentration field, or a slice of a propagator.
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.
A simple example of the required interface is shown below:
In the above example, the field container typenames FieldT is an alias for DArrray<double>, i.e., for a dynamically allocated arrays of double precision floating point numbers. Other implementations may use more specialized types.
Definition at line 89 of file PropagatorTmpl.h.
Pscf::PropagatorTmpl< QT >::PropagatorTmpl | ( | ) |
Constructor.
Definition at line 280 of file PropagatorTmpl.h.
void Pscf::PropagatorTmpl< QT >::setDirectionId | ( | int | directionId | ) |
Associate this propagator with a direction index.
directionId | direction = 0 or 1. |
Definition at line 291 of file PropagatorTmpl.h.
References directionId().
void Pscf::PropagatorTmpl< QT >::setPartner | ( | const QT & | 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 298 of file PropagatorTmpl.h.
References partner().
void Pscf::PropagatorTmpl< QT >::addSource | ( | const QT & | 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 305 of file PropagatorTmpl.h.
References source().
void Pscf::PropagatorTmpl< QT >::setIsSolved | ( | bool | isSolved | ) |
Set the isSolved flag to true or false.
Definition at line 336 of file PropagatorTmpl.h.
References isSolved().
void Pscf::PropagatorTmpl< QT >::setEndFlags | ( | bool | isHeadEnd, |
bool | isTailEnd ) |
Set flags indicating whether vertices are chain ends.
isHeadEnd | Does this propagator own the head vertex bead? |
isTailEnd | Does this propagator own the tail vertex bead? |
Definition at line 312 of file PropagatorTmpl.h.
References isHeadEnd(), and isTailEnd().
|
inline |
Get a source propagator.
id | index of source propagator, < nSource |
Definition at line 243 of file PropagatorTmpl.h.
Referenced by addSource().
const QT & Pscf::PropagatorTmpl< QT >::partner | ( | ) | const |
Get partner propagator.
Definition at line 343 of file PropagatorTmpl.h.
References UTIL_CHECK.
Referenced by setPartner().
|
inline |
Get direction index for this propagator.
Definition at line 228 of file PropagatorTmpl.h.
Referenced by setDirectionId().
|
inline |
Number of source / prerequisite propagators.
Definition at line 235 of file PropagatorTmpl.h.
References Util::GArray< Data >::size().
|
inline |
Does this have a partner propagator?
Definition at line 250 of file PropagatorTmpl.h.
|
inline |
Is the head vertex a chain end?
Precondition: PolymerModel::isBead()
Definition at line 257 of file PropagatorTmpl.h.
Referenced by setEndFlags().
|
inline |
Is the tail vertex a chain end?
Precondition: PolymerModel::isBead()
Definition at line 264 of file PropagatorTmpl.h.
Referenced by setEndFlags().
|
inline |
Has the modified diffusion equation been solved?
Definition at line 271 of file PropagatorTmpl.h.
Referenced by isReady(), and setIsSolved().
bool Pscf::PropagatorTmpl< QT >::isReady | ( | ) | const |
Are all source propagators solved?
Definition at line 322 of file PropagatorTmpl.h.
References isSolved().