Loading [MathJax]/extensions/TeX/AMSsymbols.js
PSCF v1.2
rpc/fts/simulator/SimState.tpp
1#ifndef RPC_SIM_STATE_TPP
2#define RPC_SIM_STATE_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "SimState.h"
12
13namespace Pscf {
14namespace Rpc {
15
16 using namespace Util;
17 using namespace Pscf::Prdc::Cpu;
18
19 /*
20 * Constructor.
21 */
22 template <int D>
24 : w(),
25 wc(),
26 hamiltonian(0.0),
27 idealHamiltonian(0.0),
28 fieldHamiltonian(0.0),
29 needsCc(false),
30 needsDc(false),
31 needsHamiltonian(false),
32 hasData(false),
33 isAllocated(false)
34 {}
35
36 /*
37 * Destructor.
38 */
39 template <int D>
42
43 /*
44 * Allocate memory for w fields.
45 */
46 template <int D>
47 void SimState<D>::allocate(int nMonomer, IntVec<D> const & dimensions)
48 {
49 w.allocate(nMonomer);
50 wc.allocate(nMonomer);
51 for (int i = 0; i < nMonomer; ++i) {
52 w[i].allocate(dimensions);
53 wc[i].allocate(dimensions);
54 }
55 if (needsCc){
56 cc.allocate(nMonomer);
57 for (int i = 0; i < nMonomer; ++i) {
58 cc[i].allocate(dimensions);
59 }
60 }
61 if (needsDc){
62 dc.allocate(nMonomer-1);
63 for (int i = 0; i < nMonomer - 1; ++i) {
64 dc[i].allocate(dimensions);
65 }
66 }
67 isAllocated = true;
68 }
69
70}
71}
72#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
Fields and FFTs for periodic boundary conditions (CPU)
Definition CField.cpp:12
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.
void allocate(int nMonomer, IntVec< D > const &dimensions)
Allocate memory for fields.