PSCF v1.1
Public Member Functions | List of all members
Pscf::PropagatorTmpl< TP > Class Template Reference

Template for propagator classes. More...

#include <PropagatorTmpl.h>

Public Member Functions

 PropagatorTmpl ()
 Constructor. More...
 
Mutators
void setDirectionId (int directionId)
 Associate this propagator with a direction index. More...
 
void setPartner (const TP &partner)
 Set the partner of this propagator. More...
 
void addSource (const TP &source)
 Add a propagator to the list of sources for this one. More...
 
void setIsSolved (bool isSolved)
 Set the isSolved flag to true or false. More...
 
Accessors
const TP & source (int id) const
 Get a source propagator. More...
 
const TP & partner () const
 Get partner propagator. More...
 
int directionId () const
 Get direction index for this propagator. More...
 
int nSource () const
 Number of source / prerequisite propagators. More...
 
bool hasPartner () const
 Does this have a partner propagator? More...
 
bool isSolved () const
 Has the modified diffusion equation been solved? More...
 
bool isReady () const
 Are all source propagators are solved? More...
 

Detailed Description

template<class TP>
class Pscf::PropagatorTmpl< TP >

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:

class Propagator : public PropagatorTmpl<Propagator>
{
...
};
Template for propagator classes.

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 a member variables that store pointers to other instances of derived class Propagator (or TP).

The Propagator class is used in templates BlockTmpl, PolymerTmpl and SystemTmpl. The usage in those templates require that it define the following public typedefs and member functions:

class Propagator : public PropagatorTmpl<Propagator>
{
public:
// Chemical potential field type.
typedef DArray<double> WField;
// Monomer concentration field type.
typedef DArray<double> CField;
// 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

The typedefs WField and CField define the types of the objects used to represent a chemical potential field for a particular monomer type and a monomer concentration field. In the above example, both of these typenames 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 75 of file PropagatorTmpl.h.

Constructor & Destructor Documentation

◆ PropagatorTmpl()

template<class TP >
Pscf::PropagatorTmpl< TP >::PropagatorTmpl

Constructor.

Definition at line 225 of file PropagatorTmpl.h.

Member Function Documentation

◆ setDirectionId()

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

Associate this propagator with a direction index.

Parameters
directionIddirection = 0 or 1.

Definition at line 236 of file PropagatorTmpl.h.

◆ setPartner()

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

Parameters
partnerreference to partner propagator

Definition at line 243 of file PropagatorTmpl.h.

◆ addSource()

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

Parameters
sourcereference to source propagator

Definition at line 250 of file PropagatorTmpl.h.

◆ setIsSolved()

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

Set the isSolved flag to true or false.

Definition at line 268 of file PropagatorTmpl.h.

◆ source()

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

Get a source propagator.

Parameters
idindex of source propagator, < nSource

Definition at line 201 of file PropagatorTmpl.h.

◆ partner()

template<class TP >
const TP & Pscf::PropagatorTmpl< TP >::partner

Get partner propagator.

Definition at line 257 of file PropagatorTmpl.h.

References UTIL_CHECK.

◆ directionId()

template<class TP >
int Pscf::PropagatorTmpl< TP >::directionId
inline

Get direction index for this propagator.

Definition at line 186 of file PropagatorTmpl.h.

◆ nSource()

template<class TP >
int Pscf::PropagatorTmpl< TP >::nSource
inline

Number of source / prerequisite propagators.

Definition at line 193 of file PropagatorTmpl.h.

◆ hasPartner()

template<class TP >
bool Pscf::PropagatorTmpl< TP >::hasPartner
inline

Does this have a partner propagator?

Definition at line 209 of file PropagatorTmpl.h.

◆ isSolved()

template<class TP >
bool Pscf::PropagatorTmpl< TP >::isSolved
inline

Has the modified diffusion equation been solved?

Definition at line 216 of file PropagatorTmpl.h.

◆ isReady()

template<class TP >
bool Pscf::PropagatorTmpl< TP >::isReady

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