1#ifndef PSCF_POLYMER_TMPL_TPP
2#define PSCF_POLYMER_TMPL_TPP
11#include "PolymerTmpl.h"
40 { blocks_.allocate(
nBlock()); }
65 Vertex const * headPtr =
nullptr;
66 Vertex const * tailPtr =
nullptr;
68 int blockId, forwardId, reverseId, headId, tailId, i;
69 bool isHeadEnd, isTailEnd;
72 for (blockId = 0; blockId <
nBlock(); ++blockId) {
73 for (forwardId = 0; forwardId < 2; ++forwardId) {
75 propagatorPtr = &
block(blockId).propagator(forwardId);
83 headId =
block(blockId).vertexId(forwardId);
84 tailId =
block(blockId).vertexId(reverseId);
89 for (i = 0; i < headPtr->
size(); ++i) {
91 if (propId[0] == blockId) {
95 &block(propId[0]).propagator(propId[1]);
96 propagatorPtr->addSource(*sourcePtr);
101 isHeadEnd = (headPtr->
size() == 1) ? true :
false;
102 isTailEnd = (tailPtr->
size() == 1) ? true :
false;
103 propagatorPtr->setEndFlags(isHeadEnd, isTailEnd);
122 void PolymerTmpl<BT>::isValid()
124 Vertex const * v0Ptr =
nullptr;
125 Vertex const * v1Ptr =
nullptr;
131 for (bId = 0; bId <
nBlock(); ++bId) {
132 v0Id =
block(bId).vertexId(0);
133 v1Id =
block(bId).vertexId(1);
139 p0Ptr = &(
block(bId).propagator(0));
140 p1Ptr = &(
block(bId).propagator(1));
143 UTIL_CHECK(p0Ptr->isHeadEnd() == p1Ptr->isTailEnd());
170 double Q =
block(0).propagator(0).computeQ();
Descriptor for a block within a block polymer.
PolymerSpecies()
Constructor.
virtual void readParameters(std::istream &in)
Read parameters and initialize.
const Vertex & vertex(int id) const
typename BT::PropagatorT PropagatorT
Modified diffusion equation solver for one block, in one direction.
void allocateBlocks() final
Allocate array of Block objects.
void readBlocks(std::istream &in) final
Read array of data for blocks from parameter file.
~PolymerTmpl()
Destructor.
int nPropagator() const
Number of propagators (2*nBlock).
int nBlock() const
Number of blocks.
virtual void readParameters(std::istream &in)
Read and initialize.
PropagatorT & propagator(int blockId, int directionId)
Get the propagator for a specific block and direction (non-const).
virtual void solve(double phiTot=1.0)
Solve modified diffusion equation for all propagators.
PolymerTmpl()
Constructor.
void setQ(double q)
Set q and compute phi or mu (depending on the ensemble).
A junction or chain end in a block polymer.
int size() const
Get the number of attached blocks.
Pair< int > const & inPropagatorId(int i) const
Get the block and direction of an incoming propagator.
An array of exactly 2 objects.
DArrayParam< Type > & readDArray(std::istream &in, const char *label, DArray< Type > &array, int n)
Add and read a required DArray < Type > parameter.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.