1#ifndef RPG_MC_MOVE_MANAGER_TPP
2#define RPG_MC_MOVE_MANAGER_TPP
12#include <rpg/fts/montecarlo/McMoveManager.h>
13#include <rpg/fts/montecarlo/McMoveFactory.h>
14#include <rpg/fts/montecarlo/McSimulator.h>
15#include <util/random/Random.h>
29 simulatorPtr_(&simulator),
31 randomPtr_(&simulator.random())
56 probabilities_.allocate(size());
57 double totalProbability = 0.0;
59 for (iMove = 0; iMove < size(); ++iMove) {
60 probabilities_[iMove] = (*this)[iMove].probability();
61 totalProbability += probabilities_[iMove];
65 for (iMove = 0; iMove < size(); ++iMove) {
66 probabilities_[iMove] = probabilities_[iMove]/totalProbability;
67 (*this)[iMove].setProbability(probabilities_[iMove]);
77 for (
int iMove = 0; iMove < size(); ++iMove) {
78 (*this)[iMove].setup();
89 iMove = randomPtr_->drawFrom(&probabilities_[0], size());
90 return (*
this)[iMove];
99 for (
int i=0; i< size(); i++) {
110 for (
int i=0; i< size(); i++) {
111 (*this)[i].outputTimers(out);
121 for (
int i=0; i< size(); i++) {
122 (*this)[i].clearTimers();
132 for (
int i=0; i< size(); i++) {
133 if((*
this)[i].needsCc()){
146 for (
int i=0; i< size(); i++) {
147 if((*
this)[i].needsDc()){
Factory for subclasses of McMove.
Manager for a set of McMove objects.
void output() const
Output statistics for all moves.
void setup()
Initialize at beginning of system run.
void outputTimers(std::ostream &out) const
Log output timing results.
virtual void readParameters(std::istream &in)
Read instructions for creating McMove objects.
void clearTimers()
Clear timers.
McMove< D > & chooseMove()
Choose an McMove at random, using specified probabilities.
bool needsDc()
Decide whether any move needs to store dc fields.
McMoveManager(McSimulator< D > &simulator, System< D > &system)
Constructor.
~McMoveManager()
Destructor.
bool needsCc()
Decide whether any move needs to store cc fields.
McMove is an abstract base class for Monte Carlo moves.
Monte-Carlo simulation coordinator.
Main class for calculations that represent one system.
Template container for pointers to objects with a common base class.
void setClassName(const char *className)
Set class name string.
File containing preprocessor macros for error handling.
PSCF package top-level namespace.
Utility classes for scientific computation.