PSCF v1.1
fd1d/solvers/Propagator.h
1#ifndef FD1D_PROPAGATOR_H
2#define FD1D_PROPAGATOR_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/solvers/PropagatorTmpl.h> // base class template
12#include <util/containers/DArray.h> // member template
13
14namespace Pscf {
15namespace Fd1d
16{
17
18 class Block;
19 using namespace Util;
20
26 class Propagator : public PropagatorTmpl<Propagator>
27 {
28
29 public:
30
31 // Public typedefs
32
37
42
47
52
53 // Member functions
54
58 Propagator();
59
64
70 void setBlock(Block& block);
71
78 void allocate(int ns, int nx);
79
93 void reallocate(int ns);
94
104 void solve();
105
116 void solve(const QField& head);
117
126 double computeQ();
127
133 QField const & q(int i) const;
134
138 QField const & head() const;
139
143 QField const & tail() const;
144
153 int ns() const;
154
158 bool isAllocated() const;
159
160 private:
161
163 DArray<QField> qFields_;
164
166 QField work_;
167
169 Block* blockPtr_;
170
172 int ns_;
173
175 int nx_;
176
178 bool isAllocated_;
179
183 Block & block();
184
188 void computeHead();
189
190 };
191
192 // Inline member functions
193
194 /*
195 * Return q-field at beginning of block.
196 */
198 { return qFields_[0]; }
199
200 /*
201 * Return q-field at end of block, after solution.
202 */
204 { return qFields_[ns_-1]; }
205
206 /*
207 * Return q-field at specified step.
208 */
209 inline Propagator::QField const& Propagator::q(int i) const
210 { return qFields_[i]; }
211
212 /*
213 * Get the associated Block object.
214 */
215 inline Block& Propagator::block()
216 {
217 assert(blockPtr_);
218 return *blockPtr_;
219 }
220
221 /*
222 * Get the number of counter grid points.
223 */
224 inline int Propagator::ns() const
225 { return ns_; }
226
227 /*
228 * Associate this propagator with a block and direction
229 */
230 inline void Propagator::setBlock(Block& block)
231 { blockPtr_ = &block; }
232
233}
234}
235#endif
Block within a branched polymer.
MDE solver for one-direction of one block.
DArray< double > QField
Propagator q-field type.
void solve()
Solve the modified diffusion equation (MDE) for this block.
QField const & tail() const
Return q-field at end of block.
void setBlock(Block &block)
Associate this propagator with a block.
double computeQ()
Compute and return partition function for the molecule.
void reallocate(int ns)
Reallocate memory used by this propagator.
DArray< double > CField
Monomer concentration field type.
QField const & head() const
Return q-field at beginning of block (initial condition).
DArray< double > Field
Generic field (function of position).
DArray< double > WField
Chemical potential field type.
int ns() const
Number of values of s (or slices), including head and tail.
bool isAllocated() const
Has memory been allocated for this propagator?
void allocate(int ns, int nx)
Set discretization and allocate memory.
QField const & q(int i) const
Return q-field at specified step.
Template for propagator classes.
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1