PSCF v1.3
r1d/solvers/Propagator.h
1#ifndef R1D_PROPAGATOR_H
2#define R1D_PROPAGATOR_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/solvers/PropagatorTmpl.h> // base class template
12#include <util/containers/DArray.h> // member template
13
14namespace Pscf {
15namespace R1d
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
43 // Member functions
44
48 Propagator();
49
54
60 void setBlock(Block& block);
61
68 void allocate(int ns, int nx);
69
83 void reallocate(int ns);
84
94 void solve();
95
106 void solve(const QFieldT& head);
107
116 double computeQ();
117
123 QFieldT const & q(int i) const;
124
128 QFieldT const & head() const;
129
133 QFieldT const & tail() const;
134
143 int ns() const;
144
148 bool isAllocated() const;
149
150 private:
151
153 DArray<QFieldT> qFields_;
154
156 QFieldT work_;
157
159 Block* blockPtr_;
160
162 int ns_;
163
165 int nx_;
166
168 bool isAllocated_;
169
173 Block & block();
174
178 void computeHead();
179
180 };
181
182 // Inline member functions
183
184 /*
185 * Return q-field at beginning of block.
186 */
188 { return qFields_[0]; }
189
190 /*
191 * Return q-field at end of block, after solution.
192 */
194 { return qFields_[ns_-1]; }
195
196 /*
197 * Return q-field at specified step.
198 */
199 inline Propagator::QFieldT const& Propagator::q(int i) const
200 { return qFields_[i]; }
201
202 /*
203 * Get the associated Block object.
204 */
205 inline Block& Propagator::block()
206 {
207 assert(blockPtr_);
208 return *blockPtr_;
209 }
210
211 /*
212 * Get the number of counter grid points.
213 */
214 inline int Propagator::ns() const
215 { return ns_; }
216
217 /*
218 * Associate this propagator with a block and direction
219 */
220 inline void Propagator::setBlock(Block& block)
221 { blockPtr_ = &block; }
222
223}
224}
225#endif
Block within a branched polymer.
QFieldT const & q(int i) const
Return q-field at specified step.
DArray< double > FieldT
Generic field (function of position).
DArray< double > QFieldT
Propagator q-field type.
bool isAllocated() const
Has memory been allocated for this propagator?
QFieldT const & tail() const
Return q-field at end of block.
int ns() const
Number of values of s (or slices), including head and tail.
void setBlock(Block &block)
Associate this propagator with a block.
void solve()
Solve the modified diffusion equation (MDE) for this block.
QFieldT const & head() const
Return q-field at beginning of block (initial condition).
double computeQ()
Compute and return partition function for the molecule.
void reallocate(int ns)
Reallocate memory used by this propagator.
void allocate(int ns, int nx)
Set discretization and allocate memory.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
SCFT with real 1D fields.
PSCF package top-level namespace.
Definition param_pc.dox:1