PSCF v1.3
Pscf::PropagatorTmpl< QT > Class Template Reference

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?

Detailed Description

template<class QT>
class Pscf::PropagatorTmpl< QT >

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:

class Propagator : public PropagatorTmpl<Propagator>
{
...
};
PropagatorTmpl()
Constructor.

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:

class Propagator : public PropagatorTmpl<Propagator>
{
public:
// Field type.
using FieldT = DArray<double>;
// Solve the modified diffusion equation for this direction.
void solve();
// Compute and return the molecular partition function Q.
double computeQ();
};
Dynamically allocatable contiguous array template.
Definition DArray.h:32

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.

Constructor & Destructor Documentation

◆ PropagatorTmpl()

template<class QT>
Pscf::PropagatorTmpl< QT >::PropagatorTmpl ( )

Constructor.

Definition at line 280 of file PropagatorTmpl.h.

Member Function Documentation

◆ setDirectionId()

template<class QT>
void Pscf::PropagatorTmpl< QT >::setDirectionId ( int directionId)

Associate this propagator with a direction index.

Parameters
directionIddirection = 0 or 1.

Definition at line 291 of file PropagatorTmpl.h.

References directionId().

◆ setPartner()

template<class QT>
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.

Parameters
partnerreference to partner propagator

Definition at line 298 of file PropagatorTmpl.h.

References partner().

◆ addSource()

template<class QT>
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.

Parameters
sourcereference to source propagator

Definition at line 305 of file PropagatorTmpl.h.

References source().

◆ setIsSolved()

template<class QT>
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().

◆ setEndFlags()

template<class QT>
void Pscf::PropagatorTmpl< QT >::setEndFlags ( bool isHeadEnd,
bool isTailEnd )

Set flags indicating whether vertices are chain ends.

Parameters
isHeadEndDoes this propagator own the head vertex bead?
isTailEndDoes this propagator own the tail vertex bead?

Definition at line 312 of file PropagatorTmpl.h.

References isHeadEnd(), and isTailEnd().

◆ source()

template<class QT>
const QT & Pscf::PropagatorTmpl< QT >::source ( int id) const
inline

Get a source propagator.

Parameters
idindex of source propagator, < nSource

Definition at line 243 of file PropagatorTmpl.h.

Referenced by addSource().

◆ partner()

template<class QT>
const QT & Pscf::PropagatorTmpl< QT >::partner ( ) const

Get partner propagator.

Definition at line 343 of file PropagatorTmpl.h.

References UTIL_CHECK.

Referenced by setPartner().

◆ directionId()

template<class QT>
int Pscf::PropagatorTmpl< QT >::directionId ( ) const
inline

Get direction index for this propagator.

Definition at line 228 of file PropagatorTmpl.h.

Referenced by setDirectionId().

◆ nSource()

template<class QT>
int Pscf::PropagatorTmpl< QT >::nSource ( ) const
inline

Number of source / prerequisite propagators.

Definition at line 235 of file PropagatorTmpl.h.

References Util::GArray< Data >::size().

◆ hasPartner()

template<class QT>
bool Pscf::PropagatorTmpl< QT >::hasPartner ( ) const
inline

Does this have a partner propagator?

Definition at line 250 of file PropagatorTmpl.h.

◆ isHeadEnd()

template<class QT>
bool Pscf::PropagatorTmpl< QT >::isHeadEnd ( ) const
inline

Is the head vertex a chain end?

Precondition: PolymerModel::isBead()

Definition at line 257 of file PropagatorTmpl.h.

Referenced by setEndFlags().

◆ isTailEnd()

template<class QT>
bool Pscf::PropagatorTmpl< QT >::isTailEnd ( ) const
inline

Is the tail vertex a chain end?

Precondition: PolymerModel::isBead()

Definition at line 264 of file PropagatorTmpl.h.

Referenced by setEndFlags().

◆ isSolved()

template<class QT>
bool Pscf::PropagatorTmpl< QT >::isSolved ( ) const
inline

Has the modified diffusion equation been solved?

Definition at line 271 of file PropagatorTmpl.h.

Referenced by isReady(), and setIsSolved().

◆ isReady()

template<class QT>
bool Pscf::PropagatorTmpl< QT >::isReady ( ) const

Are all source propagators solved?

Definition at line 322 of file PropagatorTmpl.h.

References isSolved().


The documentation for this class was generated from the following file: