PSCF v1.3
Pscf::Rpg::Mask< D > Class Template Reference

A field to which the total monomer concentration is constrained. More...

#include <Mask.h>

Inheritance diagram for Pscf::Rpg::Mask< D >:
Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >

Public Types

typedef Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > > Base
 Base class typedef.

Public Member Functions

void setFieldIo (FieldIo< D > const &fieldIo)
 Create association with FieldIo (store pointer).
void allocateBasis (int nBasis)
 Allocate memory for the field in basis format.
void allocateRGrid (IntVec< D > const &dimensions)
 Allocate memory for the field in rgrid format.
void setBasis (DArray< double > const &field)
 Set field component values, in symmetrized Fourier format.
void setRGrid (Prdc::Cuda::RField< D > const &field, bool isSymmetric=false)
 Set field values in real-space (r-grid) format.
void readBasis (std::istream &in)
 Read field from input stream in symmetrized basis format.
void readBasis (std::string filename)
 Read field from a named file, in symmetrized basis format.
void readRGrid (std::istream &in, bool isSymmetric=false)
 Reads field from an input stream in real-space (r-grid) format.
void readRGrid (std::string filename, bool isSymmetric=false)
 Reads field from a named file, in real-space (r-grid) format.
void writeBasis (std::ostream &out) const
 Write fields to an input stream in symmetrized basis format.
void writeBasis (std::string filename) const
 Write fields to a named file, in symmetrized basis format.
void writeRGrid (std::ostream &out) const
 Writes fields to an input stream in real-space (r-grid) format.
void writeRGrid (std::string filename) const
 Writes fields to a named file in real-space (r-grid) format.
DArray< double > const & basis () const
 Get the field in basis format.
Prdc::Cuda::RField< D > const & rgrid () const
 Get the field in r-grid format.
double phiTot () const
 Return the volume fraction of unit cell occupied by material.
bool isAllocatedBasis () const
 Has memory been allocated in basis format?
bool isAllocatedRGrid () const
 Has memory been allocated in rgrid format?
bool hasData () const
 Has field data been set in either format?
bool isSymmetric () const
 Are field symmetric under all elements of the space group?
Public Member Functions inherited from Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >
 MaskReal ()
 Constructor.
 ~MaskReal ()
 Destructor.
void setFieldIo (FieldIo< D > const &fieldIo)
 Create association with FieldIo (store pointer).
void setReadUnitCell (UnitCell< D > &cell)
 Set unit cell used when reading a mask field file.
void setWriteUnitCell (UnitCell< D > const &cell)
 Set unit cell used when writing a mask field file.
void allocateBasis (int nBasis)
 Allocate memory for the field in basis format.
void allocateRGrid (IntVec< D > const &dimensions)
 Allocate memory for the field in rgrid format.
void setBasis (DArray< double > const &field)
 Set field component values, in symmetrized Fourier format.
void setRGrid (Prdc::Cuda::RField< D > const &field, bool isSymmetric=false)
 Set field values in real-space (r-grid) format.
void readBasis (std::istream &in)
 Read field from input stream in symmetrized basis format.
void readBasis (std::string filename)
 Read field from a named file, in symmetrized basis format.
void readRGrid (std::istream &in, bool isSymmetric=false)
 Reads field from an input stream in real-space (r-grid) format.
void readRGrid (std::string filename, bool isSymmetric=false)
 Reads field from a named file, in real-space (r-grid) format.
void writeBasis (std::ostream &out) const
 Write fields to an input stream in symmetrized basis format.
void writeBasis (std::string filename) const
 Write fields to a named file, in symmetrized basis format.
void writeRGrid (std::ostream &out) const
 Writes fields to an input stream in real-space (r-grid) format.
void writeRGrid (std::string filename) const
 Writes fields to a named file in real-space (r-grid) format.
DArray< double > const & basis () const
 Get the field in basis format.
Prdc::Cuda::RField< D > const & rgrid () const
 Get the field in r-grid format.
double phiTot () const
 Return the volume fraction of unit cell occupied by material.
Signal< void > & signal ()
 Get a signal that notifies observers of field modification.
bool isAllocatedBasis () const
 Has memory been allocated in basis format?
bool isAllocatedRGrid () const
 Has memory been allocated in rgrid format?
bool hasData () const
 Has field data been set in either format?
