PSCF v1.3
|
Descriptor for a block within a block polymer. More...
#include <Edge.h>
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. |
Descriptor for a block within a block polymer.
An Edge has:
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.
Pscf::Edge::Edge | ( | ) |
void Pscf::Edge::serialize | ( | Archive & | ar, |
unsigned int | versionId ) |
void Pscf::Edge::setId | ( | int | id | ) |
Set the id for this block.
id | integer 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().
void Pscf::Edge::setMonomerId | ( | int | monomerId | ) |
Set the monomer type id.
monomerId | integer id of monomer type |
Definition at line 44 of file Edge.cpp.
References monomerId().
Referenced by Pscf::Rpg::Block< D >::averageProductBead().
void Pscf::Edge::setVertexIds | ( | int | vertexId0, |
int | vertexId1 ) |
Set indices of associated vertices.
vertexId0 | integer id of vertex 0 |
vertexId1 | integer id of vertex 1 |
Definition at line 50 of file Edge.cpp.
Referenced by Pscf::Rpg::Block< D >::averageProductBead(), and Pscf::PolymerSpecies::readParameters().
|
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()
length | block 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().
|
virtual |
Set the number of beads in this block (only valid for bead model).
Precondition: PolymerModel::isBead()
nBead | number of beads (bead model) |
Definition at line 59 of file Edge.cpp.
References Pscf::PolymerModel::isBead(), nBead(), and UTIL_CHECK.
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.
type | type of polymer (branched or linear) |
Definition at line 77 of file Edge.cpp.
Referenced by Pscf::PolymerSpecies::readParameters().
|
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().
|
inline |
Get the monomer type id for this block.
Definition at line 284 of file Edge.h.
Referenced by Pscf::Rpg::Block< D >::averageProductBead(), Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::FloryHuggins::Mixture::initialize(), and setMonomerId().
|
inline |
Get the pair of associated vertex ids.
Definition at line 290 of file Edge.h.
Referenced by Pscf::Rpg::Block< D >::averageProductBead().
|
inline |
Get the id of one associated vertex.
i | index of vertex (0 or 1) |
Definition at line 296 of file Edge.h.
Referenced by Pscf::Vertex::addEdge(), Pscf::Rpg::Block< D >::averageProductBead(), Pscf::PolymerSpecies::makePaths(), Pscf::PolymerSpecies::makePlan(), Pscf::EdgeIterator::operator++(), Pscf::VertexIterator::operator++(), and Pscf::PolymerSpecies::readParameters().
|
inline |
Get the length of this block, in the thread model.
Precondition: PolymerModel::isThread()
Definition at line 311 of file Edge.h.
References Pscf::PolymerModel::isThread(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::averageProductBead(), Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::FloryHuggins::Mixture::initialize(), Pscf::PolymerSpecies::length(), Pscf::R1d::Block::setDiscretization(), setLength(), Pscf::R1d::Block::setLength(), and Pscf::R1d::Block::setupSolver().
|
inline |
Get the number of beads in this block, in the bead model.
Precondition: PolymerModel::isBead()
Definition at line 302 of file Edge.h.
References Pscf::PolymerModel::isBead(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::averageProductBead(), Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::PolymerSpecies::nBead(), and setNBead().
|
inline |
|
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:
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:
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.
in | input stream |
block | Edge to be read from stream |
Definition at line 83 of file Edge.cpp.
References Edge().
|
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.
out | output stream |
block | Edge to be written to stream |
Definition at line 108 of file Edge.cpp.
References Edge(), Pscf::PolymerModel::isBead(), and Pscf::PolymerModel::isThread().