PSCF v1.5.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 - 2026, David Morse (morse012@um.edu) and co-authors
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#include <pscf/backend/TmplDeclare.h> // template declaration macros
15
16// Forward declarations
17namespace Util {
18 template <typename T> class DArray;
19}
20namespace Pscf {
21 template <int D, class T> class RField;
22 namespace Rp {
23 template <int D, class T> class Propagator;
24 template <int D, class T> class Block;
25 }
26}
27
28namespace Pscf {
29namespace Rp {
30
31 using namespace Util;
32
49 template <int D, class T>
50 class Polymer
51 : public PolymerTmpl<Block<D,T>, Propagator<D,T>, double>
52 {
53
54 public:
55
56 // Public member functions
57
61 Polymer();
62
66 ~Polymer();
67
73 void setNParams(int nParam);
74
82 void clearUnitCellData();
83
102 void compute(DArray< RField<D,T> > const & wFields,
103 double phiTot = 1.0);
104
114 void computeStress();
115
125 double stress(int n) const;
126
127 // Public type name aliases
128
131
134
137
139 using typename PolymerTmplT::PolymerSpeciesT;
140
142 using typename PolymerTmplT::SpeciesT;
143
144 // Inherited non-dependent public member functions (for convenience)
149 using SpeciesT::phi;
150 using SpeciesT::mu;
151 using SpeciesT::q;
152 using SpeciesT::ensemble;
153
154 private:
155
157 FSArray<double, 6> stress_;
158
160 int nParam_;
161
162 // Restrict access to inherited functions
164 using SpeciesT::setQ;
165
166 };
167
168 // Get stress component n.
169 template <int D, class T> inline
170 double Polymer<D,T>::stress(int n) const
171 { return stress_[n]; }
172
173 // Explicit instantiation declarations
174 PSCF_TMPL_DECLARE(Polymer)
175
176} // namespace Rp
177} // namespace Pscf
178
179// Explicit instantiation declarations for base class specializations
180namespace Pscf {
181 #ifdef PSCF_CPP
182 class CPT;
183 extern template
184 class PolymerTmpl<Rp::Block<1,CPT>, Rp::Propagator<1,CPT>, double>;
185 extern template
186 class PolymerTmpl<Rp::Block<2,CPT>, Rp::Propagator<2,CPT>, double>;
187 extern template
188 class PolymerTmpl<Rp::Block<3,CPT>, Rp::Propagator<3,CPT>, double>;
189 #endif
190 #ifdef PSCF_CUDA
191 class CUT;
192 extern template
193 class PolymerTmpl<Rp::Block<1,CUT>, Rp::Propagator<1,CUT>, double>;
194 extern template
195 class PolymerTmpl<Rp::Block<2,CUT>, Rp::Propagator<2,CUT>, double>;
196 extern template
197 class PolymerTmpl<Rp::Block<3,CUT>, Rp::Propagator<3,CUT>, double>;
198 #endif
199}
200
201#endif
virtual void solve(double phiTot=1.0)
Descriptor and MDE solver for one polymer species.
void setNParams(int nParam)
Set the number of unit cell parameters.
void clearUnitCellData()
Clear all data that depends on unit cell parameters.
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.
Propagator< D, T > PropagatorT
Propagator type, for one direction within a block.
Block< D, T > BlockT
Block type, for a block within a block polymer.
void compute(DArray< RField< D, T > > const &wFields, double phiTot=1.0)
Compute MDE solutions and block concentrations.
Ensemble ensemble() const
Dynamically allocatable contiguous array template.
Definition DArray.h:32
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.
Utility classes for scientific computation.