PSCF v1.3
BlockTmpl.h
1#ifndef PSCF_BLOCK_TMPL_H
2#define PSCF_BLOCK_TMPL_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/chem/Edge.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
105 template <class QT>
106 class BlockTmpl : public Edge
107 {
108
109 public:
110
111 // Public typename alias
112
116 using PropagatorT = QT;
117
118 // Public member functions
119
124
128 virtual ~BlockTmpl();
129
135 virtual void setKuhn(double kuhn);
136
146 QT& propagator(int directionId);
147
155 QT const & propagator(int directionId) const;
156
160 typename QT::FieldT& cField();
161
165 typename QT::FieldT const & cField() const;
166
170 double kuhn() const;
171
172 private:
173
175 Pair<PropagatorT> propagators_;
176
178 typename QT::FieldT cField_;
179
181 double kuhn_;
182
183 };
184
185 // Inline member functions
186
187 /*
188 * Get a Propagator indexed by direction.
189 */
190 template <class QT>
191 inline
192 QT& BlockTmpl<QT>::propagator(int directionId)
193 { return propagators_[directionId]; }
194
195 /*
196 * Get a const Propagator indexed by direction.
197 */
198 template <class QT>
199 inline
200 QT const & BlockTmpl<QT>::propagator(int directionId) const
201 { return propagators_[directionId]; }
202
203 /*
204 * Get the monomer concentration field.
205 */
206 template <class QT>
207 inline
208 typename QT::FieldT& BlockTmpl<QT>::cField()
209 { return cField_; }
210
211 /*
212 * Get the const monomer concentration field.
213 */
214 template <class QT>
215 inline
216 typename QT::FieldT const & BlockTmpl<QT>::cField() const
217 { return cField_; }
218
219 /*
220 * Get the monomer statistical segment length.
221 */
222 template <class QT>
223 inline double BlockTmpl<QT>::kuhn() const
224 { return kuhn_; }
225
226 // Non-inline functions
227
228 /*
229 * Constructor.
230 */
231 template <class QT>
233 : propagators_(),
234 cField_(),
235 kuhn_(0.0)
236 {
237 propagator(0).setDirectionId(0);
238 propagator(1).setDirectionId(1);
239 propagator(0).setPartner(propagator(1));
240 propagator(1).setPartner(propagator(0));
241 }
242
243 /*
244 * Destructor.
245 */
246 template <class QT>
249
250 /*
251 * Set the monomer statistical segment length.
252 */
253 template <class QT>
255 { kuhn_ = kuhn; }
256
257}
258#endif
QT::FieldT const & cField() const
Get the associated const monomer concentration field.
Definition BlockTmpl.h:216
QT PropagatorT
Modified diffusion equation solver (propagator) type.
Definition BlockTmpl.h:116
QT & propagator(int directionId)
Get a Propagator for a specified direction.
Definition BlockTmpl.h:192
virtual void setKuhn(double kuhn)
Set monomer statistical segment length.
Definition BlockTmpl.h:254
BlockTmpl()
Constructor.
Definition BlockTmpl.h:232
QT const & propagator(int directionId) const
Get a const Propagator for a specified direction.
Definition BlockTmpl.h:200
QT::FieldT & cField()
Get the associated monomer concentration field.
Definition BlockTmpl.h:208
virtual ~BlockTmpl()
Destructor.
Definition BlockTmpl.h:247
Edge()
Constructor.
Definition Edge.cpp:16
An array of exactly 2 objects.
Definition Pair.h:24
PSCF package top-level namespace.
Definition param_pc.dox:1