PSCF v1.4.0
fts/montecarlo/ShiftMove.h
1#ifndef RP_SHIFT_MOVE_H
2#define RP_SHIFT_MOVE_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 "McMove.h" // base class
12#include <util/containers/DArray.h> // member
13#include <pscf/math/IntVec.h> // template with defaults
14
15// Forward declaration
16namespace Util {
17 template <typename Data> class Array;
18}
19
20namespace Pscf {
21namespace Rp {
22
23 using namespace Util;
24
45 template <int D, class T>
46 class ShiftMove : public T::McMove
47 {
48
49 public:
50
51 // Protected constructor and destructor (see below).
52
58 void readParameters(std::istream &in) override;
59
63 void setup() override;
64
65 protected:
66
72 ShiftMove(typename T::McSimulator& simulator);
73
77 ~ShiftMove() = default;
78
82 void attemptMove() override;
83
92 virtual void shiftFields(IntVec<D> const & shift) = 0;
93
105 Array<double> const & in,
106 IntVec<D> shift,
107 IntVec<D> dimensions) const;
108
111
112 // Alias for McMove base class.
113 using McMoveT = typename T::McMove;
114
115 // Inherited protected member functions (selected).
116 using McMoveT::system;
117 using McMoveT::simulator;
118
119 private:
120
122 int maxShift_;
123
125 bool isAllocated_;
126
127 };
128
129}
130}
131#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
void attemptMove() override
Attempt move that translates all w fields.
DArray< typename Types< D >::RField > w_
~ShiftMove()=default
Destructor.
void readParameters(std::istream &in) override
Read body of parameter file block.
ShiftMove(typename T::McSimulator &simulator)
Constructor.
virtual void shiftFields(IntVec< D > const &shift)=0
Compute and store shifted w fields.
void shiftField(Array< double > &out, Array< double > const &in, IntVec< D > shift, IntVec< D > dimensions) const
Compute a shifted version of a field.
void setup() override
Setup before the beginning of each simulation run.
Array container class template.
Definition Array.h:40
Class templates for real-valued periodic fields.
PSCF package top-level namespace.
Utility classes for scientific computation.