1#ifndef RP_LINEAR_SWEEP_TPP
2#define RP_LINEAR_SWEEP_TPP
11#include "LinearSweep.h"
12#include <rp/system/System.h>
13#include <rp/solvers/Mixture.h>
20 template <
int D,
class T>
25 template <
int D,
class T>
33 parameters_.allocate(nParameter_);
37 for (
int i = 0; i < nParameter_; ++i) {
48 if (
system().mixture().isCanonical()) {
50 for (
int i = 0; i < nParameter_; ++i) {
51 if (parameters_[i].type() ==
"phi_polymer" ||
52 parameters_[i].type() ==
"phi_solvent")
53 { sum += parameters_[i].change(); }
55 if (sum > 1.0E-10 || sum < -1.0E-10) {
56 UTIL_THROW(
"Changes of the volume fractions of a closed "
57 "mixture must add up to zero");
62 template <
int D,
class T>
72 for (
int i = 0; i < nParameter_; ++i) {
73 parameters_[i].setSystem(
system());
74 parameters_[i].getInitial();
78 template <
int D,
class T>
83 for (
int i = 0; i < nParameter_; ++i) {
84 newVal = parameters_[i].initial() +
s*parameters_[i].change();
85 parameters_[i].update(newVal);
89 template <
int D,
class T>
void readParameters(std::istream &in)
Read parameters from param file.
void setParameters(double s)
Set state parameters before solving an SCFT problem.
System< D, T > & system()
Return the parent system by reference.
void setup()
Setup operation at the beginning of a sweep.
void outputSummary(std::ostream &out)
Output data to a running summary.
LinearSweep(System< D, T > &system)
Constructor.
virtual void setup()
Setup operation at the beginning of a sweep.
bool hasSystem()
Does an association with the parent system exist?
virtual void readParameters(std::istream &in)
Read parameters from param file.
Base class template for classes that represent a complete system.
GArray< ParameterType > parameterTypes_
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.
#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.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.