PSCF v1.1
FilmIteratorBase.h
1#ifndef PSPC_FILM_ITERATOR_BASE_H
2#define PSPC_FILM_ITERATOR_BASE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2021, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "pspc/iterator/Iterator.h" // base class
12#include "util/containers/FSArray.h" // container
13#include <string>
14#include <iostream>
15
16namespace Pscf {
17namespace Pspc
18{
19
20 template <int D>
21 class System;
22
23 using namespace Util;
24
50 template <int D, typename IteratorType>
51 class FilmIteratorBase : public Iterator<D>
52 {
53
54 public:
55
60
65
71 void readParameters(std::istream& in);
72
78 int solve(bool isContinuation = false);
79
83 IteratorType const & iterator() const;
84
97 virtual void setFlexibleParams() = 0;
98
111 virtual void checkLatticeVectors() const = 0;
112
122 void generateWallFields();
123
134 void updateWallFields();
135
139 void checkSpaceGroup() const;
140
146 bool isSymmetric() const;
147
153 bool isAthermal() const;
154
161 void setChiBottom(int s, double chi);
162
169 void setChiTop(int s, double chi);
170
174 int normalVecId() const;
175
179 double interfaceThickness() const;
180
184 double wallThickness() const;
185
189 DArray<double> const & chiTop() const;
190
194 DArray<double> const & chiBottom() const;
195
201 double chiBottom(int s) const;
202
208 double chiTop(int s) const;
209
210 using Iterator<D>::isFlexible;
211
212 protected:
213
222 void setup();
223
227 IteratorType& iterator();
228
236
237 using Iterator<D>::system;
238 using Iterator<D>::setClassName;
239 using Iterator<D>::isFlexible_;
245
246 private:
247
249 IteratorType iterator_;
250
252 FSArray<double, 6> parameters_;
253
255 int normalVecId_;
256
258 double t_;
259
261 double T_;
262
264 DArray<double> chiBottom_;
265
267 DArray<double> chiTop_;
268
270 DArray<double> chiBottomCurrent_;
271
273 DArray<double> chiTopCurrent_;
274
276 bool ungenerated_;
277 };
278
279 // Inline member functions
280
281 // Return reference to iterator within this FilmIterator
282 template <int D, typename IteratorType>
284 { return iterator_; }
285
286 // Return const reference to iterator within this FilmIterator
287 template <int D, typename IteratorType>
288 inline
290 { return iterator_; }
291
292 // Set value of chi between species s and the bottom wall
293 template <int D, typename IteratorType>
294 inline
296 { chiBottom_[s] = chi; }
297
298 // Set value of chi between species s and the top wall
299 template <int D, typename IteratorType>
300 inline
302 { chiTop_[s] = chi; }
303
304 // Get value of normalVecId
305 template <int D, typename IteratorType>
307 { return normalVecId_; }
308
309 // Get value of interfaceThickness
310 template <int D, typename IteratorType>
312 const
313 { return t_; }
314
315 // Get value of wallThickness
316 template <int D, typename IteratorType>
318 { return T_; }
319
320 // Get chiBottom array by const reference
321 template <int D, typename IteratorType>
322 inline
324 const
325 { return chiBottom_; }
326
327 // Get chiTop array by const reference
328 template <int D, typename IteratorType>
329 inline
331 const
332 { return chiTop_; }
333
334 // Get the chi parameter between the bottom wall and species s
335 template <int D, typename IteratorType>
337 const
338 { return chiBottom_[s]; }
339
340 // Get the chi parameter between the top wall and species s
341 template <int D, typename IteratorType>
343 const
344 { return chiTop_[s]; }
345
346} // namespace Pspc
347} // namespace Pscf
348
349#include "FilmIteratorBase.tpp"
350#endif
Descriptor for a FilmIterator object.
double interfaceThickness() const
Get value of interfaceThickness.
void generateExternalFields()
Generate external fields for the walls.
int solve(bool isContinuation=false)
Iterate to a solution.
void setChiTop(int s, double chi)
Set the value of chi between species s and the top wall.
bool isAthermal() const
Are the walls athermal?
void readParameters(std::istream &in)
Read and initialize.
bool isSymmetric() const
Are the walls chemically identical?
void setup()
Initialize just before entry to iterative loop.
void generateWallFields()
Generates mask and external field for the walls and stores in System.
double chiTop(int s) const
Get the chi parameter between the top wall and species s.
void updateWallFields()
Updates the mask and external fields for the walls if needed.
IteratorType & iterator()
Return reference to the real iterator within this FilmIterator.
double wallThickness() const
Get value of wallThickness.
double chiBottom(int s) const
Get the chi parameter between the bottom wall and species s.
IteratorType const & iterator() const
Return const reference to the real iterator within this FilmIterator.
int normalVecId() const
Get value of normalVecId.
virtual void setFlexibleParams()=0
Modifies flexibleParams_ to be compatible with thin film constraint.
DArray< double > const & chiBottom() const
Get const chiTop array by reference.
virtual void checkLatticeVectors() const =0
Check that lattice vectors are compatible with thin film constraint.
void setChiBottom(int s, double chi)
Set the value of chi between species s and the bottom wall.
DArray< double > const & chiTop() const
Get const chiBottom matrix by reference.
void checkSpaceGroup() const
Check that space group is compatible with the thin film constraint.
Base class for iterative solvers for SCF equations.
bool isFlexible() const
Return true iff unit cell has any flexible lattice parameters.
bool isFlexible_
Are any lattice parameters flexible during iteration?
System< D > const & system() const
Get parent system by const reference.
Main class for SCFT simulation of one system.
Definition: pspc/System.h:76
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
A fixed capacity (static) contiguous array with a variable logical size.
Definition: FSArray.h:38
DArrayParam< Type > & readDArray(std::istream &in, const char *label, DArray< Type > &array, int n)
Add and read a required DArray < Type > parameter.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
void setParent(ParamComponent &param, bool next=true)
Set this to the parent of a child component.
void addComponent(ParamComponent &param, bool isLeaf=true)
Add a new ParamComponent object to the format array.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1