PSCF v1.1
Public Member Functions | List of all members
Pscf::Pspc::SweepParameter< D > Class Template Reference

Class for storing data about an individual sweep parameter. More...

#include <SweepParameter.h>

Public Member Functions

 SweepParameter ()
 Default constructor. More...
 
 SweepParameter (System< D > &system)
 Constructor that stores a pointer to parent system. More...
 
void setSystem (System< D > &system)
 Set the system associated with this object. More...
 
void getInitial ()
 Store the pre-sweep value of the corresponding parameter. More...
 
void update (double newVal)
 Update the corresponding parameter value in the system. More...
 
std::string type () const
 Return a string representation of the parameter type. More...
 
void writeParamType (std::ostream &out) const
 Write the parameter type to an output stream. More...
 
int id (int i) const
 Get a id for a sub-object or element to which this is applied. More...
 
double current ()
 Return the current system parameter value. More...
 
double initial () const
 Return the initial system parameter value. More...
 
double change () const
 Return the total change planned for this parameter during sweep. More...
 
template<class Archive >
void serialize (Archive ar, const unsigned int version)
 Serialize to or from an archive. More...
 

Detailed Description

template<int D>
class Pscf::Pspc::SweepParameter< D >

Class for storing data about an individual sweep parameter.

This class stores the information required to sweep a single parameter value of any of several types. The type of parameter is indicated in the public interface and parameter file format by a string identifier with any of several allowed values. Each parameter is also identified by one or two associated index values, denoted here by id(0) and id(1), that specify the index or indices for a subobject or array element with which the parameter is associated applied. Allowed string representations and meanings of parameter types are given below, along with the meaning of any associated index value or pair of values. To indicate the meaning of index values, we use mId to denote a monomer type index, pId to denote a polymer species index, bId to denote the index of a block within a polymer, sId to denote a solvent species index, lId to denote a lattice parameter index, and wId to denote a wall index:

| Type | Meaning | id(0) | id(1)
| ----------- | ---------------------------------- | ----- | -----
| kuhn | monomer segment length | mId |
| chi | Flory-Huggins parameter | mId | mId
| block | block length | pId | bId
| solvent | solvent size | sId |
| phi_polymer | polymer volume fraction | pId |
| mu_polymer | polymer chemical potential | pId |
| phi_solvent | solvent volume fraction | sId |
| mu_solvent | solvent chemical potential | sId |
| cell_param | lattice parameter | lId |
| chi_bottom | thin film wall/monomer interaction | mId |
| chi_top | thin film wall/monomer interaction | mId |
int id(int i) const
Get a id for a sub-object or element to which this is applied.

The two indices for a Flory-Huggins chi parameter refer to indices in the chi matrix maintained by Interaction. Changes to element chi(i, j) automatically also update chi(j, i) for i !\ j, thus maintaining the symmetry of the matrix.

Each SweepParameter also has a "change" value that gives the intended difference between the final and initial value of the parameter over the course of a sweep, corresponding to a change sweep parameter s over the range [0,1]. The initial value of each parameter is obtained from a query of the state of the parent system at the beginning of a sweep, and thus does not need to be supplied as part of the text format for a SweepParameter.

A SweepParameter<D> object is initialized by reading the parameter type, index or index and change value from a parameter file as a a single line. An overloaded >> operator is defined that allows a SweepParameter<D> object named "parameter" to be read from an istream named "in" using the syntax "in >> parameter".

The text format for a parameter of a type that requires a single index id(0) is:

type id(0) change

where type indicates a type string, id(0) is an integer index value, and change is the a floating point value for the change in parameter value. The corresponding format for a parameter that requires two indices (e.g., block or chi) is instead: "type id(0) id(1) change".

Definition at line 83 of file pspc/sweep/SweepParameter.h.

Constructor & Destructor Documentation

◆ SweepParameter() [1/2]

template<int D>
Pscf::Pspc::SweepParameter< D >::SweepParameter

Default constructor.

Definition at line 33 of file pspc/sweep/SweepParameter.tpp.

◆ SweepParameter() [2/2]

template<int D>
Pscf::Pspc::SweepParameter< D >::SweepParameter ( System< D > &  system)

Constructor that stores a pointer to parent system.

Parameters
systemparent system

Definition at line 46 of file pspc/sweep/SweepParameter.tpp.

Member Function Documentation

◆ setSystem()

template<int D>
void Pscf::Pspc::SweepParameter< D >::setSystem ( System< D > &  system)
inline

Set the system associated with this object.

Invoke this function on objects created with the default constructor to create an association with a parent system.

Parameters
systemparent system

Definition at line 108 of file pspc/sweep/SweepParameter.h.

◆ getInitial()

template<int D>
void Pscf::Pspc::SweepParameter< D >::getInitial

Store the pre-sweep value of the corresponding parameter.

Definition at line 123 of file pspc/sweep/SweepParameter.tpp.

◆ update()

template<int D>
void Pscf::Pspc::SweepParameter< D >::update ( double  newVal)

Update the corresponding parameter value in the system.

Parameters
newValnew value for the parameter (input)

Definition at line 132 of file pspc/sweep/SweepParameter.tpp.

◆ type()

template<int D>
std::string Pscf::Pspc::SweepParameter< D >::type

Return a string representation of the parameter type.

Definition at line 141 of file pspc/sweep/SweepParameter.tpp.

References UTIL_THROW.

Referenced by pscfpp.field.Field::__init__(), pscfpp.field.Field::__str__(), and pscfpp.field.Field::read().

◆ writeParamType()

template<int D>
void Pscf::Pspc::SweepParameter< D >::writeParamType ( std::ostream &  out) const

Write the parameter type to an output stream.

Parameters
outoutput file stream

Definition at line 114 of file pspc/sweep/SweepParameter.tpp.

Referenced by Pscf::Pspc::operator<<().

◆ id()

template<int D>
int Pscf::Pspc::SweepParameter< D >::id ( int  i) const
inline

Get a id for a sub-object or element to which this is applied.

This function returns a value from the id_ array. Elements of this array store indices associating the parameter with a particular subobject or value. Different types of parameters require either 1 or 2 such identifiers. The number of required identifiers is denoted by private variable nID_.

Parameters
iarray index to access

Definition at line 148 of file pspc/sweep/SweepParameter.h.

Referenced by Pscf::Pspc::operator<<().

◆ current()

template<int D>
double Pscf::Pspc::SweepParameter< D >::current ( )
inline

Return the current system parameter value.

Definition at line 154 of file pspc/sweep/SweepParameter.h.

◆ initial()

template<int D>
double Pscf::Pspc::SweepParameter< D >::initial ( ) const
inline

Return the initial system parameter value.

Definition at line 160 of file pspc/sweep/SweepParameter.h.

◆ change()

template<int D>
double Pscf::Pspc::SweepParameter< D >::change ( ) const
inline

Return the total change planned for this parameter during sweep.

Definition at line 166 of file pspc/sweep/SweepParameter.h.

◆ serialize()

template<int D>
template<class Archive >
void Pscf::Pspc::SweepParameter< D >::serialize ( Archive  ar,
const unsigned int  version 
)

Serialize to or from an archive.

Parameters
arArchive object
versionarchive format version index

Definition at line 280 of file pspc/sweep/SweepParameter.tpp.

References Util::serializeEnum().


The documentation for this class was generated from the following files: