10#include <fd1d/domain/Domain.h>
41 qFields_.allocate(
ns);
42 for (
int i = 0; i <
ns; ++i) {
43 qFields_[i].allocate(nx);
62 qFields_.deallocate();
65 qFields_.allocate(
ns);
66 for (
int i = 0; i <
ns; ++i) {
67 qFields_[i].allocate(nx_);
73 {
return isAllocated_; }
78 void Propagator::computeHead()
86 for (ix = 0; ix < nx_; ++ix) {
91 for (
int is = 0; is <
nSource(); ++is) {
92 if (!
source(is).isSolved()) {
93 UTIL_THROW(
"Source not solved in computeHead");
96 for (ix = 0; ix < nx_; ++ix) {
108 for (
int iStep = 0; iStep < ns_ - 1; ++iStep) {
109 block().
step(qFields_[iStep], qFields_[iStep + 1]);
121 for (
int i = 0; i < nx_; ++i) {
126 for (
int iStep = 0; iStep < ns_ - 1; ++iStep) {
127 block().
step(qFields_[iStep], qFields_[iStep + 1]);
144 UTIL_THROW(
"Partner propagator is not solved");
Domain const & domain() const
Return associated domain by reference.
void step(DArray< double > const &q, DArray< double > &qNew)
Compute one step of integration loop, from i to i+1.
double innerProduct(Field const &f, Field const &g) const
Compute inner product of two real fields.
DArray< double > QField
Propagator q-field type.
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.
QField const & head() const
Return q-field at beginning of block (initial condition).
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.
void setIsSolved(bool isSolved)
Set the isSolved flag to true or false.
const Propagator & partner() const
Get partner propagator.
const Propagator & source(int id) const
Get a source propagator.
bool isSolved() const
Has the modified diffusion equation been solved?
bool hasPartner() const
Does this have a partner propagator?
int nSource() const
Number of source / prerequisite propagators.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.