PSCF v1.3.1
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
12#include <util/param/ParamComposite.h>
13#include <pscf/cuda/CudaRandom.h>
14
15namespace Pscf {
16namespace Rpg {
17
18 using namespace Util;
19
20 template <int D> class System;
21 template <int D> class BdSimulator;
22
30 template <int D>
31 class BdStep : public ParamComposite
32 {
33
34 public:
35
42
48 virtual ~BdStep();
49
55 virtual void readParameters(std::istream &in);
56
60 virtual void setup();
61
67 virtual bool step() = 0;
68
73 virtual bool needsCc()
74 { return false; }
75
80 virtual bool needsDc()
81 { return true; }
82
86 virtual void outputTimers(std::ostream& out);
87
91 virtual void clearTimers();
92
93 // Accessor Functions
94
98 virtual void output();
99
100 protected:
101
105 System<D>& system();
106
111
116
117 private:
118
120 BdSimulator<D>* simulatorPtr_;
121
123 System<D>* systemPtr_;
124
126 CudaRandom *cudaRandomPtr_;
127
128 };
129
130 // Protected inline methods
131
132 /*
133 * Get parent System object.
134 */
135 template <int D>
137 { return *systemPtr_; }
138
139 /*
140 * Get parent BdSimulator object.
141 */
142 template <int D>
144 { return *simulatorPtr_; }
145
146 /*
147 * Get Random number generator.
148 */
149 template <int D>
151 { return *cudaRandomPtr_; }
152
153 // Explicit instantiation declarations
154 extern template class BdStep<1>;
155 extern template class BdStep<2>;
156 extern template class BdStep<3>;
157
158}
159}
160#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.
Definition param_pc.dox:1