bool isSymmetric () const
 Are field symmetric under all elements of the space group?

Protected Member Functions

double rGridAverage () const override
 Calculate the average value of the rgrid_ member.
IntVec< D > const & meshDimensions () const
 Mesh dimensions in each direction, set by allocation.
int meshSize () const
 Mesh size (number of grid points), set by allocation.
int nBasis () const
 Number of basis functions, set by allocation.
FieldIo< D > const & fieldIo () const
 Associated FieldIo object (const reference).
Protected Member Functions inherited from Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >
IntVec< D > const & meshDimensions () const
 Mesh dimensions in each direction, set by allocation.
int meshSize () const
 Mesh size (number of grid points), set by allocation.
int nBasis () const
 Number of basis functions, set by allocation.
FieldIo< D > const & fieldIo () const
 Associated FieldIo object (const reference).

Detailed Description

template<int D>
class Pscf::Rpg::Mask< D >

A field to which the total monomer concentration is constrained.

Please refer to the documentation of the Prdc::MaskReal base class template for more complete API documentation for this class template. The public interface of Rpg::Mask is identical to that of the base class template Prdc::MaskReal.

Definition at line 31 of file rpg/field/Mask.h.

Member Typedef Documentation

◆ Base

template<int D>
typedef Prdc::MaskReal< D, Prdc::Cuda::RField<D>, FieldIo<D> > Pscf::Rpg::Mask< D >::Base

Base class typedef.

Definition at line 38 of file rpg/field/Mask.h.

Member Function Documentation

◆ rGridAverage()

template<int D>
double Pscf::Rpg::Mask< D >::rGridAverage ( ) const
overrideprotectedvirtual

◆ setFieldIo()

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::setFieldIo ( FieldIo< D > const & fieldIo)

Create association with FieldIo (store pointer).

Parameters
fieldIoassociated FieldIo object

◆ allocateBasis()

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::allocateBasis ( int nBasis)

Allocate memory for the field in basis format.

An Exception will be thrown if this is called more than once.

Parameters
nBasisnumber of basis functions

◆ allocateRGrid()

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::allocateRGrid ( IntVec< D > const & dimensions)

Allocate memory for the field in rgrid format.

An Exception will be thrown if this is called more than once.

Parameters
dimensionsdimensions of spatial mesh

◆ setBasis()

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::setBasis ( DArray< double > const & field)

Set field component values, in symmetrized Fourier format.

This function also computes and stores the corresponding r-grid representation. On return, hasData and isSymmetric are both true.

The associated basis must be initialized on entry. As needed, r-grid and/or basis fields may be allocated within this function.

Parameters
fieldcomponents of field in basis format

◆ setRGrid()

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::setRGrid ( Prdc::Cuda::RField< D > const & field,
bool isSymmetric = false )

Set field values in real-space (r-grid) format.

If the isSymmetric parameter is true, this function assumes that the field are known to be symmetric and so computes and stores the corresponding basis components. If isSymmetric is false, it only sets the values in the r-grid format.

On return, hasData is true and the persistent isSymmetric flag defined by the class is set to the value of the isSymmetric input parameter.

As needed, r-grid and/or basis fields may be allocated within this function. If the isSymmetric parameter is true, then a basis must be initialized prior to entry.

Parameters
fieldnew field in r-grid format
isSymmetricis this field symmetric under the space group?

