PSCF v1.1
BlockTmpl.h
1#ifndef PSCF_BLOCK_TMPL_H
2#define PSCF_BLOCK_TMPL_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/chem/BlockDescriptor.h> // base class
12#include <util/containers/Pair.h> // member template
13
14#include <cmath>
15
16namespace Pscf
17{
18
19 using namespace Util;
20
87 template <class TP>
89 {
90
91 public:
92
93 // Modified diffusion equation propagator for one block.
94 typedef TP Propagator;
95
96 // Monomer concentration field.
97 typedef typename TP::CField CField;
98
99 // Chemical potential field.
100 typedef typename TP::WField WField;
101
106
110 virtual ~BlockTmpl();
111
117 virtual void setKuhn(double kuhn);
118
128 TP& propagator(int directionId);
129
137 TP const & propagator(int directionId) const;
138
142 typename TP::CField& cField();
143
147 typename TP::CField const & cField() const;
148
152 double kuhn() const;
153
154 private:
155
157 Pair<Propagator> propagators_;
158
160 CField cField_;
161
163 double kuhn_;
164
165 };
166
167 // Inline member functions
168
169 /*
170 * Get a Propagator indexed by direction.
171 */
172 template <class TP>
173 inline
174 TP& BlockTmpl<TP>::propagator(int directionId)
175 { return propagators_[directionId]; }
176
177 /*
178 * Get a const Propagator indexed by direction.
179 */
180 template <class TP>
181 inline
182 TP const & BlockTmpl<TP>::propagator(int directionId) const
183 { return propagators_[directionId]; }
184
185 /*
186 * Get the monomer concentration field.
187 */
188 template <class TP>
189 inline
190 typename TP::CField& BlockTmpl<TP>::cField()
191 { return cField_; }
192
193 /*
194 * Get the const monomer concentration field.
195 */
196 template <class TP>
197 inline
198 typename TP::CField const & BlockTmpl<TP>::cField() const
199 { return cField_; }
200
201 /*
202 * Get the monomer statistical segment length.
203 */
204 template <class TP>
205 inline double BlockTmpl<TP>::kuhn() const
206 { return kuhn_; }
207
208 // Non-inline functions
209
210 /*
211 * Constructor.
212 */
213 template <class TP>
215 : propagators_(),
216 cField_(),
217 kuhn_(0.0)
218 {
219 propagator(0).setDirectionId(0);
220 propagator(1).setDirectionId(1);
221 propagator(0).setPartner(propagator(1));
222 propagator(1).setPartner(propagator(0));
223 }
224
225 /*
226 * Destructor.
227 */
228 template <class TP>
230 {}
231
232 /*
233 * Set the monomer statistical segment length.
234 */
235 template <class TP>
236 void BlockTmpl<TP>::setKuhn(double kuhn)
237 { kuhn_ = kuhn; }
238
239}
240#endif
Description of a linear homopolymer block within a block polymer.
Class template for a block in a block copolymer.
Definition: BlockTmpl.h:89
virtual ~BlockTmpl()
Destructor.
Definition: BlockTmpl.h:229
double kuhn() const
Get monomer statistical segment length.
Definition: BlockTmpl.h:205
BlockTmpl()
Constructor.
Definition: BlockTmpl.h:214
virtual void setKuhn(double kuhn)
Set monomer statistical segment length.
Definition: BlockTmpl.h:236
TP & propagator(int directionId)
Get a Propagator for a specified direction.
Definition: BlockTmpl.h:174
TP::CField & cField()
Get the associated monomer concentration field.
Definition: BlockTmpl.h:190
TP const & propagator(int directionId) const
Get a const Propagator for a specified direction.
Definition: BlockTmpl.h:182
TP::CField const & cField() const
Get the associated const monomer concentration field.
Definition: BlockTmpl.h:198
An array of exactly 2 objects.
Definition: Pair.h:24
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1