Simpatico  v1.10
SliplinkMcMoveFactory.cpp
1 #ifndef SLIPLINK_MC_MOVE_FACTORY_CPP
2 #define SLIPLINK_MC_MOVE_FACTORY_CPP
3 
4 #include "SliplinkMcMoveFactory.h"
5 #include <mcMd/mcSimulation/McSystem.h>
6 
7 // Include headers for user defined McMoves
8 #include "SliplinkerAll.h"
9 #include "SliplinkerEnd.h"
10 #include "SliplinkMove.h"
11 #include "GcSliplinkMove.h"
12 
13 namespace McMd
14 {
15 
16 
17  /*
18  * Constructor.
19  */
21  McSystem& system)
22  : McMoveFactory(simulation, system)
23  {}
24 
25  /*
26  * Return a pointer to a new instance of className.
27  */
28  McMove* SliplinkMcMoveFactory::factory(const std::string &className) const
29  {
30  McMove* ptr = 0;
31 
32  ptr = trySubfactories(className);
33  if (ptr) return ptr;
34 
35  if (className == "SliplinkerAll") {
36  ptr = new SliplinkerAll(system());
37  } else
38  if (className == "SliplinkerEnd") {
39  ptr = new SliplinkerEnd(system());
40  } else
41  if (className == "SliplinkMove") {
42  ptr = new SliplinkMove(system());
43  } else
44  if (className == "GcSliplinkMove") {
45  ptr = new GcSliplinkMove(system());
46  }
47 
48  #if 0
49  // If not a user-defined class, try the standard factory
50  if (!ptr) {
51  ptr = McMoveFactory::factory(className);
52  }
53  #endif
54 
55  return ptr;
56  }
57 
58 }
59 
60 #endif
Move to create and destroy slip-springs.
Definition: SliplinkerAll.h:26
A System for use in a Markov chain Monte Carlo simulation.
Definition: McSystem.h:52
virtual McMove * factory(const std::string &className) const
Return pointer to a new McMove object.
SliplinkMcMoveFactory(McSimulation &simulation, McSystem &system)
Constructor.
McMove is an abstract base class for Monte Carlo moves.
Definition: McMove.h:31
Move to create and destroy slip-springs.
Definition: SliplinkerEnd.h:26
A Monte-Carlo simulation of one McSystem.
Definition: McSimulation.h:32
McMove * trySubfactories(const std::string &className) const
Search through subfactories for match.
virtual McMove * factory(const std::string &className) const
Return pointer to a new McMove object.
McMoveFactory for an McSimulation.
Definition: McMoveFactory.h:28
Move to evolve the slip-springs.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Move to evolve the slip-springs.
Definition: SliplinkMove.h:26
McSystem & system() const
Return reference to parent McSystem.
Definition: McMoveFactory.h:63