1#ifndef RP_PROPAGATOR_BASE_TPP
2#define RP_PROPAGATOR_BASE_TPP
11#include <rp/solvers/PropagatorBase.h>
12#include <rp/solvers/Block.h>
13#include <pscf/field/RField.h>
15#include <pscf/backend/Reduce.h>
16#include <pscf/backend/VecOp.h>
17#include <pscf/mesh/Mesh.h>
27 template <
int D,
class T>
33 hasComputedHead_(false)
39 template <
int D,
class T>
46 template <
int D,
class T>
57 template <
int D,
class T>
69 template <
int D,
class T>
85 for (
int is = 0; is <
ns; ++is) {
87 UTIL_THROW(
"Source not solved in computeHead");
93 hasComputedHead_ =
true;
102 template <
int D,
class T>
107 hasComputedHead_ =
false;
120 template <
int D,
class T>
129 hasComputedHead_ =
false;
144 template <
int D,
class T>
153 for (
int iStep = 0; iStep <
ns_ - 1; ++iStep) {
170 for (iStep = 1; iStep <
ns_ - 2; ++iStep) {
194 template <
int D,
class T>
207 UTIL_THROW(
"Partner propagator is not solved");
214 if (hasComputedHead_) {
226 Q /= double(
mesh().size());
Description of a regular grid of points in a periodic domain.
void setIsSolved(bool isSolved)
int ns_
Number of slices, including head and tail slices.
virtual void reallocate(int ns)
Reallocate memory used by this propagator.
const Propagator< D, T > & partner() const
Get partner propagator.
int ns() const
Get the number of values of s (or slices), including head and tail.
void solve()
Solve the modified diffusion equation (MDE) for this block.
void solveMde()
Compute solution of modified diffusion equation (MDE).
RField< D, T > const & q(int i) const
Return q-field at a specified step.
DArray< RField< D, T > > qFields_
Array of propagator slices at different contour variable values.
Mesh< D > const & mesh() const
Return the associated Mesh object by const reference.
RField< D, T > const & head() const
Return q-field at the initial (head) vertex.
PropagatorBase()
Constructor.
virtual void allocate(int ns, const Mesh< D > &mesh)
Allocate memory used by this propagator.
RField< D, T > const & tail() const
Return q-field at the terminal (tail) vertex.
const Propagator< D, T > & source(int id) const
Get a source propagator.
bool isAllocated_
Is this propagator allocated?
Block< D, T > const & block() const
Get the associated Block object by const reference.
~PropagatorBase()
Destructor.
void computeQ(double &Q) const
Compute and return partition function for the polymer molecule.
void computeHead()
Compute initial q-field at the head vertex.
#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.
double innerProduct(Array< double > const &a, Array< double > const &b)
Compute Euclidean inner product of two real arrays .
double sum(Array< double > const &in)
Compute sum of array elements (real).
void mulEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place multiplication, a[i] *= b[i] (real).
void eqV(Array< double > &a, Array< double > const &b, const int beginIdA, const int beginIdB, const int n)
Vector assignment, a[i] = b[i] (real, slice).
void eqS(Array< double > &a, double b)
Vector assignment, a[i] = b (real).
bool isThread()
Is the thread model in use ?
bool isBead()
Is the bead model in use ?
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.