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

Template for propagator classes. More...

#include <PropagatorTmpl.h>

Inheritance diagram for Pscf::PropagatorTmpl< QT >:
Pscf::Rp::Propagator< D, Types< D > > Pscf::Rpc::Propagator< D > Pscf::Rpg::Propagator< D >

Public Member Functions

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?

Protected Member Functions

 PropagatorTmpl ()
 Constructor.

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 "void solve()" and "void computeQ(WT &)", where WT is the name of the real or complex number data type of the value of the partition function. This data type is generally the same as the type of the value of a single w-field at a grid point.

The type FieldT must be an alias for the type of container used to store a single chemical potential or concentration field, or a single 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 void computeQ(WT & ) must compute the partition function Q, which is a value of type WT, and set its single parameter equal to Q.

A simple example of such an interface for an implementation with real fields 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.
void computeQ(double& Q);
};
Dynamically allocatable contiguous array template.
Definition DArray.h:32

In this above example, the field container typename FieldT is an alias for DArrray<double>, which is a dynamically allocated array of double double precision floating point numbers. Other implementations may use a more specialized container type for field values.

Definition at line 93 of file PropagatorTmpl.h.

Constructor & Destructor Documentation

◆ PropagatorTmpl()

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

Constructor.

Definition at line 290 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 301 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 308 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 315 of file PropagatorTmpl.h.

References source().

◆ setIsSolved()

template<class QT>
void Pscf::PropagatorTmpl< QT >::setIsSolved ( bool isSolved)

◆ setEndFlags()

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

Set flags indicating whether vertices are chain ends.

Parameters
isHeadEndIs the head vertex a chain end?
isTailEndIs the tail vertex a chain end?

Definition at line 322 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 253 of file PropagatorTmpl.h.

Referenced by addSource().

◆ partner()

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

Get partner propagator.

Definition at line 353 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 238 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 245 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 260 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 267 of file PropagatorTmpl.h.

Referenced by Pscf::Rpc::Block< D >::computeStressBead(), Pscf::Rpg::Block< D >::computeStressBead(), and 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 274 of file PropagatorTmpl.h.

Referenced by Pscf::Rpc::Block< D >::computeStressBead(), Pscf::Rpg::Block< D >::computeStressBead(), and setEndFlags().

◆ isSolved()

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

◆ isReady()

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

Are all source propagators solved?

Definition at line 332 of file PropagatorTmpl.h.

References isSolved().


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