◆ readBasis() [1/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::readBasis ( std::istream & in)

Read field from input stream in symmetrized basis format.

This function also computes and stores the corresponding r-grid representation. On return, hasData and isSymmetric are both true.

This object must already be allocated and associated with a a FieldIo object to run this function.

As needed, r-grid and/or basis fields may be allocated within this functions, if not allocated on entry. An associated basis will be initialized if it is not initialized on entry.

Parameters
ininput stream from which to read field

◆ readBasis() [2/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::readBasis ( std::string filename)

Read field from a named file, in symmetrized basis format.

This function also computes and stores the corresponding r-grid representation. On return, hasData and isSymmetric are both true.

As needed, r-grid and/or basis fields may be allocated within this functions, if not allocated on entry. An associated basis will be initialized if it is not initialized on entry.

Parameters
filenamefile from which to read field

◆ readRGrid() [1/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::readRGrid ( std::istream & in,
bool isSymmetric = false )

Reads field from an input stream in real-space (r-grid) format.

If the isSymmetric parameter is true, this function assumes that the field is known to be symmetric and so computes and stores the corresponding basis format. If isSymmetric is false, it only sets the values in the r-grid format.

On return, hasData is true and the persistent isSymmetric flag defined by the class is set to the value of the isSymmetric input parameter.

As needed, r-grid and/or basis fields may be allocated within this functions, if not allocated on entry. An associated basis will be initialized if it is not initialized on entry.

Parameters
ininput stream from which to read field
isSymmetricis this field symmetric under the space group?

◆ readRGrid() [2/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::readRGrid ( std::string filename,
bool isSymmetric = false )

Reads field from a named file, in real-space (r-grid) format.

If the isSymmetric parameter is true, this function assumes that the field is known to be symmetric and so computes and stores the corresponding basis format. If isSymmetric is false, it only sets the values in the r-grid format.

On return, hasData is true and the persistent isSymmetric flag defined by the class is set to the value of the isSymmetric input parameter.

As needed, r-grid and/or basis fields may be allocated within this functions, if not allocated on entry. An associated basis will be initialized if it is not initialized on entry.

Parameters
filenamefile from which to read field
isSymmetricis this field symmetric under the space group?

◆ writeBasis() [1/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::writeBasis ( std::ostream & out) const

Write fields to an input stream in symmetrized basis format.

Parameters
outoutput stream to which to write fields

◆ writeBasis() [2/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::writeBasis ( std::string filename) const

Write fields to a named file, in symmetrized basis format.

Parameters
filenamename of file to which to write fields

◆ writeRGrid() [1/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::writeRGrid ( std::ostream & out) const

Writes fields to an input stream in real-space (r-grid) format.

Parameters
outoutput stream to which to write fields

◆ writeRGrid() [2/2]

template<int D>
void Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::writeRGrid ( std::string filename) const

Writes fields to a named file in real-space (r-grid) format.

Parameters
filenamename of file to which to write fields

◆ basis()

template<int D>
DArray< double > const & Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::basis ( ) const

Get the field in basis format.

◆ rgrid()

template<int D>
Prdc::Cuda::RField< D > const & Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::rgrid ( ) const

Get the field in r-grid format.

Referenced by rGridAverage().

◆ phiTot()

template<int D>
double Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::phiTot ( ) const

Return the volume fraction of unit cell occupied by material.

This value is equivalent to the spatial average of the mask, which is the q=0 coefficient of the discrete Fourier transform.

If hasData == true and isSymmetric == false (i.e., data only exists in rgrid format), then this object must be associated with a FieldIo object in order to call phiTot(). In other cases, the FieldIo association is not necessary.

◆ isAllocatedBasis()

template<int D>
bool Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::isAllocatedBasis ( ) const

Has memory been allocated in basis format?

◆ isAllocatedRGrid()

template<int D>
bool Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::isAllocatedRGrid ( ) const

Has memory been allocated in rgrid format?

◆ hasData()

template<int D>
bool Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::hasData ( ) const

Has field data been set in either format?

This flag is set true in setBasis and setRGrid.

◆ isSymmetric()

template<int D>
bool Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::isSymmetric ( ) const

Are field symmetric under all elements of the space group?

A valid basis format exists if and only if isSymmetric is true. This flat is set true if the field were input in basis format by the function setBasis, or if they were set in grid format by the function setRGrid but isSymmetric was set true.

◆ meshDimensions()

template<int D>
IntVec< D > const & Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::meshDimensions ( ) const
inlineprotected

Mesh dimensions in each direction, set by allocation.

Definition at line 370 of file MaskReal.h.

◆ meshSize()

template<int D>
int Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::meshSize ( ) const
inlineprotected

Mesh size (number of grid points), set by allocation.

Definition at line 376 of file MaskReal.h.

◆ nBasis()

template<int D>
int Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::nBasis ( ) const
inlineprotected

Number of basis functions, set by allocation.

Definition at line 382 of file MaskReal.h.

◆ fieldIo()

template<int D>
FieldIo< D > const & Pscf::Prdc::MaskReal< D, Prdc::Cuda::RField< D >, FieldIo< D > >::fieldIo ( ) const
inlineprotected

Associated FieldIo object (const reference).

Definition at line 388 of file MaskReal.h.


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