1#ifndef RP_SWEEP_PARAMETER_H
2#define RP_SWEEP_PARAMETER_H
11#include <pscf/sweep/ParameterType.h>
12#include <util/containers/DArray.h>
13#include <util/containers/GArray.h>
20 template <
int D,
class T>
class System;
116 template <
int D,
class T>
143 { systemPtr_ = &system; }
151 { parameterTypesPtr_ = &array; }
165 {
return parameterTypeId_; }
171 {
return (parameterTypeId_ != -1); }
197 void update(
double newVal);
202 std::string
type()
const;
261 template <
class Archive>
262 void serialize(Archive& ar,
const unsigned int version);
267 enum ParamType {
Block, Chi, Kuhn, Phi_Polymer, Phi_Solvent,
268 Mu_Polymer, Mu_Solvent,
Solvent, Cell_Param,
287 System<D,T>* systemPtr_;
293 int parameterTypeId_;
300 void readParamType(std::istream& in);
309 void checkId(
int i,
int n, std::string
const & name)
const;
321 void set_(
double newVal);
325 template <
int DT,
class TT>
329 template <
int DT,
class TT>
338 template <
int D,
class T>
339 template <
class Archive>
341 const unsigned int version)
345 if (Archive::is_loading()) {
346 if (id_.isAllocated()) id_.deallocate();
347 if (nId_ > 0) id_.allocate(nId_);
349 for (
int i = 0; i < nId_; ++i) {
362 template <
int D,
class T>
367 param.readParamType(in);
370 for (
int i = 0; i < param.nId_; ++i) {
385 template <
int D,
class T>
391 for (
int i = 0; i < param.nId_; ++i) {
395 out << param.change_;
Solver and descriptor for a solvent species.
Class template for storing data about an individual sweep parameter.
void getInitial()
Get initial value of this parameter.
SweepParameter()
Default constructor.
std::string type() const
Return a string representation of the parameter type.
void writeParamType(std::ostream &out) const
Write the parameter type to an output stream.
ParameterType & parameterType() const
Get the ParameterType object for a specialized sweep parameter.
void serialize(Archive &ar, const unsigned int version)
Serialize to or from an archive.
double initial() const
Get the initial system parameter value.
int parameterTypeId() const
Get the array index for the specialized sweep parameter.
int id(int i) const
Get id for a sub-object or element to which this is applied.
void update(double newVal)
Update the corresponding parameter value in the system.
void setParameterTypesArray(GArray< ParameterType > &array)
Set the pointer to the array of specialized sweep parameter types.
bool isSpecialized() const
Is this SweepParameter a specialized parameter type?
void checkIds() const
Check that the indices of this parameter are in range.
double current()
Get the current system parameter value.
void setSystem(System< D, T > &system)
Set the system associated with this object.
double change() const
Get the total change planned for this parameter during sweep.
int nId() const
Number of indices associated with this parameter.
Base class template for classes that represent a complete system.
Dynamically allocatable contiguous array template.
An automatically growable array, analogous to a std::vector.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void serializeEnum(Archive &ar, T &data, const unsigned int version=0)
Serialize an enumeration value.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Declaration of a specialized sweep parameter type.