PSCF v1.3
Pscf::Edge Class Reference

Descriptor for a block within a block polymer. More...

#include <Edge.h>

Inheritance diagram for Pscf::Edge:
Pscf::BlockTmpl< Propagator< D > > Pscf::BlockTmpl< Propagator > Pscf::BlockTmpl< QT > Pscf::Rpc::Block< D > Pscf::Rpg::Block< D > Pscf::R1d::Block

Public Member Functions

 Edge ()
 Constructor.
virtual ~Edge ()
 Destructor.
template<class Archive>
void serialize (Archive &ar, unsigned int versionId)
 Serialize to/from archive.
Setters
void setId (int id)
 Set the id for this block.
void setMonomerId (int monomerId)
 Set the monomer type id.
void setVertexIds (int vertexId0, int vertexId1)
 Set indices of associated vertices.
virtual void setLength (double length)
 Set the length of this block (only valid for thread model).
virtual void setNBead (int nBead)
 Set the number of beads in this block (only valid for bead model).
void setPolymerType (PolymerType::Enum type)
 Set the type of the parent polymer (branched or linear).

Accessors (getters)

int id () const
 Get the id of this block (unique within the polymer).
int monomerId () const
 Get the monomer type id for this block.
const Pair< int > & vertexIds () const
 Get the pair of associated vertex ids.
int vertexId (int i) const
 Get the id of one associated vertex.
double length () const
 Get the length of this block, in the thread model.
int nBead () const
 Get the number of beads in this block, in the bead model.
PolymerType::Enum polymerType () const
 Get the type of the parent polymer (branched or linear).
std::istream & operator>> (std::istream &in, Edge &block)
 Input stream extractor (>>) for a Edge.
std::ostream & operator<< (std::ostream &out, const Edge &block)
 Output stream inserter (<<) for a Edge.

Detailed Description

Descriptor for a block within a block polymer.

An Edge has:

  • a monomer type id
  • a length (thread model) or number of beads (bead model)
  • a block id (unique among blocks of the same polymer species)
  • vertex ids for the two vertices at which it terminates

Edge is a base class for the BlockTmpl class template, which is a a base class for a class named Block in each implementation-level sub-namespace of Pscf (i.e., in R1d, Rpc, or Rpg).

An Edge is a descriptor for a block within a block polymer, but does not provide functions or data structure needed to solve the modified diffusion equation (MDE). The Block class defined in each implementation-level namespace is designed to be used as an MDE solver as well as a descriptor.

An Edge can store either a value for length (the contour length of the block) when PolymerModel::isThread(), or a value for nBead (the number of beads in the block) when PolymerModel::isBead(), but not both. It is an error to get or set a value for the length when a bead model is in use or to get or set a value for nBead when a thread model is in use, because these variables are each meaningful only in the context of a specific model.

Block objects associated with a polymer are normally stored in an array that is a private member of the Pscf::PolymerTmpl class template. The block id for each Edge should be set to the element index of the associated Block within that array.

Parameter File Format

Definition at line 58 of file Edge.h.

Constructor & Destructor Documentation

◆ Edge()

Pscf::Edge::Edge ( )

Constructor.

Definition at line 16 of file Edge.cpp.

Referenced by operator<<, and operator>>.

◆ ~Edge()

Pscf::Edge::~Edge ( )
virtual

Destructor.

Definition at line 32 of file Edge.cpp.

Member Function Documentation

◆ serialize()

template<class Archive>
void Pscf::Edge::serialize ( Archive & ar,
unsigned int versionId )

Serialize to/from archive.

Parameters
arinput or output Archive
versionIdarchive format version index

Definition at line 327 of file Edge.h.

◆ setId()

void Pscf::Edge::setId ( int id)

Set the id for this block.

Parameters
idinteger index for this block

Definition at line 38 of file Edge.cpp.

References id().

Referenced by Pscf::Rpg::Block< D >::averageProductBead(), and Pscf::PolymerSpecies::readParameters().

◆ setMonomerId()

void Pscf::Edge::setMonomerId ( int monomerId)

Set the monomer type id.

Parameters
monomerIdinteger id of monomer type

Definition at line 44 of file Edge.cpp.

References monomerId().

Referenced by Pscf::Rpg::Block< D >::averageProductBead().

◆ setVertexIds()

void Pscf::Edge::setVertexIds ( int vertexId0,
int vertexId1 )

Set indices of associated vertices.

Parameters
vertexId0integer id of vertex 0
vertexId1integer id of vertex 1

Definition at line 50 of file Edge.cpp.

Referenced by Pscf::Rpg::Block< D >::averageProductBead(), and Pscf::PolymerSpecies::readParameters().

◆ setLength()

void Pscf::Edge::setLength ( double length)
virtual

Set the length of this block (only valid for thread model).

In the continuous thread model, the length of a block is given by the ratio of block steric volume / monomer reference volume.

Precondition: PolymerModel::isThread()

Parameters
lengthblock length (thread model).

Reimplemented in Pscf::R1d::Block, Pscf::Rpc::Block< D >, and Pscf::Rpg::Block< D >.

Definition at line 68 of file Edge.cpp.

References Pscf::PolymerModel::isThread(), length(), and UTIL_CHECK.

Referenced by Pscf::Rpg::Block< D >::averageProductBead(), Pscf::R1d::Block::setLength(), Pscf::Rpc::Block< D >::setLength(), and Pscf::Rpg::Block< D >::setLength().

◆ setNBead()

void Pscf::Edge::setNBead ( int nBead)
virtual

Set the number of beads in this block (only valid for bead model).

Precondition: PolymerModel::isBead()

Parameters
nBeadnumber of beads (bead model)

Definition at line 59 of file Edge.cpp.

References Pscf::PolymerModel::isBead(), nBead(), and UTIL_CHECK.

◆ setPolymerType()

void Pscf::Edge::setPolymerType ( PolymerType::Enum type)

Set the type of the parent polymer (branched or linear).

By convention, if the polymer type is PolymerType::Linear, then vertexId(0) = id and vertexId(1) = id + 1 for block number id. By using this convention, the stream insertion and extraction operators for an Edge can thus use a shorter string representation for linear polymers in which vertex ids are omitted.

Parameters
typetype of polymer (branched or linear)

Definition at line 77 of file Edge.cpp.

Referenced by Pscf::PolymerSpecies::readParameters().

◆ id()

int Pscf::Edge::id ( ) const
inline

Get the id of this block (unique within the polymer).

Definition at line 278 of file Edge.h.

Referenced by Pscf::Vertex::addEdge(), Pscf::Rpg::Block< D >::averageProductBead(), and setId().

◆ monomerId()

◆ vertexIds()

const Pair< int > & Pscf::Edge::vertexIds ( ) const
inline

Get the pair of associated vertex ids.

Definition at line 290 of file Edge.h.

Referenced by Pscf::Rpg::Block< D >::averageProductBead().

◆ vertexId()

int Pscf::Edge::vertexId ( int i) const
inline

◆ length()

◆ nBead()

int Pscf::Edge::nBead ( ) const
inline

◆ polymerType()

PolymerType::Enum Pscf::Edge::polymerType ( ) const
inline

Get the type of the parent polymer (branched or linear).

Definition at line 320 of file Edge.h.

◆ operator>>

std::istream & operator>> ( std::istream & in,
Edge & block )
friend

Input stream extractor (>>) for a Edge.

The polymerType must be set before an Edge can be read from a stream. The block id must be set explicitly by calling setId, and are not read from an istream. Vertex id values for blocks in a linear polymer must be set explicitly by calling setVertexIds with consecutive values, as done in the function Pscf::PolymerTmpl::readParameters.

Different text representations are used for bead and thread models, and for linear and branched polymers:

Thread model:

In the thread model, if PolymerModel::isThread(), the text representation of an Edge for a branched polymer is:

monomerId length vertexId(0) vertexid(1)
int monomerId() const
Get the monomer type id for this block.
Definition Edge.h:284
int vertexId(int i) const
Get the id of one associated vertex.
Definition Edge.h:296
double length() const
Get the length of this block, in the thread model.
Definition Edge.h:311

Here, length is a floating point number. For a linear polymer in the thread model, the vertex ids are omitted, because the vertex ids for block id of linear polymer must be equal to id and id + 1.

Bead model:

In the bead model, if PolymerModel::isBead(), the text representation for a branched polymer is:

monomerId nBead vertexId(0) vertexid(1)
int nBead() const
Get the number of beads in this block, in the bead model.
Definition Edge.h:302

where nBead is the integer number of beads in the chain. The corresponding text representation for a bead-spring linear chain omits the vertex ids, as for the thread model.

Parameters
ininput stream
blockEdge to be read from stream
Returns
modified input stream

Definition at line 83 of file Edge.cpp.

References Edge().

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const Edge & block )
friend

Output stream inserter (<<) for a Edge.

Different text representations are used for linear and branched polymers, as discussed in documentation for the stream extractor (>>) operator. Vertex ids are output only for blocks of branched polymers.

Parameters
outoutput stream
blockEdge to be written to stream
Returns
modified output stream

Definition at line 108 of file Edge.cpp.

References Edge(), Pscf::PolymerModel::isBead(), and Pscf::PolymerModel::isThread().


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