PSCF v1.3.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 class Block;
18 using namespace Util;
19
25 class Propagator : public PropagatorTmpl<Propagator>
26 {
27
28 public:
29
30 // Public typedefs
31
36
37 // Member functions
38
42 Propagator();
43
48
54 void setBlock(Block& block);
55
62 void allocate(int ns, int nx);
63
77 void reallocate(int ns);
78
88 void solve();
89
100 void solve(const FieldT& head);
101
110 double computeQ();
111
117 FieldT const & q(int i) const;
118
122 FieldT const & head() const;
123
127 FieldT const & tail() const;
128
137 int ns() const;
138
142 bool isAllocated() const;
143
144 private:
145
147 DArray<FieldT> qFields_;
148
150 FieldT work_;
151
153 Block* blockPtr_;
154
156 int ns_;
157
159 int nx_;
160
162 bool isAllocated_;
163
167 Block & block();
168
172 void computeHead();
173
174 };
175
176 // Inline member functions
177
178 /*
179 * Return q-field at beginning of block.
180 */
182 { return qFields_[0]; }
183
184 /*
185 * Return q-field at end of block, after solution.
186 */
188 { return qFields_[ns_-1]; }
189
190 /*
191 * Return q-field at specified step.
192 */
193 inline Propagator::FieldT const& Propagator::q(int i) const
194 { return qFields_[i]; }
195
196 /*
197 * Get the associated Block object.
198 */
199 inline Block& Propagator::block()
200 {
201 assert(blockPtr_);
202 return *blockPtr_;
203 }
204
205 /*
206 * Get the number of counter grid points.
207 */
208 inline int Propagator::ns() const
209 { return ns_; }
210
211 /*
212 * Associate this propagator with a block and direction
213 */
214 inline void Propagator::setBlock(Block& block)
215 { blockPtr_ = &block; }
216
217}
218}
219#endif
Block within a block polymer.
FieldT const & head() const
Return q-field at beginning of block (initial condition).
bool isAllocated() const
Has memory been allocated for this propagator?
FieldT const & tail() const
Return q-field at end of block.
FieldT const & q(int i) const
Return q-field at specified step.
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.
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.
DArray< double > FieldT
Generic field (function of position).
Dynamically allocatable contiguous array template.
Definition DArray.h:32
SCFT with real 1D fields.
PSCF package top-level namespace.