|
PSCF v1.4.0
|
A container of complex-valued w fields. More...
#include <WFields.h>
Public Member Functions | |
| WFields () | |
| Constructor. | |
| ~WFields () | |
| Destructor. | |
Initialization and Memory Management | |
| void | setFieldIo (FIT const &fieldIo) |
| Create association with FIT (store pointer). | |
| void | setReadUnitCell (UnitCell< D > &cell) |
| Set unit cell used when reading field files. | |
| void | setWriteUnitCell (UnitCell< D > const &cell) |
| Set unit cell used when writing field files. | |
| void | allocate (int nMonomer, IntVec< D > const &dimensions) |
| Allocate memory for fields. | |
Field and State Modifiers | |
| void | setFields (DArray< CFT > const &fields) |
| Set values for all fields. | |
| void | readFields (std::istream &in) |
| Read all fields from an input file. | |
| void | readFields (std::string const &filename) |
| Read all fields from a named file. | |
| void | clear () |
| Clear data stored in this object without deallocating. | |
| Signal< void > & | signal () |
| Get the signal that notifies observers of w-field modification. | |
Field Output to File | |
| void | writeFields (std::ostream &out) const |
| Write fields to an output stream. | |
| void | writeFields (std::string const &filename) const |
| Write fields to a named file. | |
Field Access (by const reference) | |
| DArray< CFT > const & | fields () const |
| Get the array of all fields. | |
| CFT const & | field (int monomerId) const |
| Get the field for one monomer type. | |
Boolean Queries | |
| bool | isAllocated () const |
| Has memory been allocated for fields ? | |
| bool | hasData () const |
| Has field data been set since it was last cleared? | |
Protected Member Functions | |
| IntVec< D > const & | meshDimensions () const |
| Get mesh dimensions in each direction, set on r-grid allocation. | |
| int | meshSize () const |
| Get mesh size (number of grid points), set on r-grid allocation. | |
| int | nMonomer () const |
| Get number of monomer types. | |
| FIT const & | fieldIo () const |
| Get associated FIT field IO object (const reference). | |
A container of complex-valued w fields.
Overview : A WFields container has an array of chemical fields (w fields) that are each associated with a monomer type. Fields can be modified by the setFields and readFields member functions, accessed as const references, or written to file.
Template parameters : The template parameters represent:
- D : integer dimensionality of space, D=1,2, or 3 - CFT : field type for complex data (e.g., CField<D>) - FIT : FieldIo type for field io operations (e.g., FieldIo<D>)
Subclasses : Partial specializations of WFields are used as base classes for classes Cpc::WFields <D > and Rpg::WFields <D>:
Signal : A WFields owns an instance of class Util::Signal<void> that notifies all observers whenever the fields owned by the WFields are modified by the set or readField function. This signal object may be accessed by reference using the signal() member function. The Util::Signal<void>::addObserver function may used to add an "observer" object and indicate a zero-parameter member function of each observer that will be called whenever the w fields are modified.
Definition at line 70 of file cp/field/WFields.h.
| Pscf::Cp::WFields< D, CFT, FIT >::WFields | ( | ) |
Constructor.
Definition at line 30 of file cp/field/WFields.tpp.
| Pscf::Cp::WFields< D, CFT, FIT >::~WFields | ( | ) |
Destructor.
Definition at line 47 of file cp/field/WFields.tpp.
| void Pscf::Cp::WFields< D, CFT, FIT >::setFieldIo | ( | FIT const & | fieldIo | ) |
Create association with FIT (store pointer).
| fieldIo | associated FIT object |
Definition at line 54 of file cp/field/WFields.tpp.
References fieldIo().
| void Pscf::Cp::WFields< D, CFT, FIT >::setReadUnitCell | ( | UnitCell< D > & | cell | ) |
Set unit cell used when reading field files.
This function creates a stored pointer to a UnitCell<D> that is is used by the readFields functions, which reset the unit cell parameters in this object to those read from the field file header. This function may only be called once.
| cell | unit cell that is modified by readFields |
Definition at line 61 of file cp/field/WFields.tpp.
References UTIL_CHECK.
| void Pscf::Cp::WFields< D, CFT, FIT >::setWriteUnitCell | ( | UnitCell< D > const & | cell | ) |
Set unit cell used when writing field files.
This function creates a stored pointer to a UnitCell<D> that is is used by the writeFields function, which write the unit cell parameters from in this object to a field file header. This function may only be called once.
| cell | unit cell that is used by writeFields |
Definition at line 71 of file cp/field/WFields.tpp.
References UTIL_CHECK.
| void Pscf::Cp::WFields< D, CFT, FIT >::allocate | ( | int | nMonomer, |
| IntVec< D > const & | dimensions ) |
Allocate memory for fields.
This function may only be called once.
| nMonomer | number of monomer types |
| dimensions | dimensions of spatial mesh |
Definition at line 81 of file cp/field/WFields.tpp.
References meshDimensions(), nMonomer(), and UTIL_CHECK.
| void Pscf::Cp::WFields< D, CFT, FIT >::setFields | ( | DArray< CFT > const & | fields | ) |
Set values for all fields.
On return, hasData is true.
| fields | array of new fields |
Definition at line 113 of file cp/field/WFields.tpp.
References fields(), signal(), and UTIL_CHECK.
| void Pscf::Cp::WFields< D, CFT, FIT >::readFields | ( | std::istream & | in | ) |
Read all fields from an input file.
| in | input stream from which to read fields |
Definition at line 135 of file cp/field/WFields.tpp.
References fieldIo(), signal(), and UTIL_CHECK.
Referenced by readFields().
| void Pscf::Cp::WFields< D, CFT, FIT >::readFields | ( | std::string const & | filename | ) |
Read all fields from a named file.
| filename | file from which to read fields |
Definition at line 153 of file cp/field/WFields.tpp.
References fieldIo(), and readFields().
|
inline |
Clear data stored in this object without deallocating.
Definition at line 317 of file cp/field/WFields.h.
| Signal< void > & Pscf::Cp::WFields< D, CFT, FIT >::signal | ( | ) |
Get the signal that notifies observers of w-field modification.
Definition at line 200 of file cp/field/WFields.tpp.
References UTIL_CHECK.
Referenced by readFields(), and setFields().
| void Pscf::Cp::WFields< D, CFT, FIT >::writeFields | ( | std::ostream & | out | ) | const |
Write fields to an output stream.
| out | output stream |
Definition at line 167 of file cp/field/WFields.tpp.
References fieldIo(), and UTIL_CHECK.
Referenced by writeFields().
| void Pscf::Cp::WFields< D, CFT, FIT >::writeFields | ( | std::string const & | filename | ) | const |
Write fields to a named file.
| filename | name of output file |
Definition at line 186 of file cp/field/WFields.tpp.
References fieldIo(), and writeFields().
|
inline |
Get the array of all fields.
The array capacity is equal to the number of monomer types.
Definition at line 322 of file cp/field/WFields.h.
References UTIL_ASSERT.
Referenced by setFields().
|
inline |
Get the field for one monomer type.
| monomerId | integer monomer type index (0,..,nMonomer-1) |
Definition at line 330 of file cp/field/WFields.h.
References UTIL_ASSERT.
|
inline |
Has memory been allocated for fields ?
Definition at line 338 of file cp/field/WFields.h.
|
inline |
Has field data been set since it was last cleared?
This flag is set true in the setFields and readFields functions, and set false in the clear function.
Definition at line 343 of file cp/field/WFields.h.
|
inlineprotected |
Get mesh dimensions in each direction, set on r-grid allocation.
Definition at line 351 of file cp/field/WFields.h.
Referenced by allocate().
|
inlineprotected |
Get mesh size (number of grid points), set on r-grid allocation.
Definition at line 356 of file cp/field/WFields.h.
|
inlineprotected |
Get number of monomer types.
Definition at line 361 of file cp/field/WFields.h.
Referenced by allocate().
|
inlineprotected |
Get associated FIT field IO object (const reference).
Definition at line 366 of file cp/field/WFields.h.
References UTIL_CHECK.
Referenced by readFields(), readFields(), setFieldIo(), writeFields(), and writeFields().