PSCF v1.3.3
rpg/fts/brownian/BdStep.h
1#ifndef RPG_BD_STEP_H
2#define RPG_BD_STEP_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/param/ParamComposite.h>
12//#include <pscf/cuda/CudaRandom.h>
13
14namespace Pscf {
15 class CudaRandom;
16 namespace Rpg {
17 template <int D> class System;
18 template <int D> class BdSimulator;
19 }
20}
21
22namespace Pscf {
23namespace Rpg {
24
25 using namespace Util;
26
27
35 template <int D>
36 class BdStep : public ParamComposite
37 {
38
39 public:
40
47
53 virtual ~BdStep();
54
60 virtual void readParameters(std::istream &in);
61
65 virtual void setup();
66
72 virtual bool step() = 0;
73
78 virtual bool needsCc()
79 { return false; }
80
85 virtual bool needsDc()
86 { return true; }
87
91 virtual void outputTimers(std::ostream& out);
92
96 virtual void clearTimers();
97
98 // Accessor Functions
99
103 virtual void output();
104
105 protected:
106
110 System<D>& system();
111
116
121
122 private:
123
125 BdSimulator<D>* simulatorPtr_;
126
128 System<D>* systemPtr_;
129
131 CudaRandom *cudaRandomPtr_;
132
133 };
134
135 // Protected inline methods
136
137 /*
138 * Get parent System object.
139 */
140 template <int D>
142 { return *systemPtr_; }
143
144 /*
145 * Get parent BdSimulator object.
146 */
147 template <int D>
149 { return *simulatorPtr_; }
150
151 /*
152 * Get Random number generator.
153 */
154 template <int D>
156 { return *cudaRandomPtr_; }
157
158 // Explicit instantiation declarations
159 extern template class BdStep<1>;
160 extern template class BdStep<2>;
161 extern template class BdStep<3>;
162
163}
164}
165#endif
Random number generator on GPU.
Definition CudaRandom.h:30
Brownian dynamics simulator.
BdStep is an abstract base class for Brownian dynamics steps.
virtual void outputTimers(std::ostream &out)
Log output timing results.
virtual void readParameters(std::istream &in)
Read required parameters from file.
virtual ~BdStep()
Destructor.
BdStep(BdSimulator< D > &simulator)
Constructor.
System< D > & system()
Get parent System object.
virtual bool needsCc()
Decide whether cc fields need to be saved for move.
CudaRandom & cudaRandom()
Get Random number generator of parent System.
virtual void clearTimers()
Clear timers.
virtual void output()
Output statistics for this move (at the end of simulation)
virtual bool needsDc()
Decide whether dc fields need to be saved for move.
BdSimulator< D > & simulator()
Get parent BdSimulator object.
virtual bool step()=0
Take a single Brownian dynamics step.
virtual void setup()
Setup before the beginning of each simulation run.
Main class, representing a complete physical system.
ParamComposite()
Constructor.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.