PSCF v1.4.0
rp/solvers/Polymer.h
1#ifndef RP_POLYMER_H
2#define RP_POLYMER_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/PolymerTmpl.h> // base class template
12#include <util/containers/FSArray.h> // member template
13
14// Forward declarations
15namespace Util {
16 template <typename T> class DArray;
17}
18
19namespace Pscf {
20namespace Rp {
21
22 using namespace Util;
23
45 template <int D, class T>
46 class Polymer
47 : public PolymerTmpl<typename T::Block, typename T::Propagator, double>
48 {
49
50 public:
51
52 // Public type name aliases
53
55 using BlockT = typename T::Block;
56
58 using PropagatorT = typename T::Propagator;
59
62
64 using typename PolymerTmplT::PolymerSpeciesT;
65
67 using typename PolymerTmplT::SpeciesT;
68
69 // Public member functions
70
76 void setNParams(int nParam);
77
85 void clearUnitCellData();
86
105 void compute(DArray<typename T::RField> const & wFields,
106 double phiTot = 1.0);
107
117 void computeStress();
118
128 double stress(int n) const;
129
130 // Inherited non-dependent public member functions
131 using PolymerTmplT::edge;
143 using SpeciesT::phi;
144 using SpeciesT::mu;
145 using SpeciesT::q;
146 using SpeciesT::ensemble;
147 using SpeciesT::setPhi;
148 using SpeciesT::setMu;
149
150 protected:
151
155 Polymer();
156
160 ~Polymer();
161
162 private:
163
165 FSArray<double, 6> stress_;
166
168 int nParam_;
169
170 // Restrict access to inherited functions
172 using SpeciesT::setQ;
173
174 };
175
177 template <int D, class T> inline
178 double Polymer<D,T>::stress(int n) const
179 { return stress_[n]; }
180
181} // namespace Rp
182} // namespace Pscf
183#endif
Pair< int > const & path(int is, int it) const
const Vertex & vertex(int id) const
Pair< int > const & propagatorId(int id) const
PolymerType::Enum type() const
PropagatorT & propagator(int blockId, int directionId)
virtual void solve(double phiTot=1.0)
typename T::Block BlockT
Block type, for a block within a block polymer.
void setNParams(int nParam)
Set the number of unit cell parameters.
void compute(DArray< typename T::RField > const &wFields, double phiTot=1.0)
Compute MDE solutions and block concentrations.
void clearUnitCellData()
Clear all data that depends on unit cell parameters.
typename T::Propagator PropagatorT
Propagator type, for one direction within a block.
double stress(int n) const
Get the precomputed contribution to stress from this species.
PolymerTmpl< BlockT, PropagatorT, double > PolymerTmplT
Direct base class, specialization of PolymerTmpl class template.
void computeStress()
Compute SCFT stress contribution from this polymer species.
void setMu(double mu)
Ensemble ensemble() const
void setPhi(double phi)
Dynamically allocatable contiguous array template.
Definition DArray.h:32
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
Class templates for real-valued periodic fields.
PSCF package top-level namespace.
Utility classes for scientific computation.