1#ifndef RP_BASIS_FIELD_STATE_TPP
2#define RP_BASIS_FIELD_STATE_TPP
11#include "BasisFieldState.h"
14#include <rpc/system/System.h>
15#include <rpc/solvers/Mixture.h>
16#include <rpc/field/Domain.h>
17#include <rpc/field/FieldIo.h>
20#include <prdc/crystal/Basis.h>
32 template <
int D,
class T>
40 template <
int D,
class T>
48 template <
int D,
class T>
54 int nMonomer =
system().mixture().nMonomer();
56 if (
fields().isAllocated()) {
59 fields().allocate(nMonomer);
62 int nBasis = system().domain().basis().nBasis();
64 for (
int i = 0; i < nMonomer; ++i) {
65 if (field(i).isAllocated()) {
68 field(i).allocate(nBasis);
77 template <
int D,
class T>
81 FieldIoT
const & fieldIo =
system().domain().fieldIo();
88 template <
int D,
class T>
91 FieldIoT
const & fieldIo =
system().domain().fieldIo();
98 template <
int D,
class T>
103 int nMonomer =
system().mixture().nMonomer();
104 int nBasis =
system().domain().basis().nBasis();
106 for (i = 0; i < nMonomer; ++i) {
109 for (j = 0; j < nBasis; ++j) {
110 stateField[j] = systemField[j];
121 template <
int D,
class T>
BasisFieldState()
Default constructor.
const DArray< FT > & fields() const
const UnitCell< D > & unitCell() const
Get UnitCell (i.e., lattice type and parameters) by const reference.
void write(const std::string &filename)
Write state to file.
const DArray< double > & field(int monomerId) const
Get a field for a single monomer type by const reference.
void getSystemState()
Store the current state of the associated system.
void allocate()
Allocate all fields.
void read(const std::string &filename)
Read state from file.
typename T::System & system()
Get associated System by reference.
void setSystemState(bool newCellParams)
Set the state of the associated system to this state.
Dynamically allocatable contiguous array template.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Periodic fields and crystallography.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.