Changeset 0efd21


Ignore:
Timestamp:
Sep 30, 2016, 3:51:37 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Fix_ParseParticles_split_forward_backward_Actions
Parents:
4d1aef
git-author:
Frederik Heber <heber@…> (09/27/16 14:37:40)
git-committer:
Frederik Heber <heber@…> (09/30/16 15:51:37)
Message:

tempcommit: Rewrote step-world-time into two actions.

Files:
5 added
1 deleted
8 edited
3 moved

Legend:

Unmodified
Added
Removed
  • TabularUnified doc/userguide/userguide.xml

    r4d1aef r0efd21  
    20572057    the final one containing the optimized structure.</para>
    20582058        </section>
    2059         <section xml:id="dynamics.step-world-time">
    2060           <title xml:id="dynamics.step-world-time.title">Step forward and backward through world time</title>
     2059        <section xml:id="dynamics.step-forward">
     2060          <title xml:id="dynamics.step-forward.title">Step forward through world time</title>
    20612061          <para>Some MacroActions are applied for a number of steps and need to
    20622062          increment the current world time, e.g. molecule dynamics or structure
    20632063          optimization. To this end, we may call upon
    20642064          </para>
    2065           <programlisting>... --step-world-time 1</programlisting>
    2066           <para>Note that the argument gives the number of steps to step forward
    2067           and may be any integer. Hence, we may also step backwards.</para>
     2065          <programlisting>... --step-forward 1</programlisting>
     2066          <note>Instead of "1" any number of steps may be given.</note>
     2067        </section>
     2068        <section xml:id="dynamics.step-backward">
     2069          <title xml:id="dynamics.step-backward.title">Step backward through world time</title>
     2070          <para>Reverse to stepping forward through the world time, we also
     2071          may step backward
     2072          </para>
     2073          <programlisting>... --step-backward 1</programlisting>
    20682074        </section>
    20692075        <section xml:id="dynamics.set-world-time">
  • TabularUnified src/Actions/FragmentationAction/MolecularDynamicsAction.cpp

    r4d1aef r0efd21  
    6363  // forces are set according to summed fragmentary contributions. This is much cleaner.
    6464  prototype_actions.addAction(AR.getActionByName(std::string("verlet-integration")).clone());
    65   prototype_actions.addAction(AR.getActionByName(std::string("step-world-time")).clone());
     65  prototype_actions.addAction(AR.getActionByName(std::string("step-forward")).clone());
    6666  prototype_actions.addAction(AR.getActionByName(std::string("output")).clone());
    6767  prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results")).clone());
  • TabularUnified src/Actions/FragmentationAction/StructuralOptimizationAction.cpp

    r4d1aef r0efd21  
    7070  prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")).clone());
    7171  prototype_actions.addAction(AR.getActionByName(std::string("force-annealing")).clone());
    72   prototype_actions.addAction(AR.getActionByName(std::string("step-world-time")).clone());
     72  prototype_actions.addAction(AR.getActionByName(std::string("step-forward")).clone());
    7373  prototype_actions.addAction(AR.getActionByName(std::string("output")).clone());
    7474  prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results")).clone());
  • TabularUnified src/Actions/GlobalListOfActions.hpp

    r4d1aef r0efd21  
    162162  (WorldSetDefaultName) \
    163163  (WorldSetWorldTime) \
    164   (WorldStepWorldTime)
     164  (WorldStepBackwardWorldTime) \
     165  (WorldStepForwardWorldTime)
    165166
    166167// extend list of actions in case levmar is available
  • TabularUnified src/Actions/Makefile.am

    r4d1aef r0efd21  
    606606  Actions/WorldAction/SetDefaultNameAction.cpp \
    607607  Actions/WorldAction/SetWorldTimeAction.cpp \
    608   Actions/WorldAction/StepWorldTimeAction.cpp
     608  Actions/WorldAction/StepBackwardWorldTimeAction.cpp \
     609  Actions/WorldAction/StepForwardWorldTimeAction.cpp
    609610WORLDACTIONHEADER = \
    610611  Actions/WorldAction/AddEmptyBoundaryAction.hpp \
     
    621622  Actions/WorldAction/SetDefaultNameAction.hpp \
    622623  Actions/WorldAction/SetWorldTimeAction.hpp \
    623   Actions/WorldAction/StepWorldTimeAction.hpp
     624  Actions/WorldAction/StepBackwardWorldTimeAction.hpp \
     625  Actions/WorldAction/StepForwardWorldTimeAction.hpp
    624626WORLDACTIONDEFS = \
    625627  Actions/WorldAction/AddEmptyBoundaryAction.def \
     
    636638  Actions/WorldAction/SetDefaultNameAction.def \
    637639  Actions/WorldAction/SetWorldTimeAction.def \
    638   Actions/WorldAction/StepWorldTimeAction.def
     640  Actions/WorldAction/StepBackwardWorldTimeAction.def \
     641  Actions/WorldAction/StepForwardWorldTimeAction.def
    639642
    640643#ACTIONPYTHONSOURCE_WITHDIR = $(ACTIONPROTOTYPESSOURCE:Action.cpp=Action.python.cpp)
  • TabularUnified src/Actions/WorldAction/StepBackwardWorldTimeAction.def

    r4d1aef r0efd21  
    11/*
    2  * StepWorldTimeAction.def
     2 * StepBackwardWorldTimeAction.def
    33 *
    44 *  Created on: Sep 27, 2016
     
    88// all includes and backward declarations necessary for non-integral types below
    99
    10 
    11 #include "Parameters/Validators/DummyValidator.hpp"
     10#include <limits>
     11#include "Parameters/Validators/RangeValidator.hpp"
    1212
    1313// i.e. there is an integer with variable name Z that can be found in
    1414// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1515// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    16 #define paramtypes (int)
    17 #define paramtokens ("step-world-time")
    18 #define paramdescriptions ("how many steps to take forward or backward")
    19 #undef paramdefaults
    20 #define paramreferences (steps)
     16#define paramtypes (unsigned int)
     17#define paramtokens ("step-backward")
     18#define paramdescriptions ("how many steps to take backward")
     19#define paramdefaults (PARAM_DEFAULT(1))
     20#define paramreferences (steps_backward)
    2121#define paramvalids \
    22 (DummyValidator< int >())
     22(RangeValidator<unsigned int>(1, std::numeric_limits<unsigned int>::max()))
    2323
    2424#define statetypes (unsigned int)
     
    2828#define CATEGORY World
    2929#define MENUNAME "world"
    30 #define MENUPOSITION 12
    31 #define ACTIONNAME StepWorldTime
    32 #define TOKEN "step-world-time"
     30#define MENUPOSITION 13
     31#define ACTIONNAME StepBackwardWorldTime
     32#define TOKEN "step-backward"
    3333
    3434
    3535// finally the information stored in the ActionTrait specialization
    36 #define DESCRIPTION "step forward or backward a certain amount of steps in world time"
     36#define DESCRIPTION "step backward a certain amount of steps in world time"
    3737#undef SHORTFORM
  • TabularUnified src/Actions/WorldAction/StepForwardWorldTimeAction.cpp

    r4d1aef r0efd21  
    2222
    2323/*
    24  * StepWorldTimeAction.cpp
     24 * StepForwardWorldTimeAction.cpp
    2525 *
    2626 *  Created on: Sep 27, 2016
     
    4343#include <string>
    4444
    45 #include "Actions/WorldAction/StepWorldTimeAction.hpp"
     45#include "Actions/WorldAction/StepForwardWorldTimeAction.hpp"
    4646
    4747using namespace MoleCuilder;
    4848
    4949// and construct the stuff
    50 #include "StepWorldTimeAction.def"
     50#include "StepForwardWorldTimeAction.def"
    5151#include "Action_impl_pre.hpp"
    5252/** =========== define the function ====================== */
    53 ActionState::ptr WorldStepWorldTimeAction::performCall() {
     53ActionState::ptr WorldStepForwardWorldTimeAction::performCall() {
    5454  // create undo state
    5555  int oldtime;
    5656  oldtime = WorldTime::getTime();
    57   WorldStepWorldTimeState *UndoState = new WorldStepWorldTimeState(oldtime, params);
     57  WorldStepForwardWorldTimeState *UndoState = new WorldStepForwardWorldTimeState(oldtime, params);
    5858
    59   if ((oldtime + params.steps.get()) < 0) {
    60     ELOG(1, "Cannot step back before time step #0.");
    61     return Action::failure;
    62   }
    63   World::getInstance().setTime(oldtime+params.steps.get());
     59  World::getInstance().setTime(oldtime+params.steps_forward.get());
    6460  LOG(0, "Current time step is now: " << WorldTime::getTime() << ".");
    6561  return ActionState::ptr(UndoState);
    6662}
    6763
    68 ActionState::ptr WorldStepWorldTimeAction::performUndo(ActionState::ptr _state) {
    69   WorldStepWorldTimeState *state = assert_cast<WorldStepWorldTimeState*>(_state.get());
     64ActionState::ptr WorldStepForwardWorldTimeAction::performUndo(ActionState::ptr _state) {
     65  WorldStepForwardWorldTimeState *state = assert_cast<WorldStepForwardWorldTimeState*>(_state.get());
    7066
    7167  World::getInstance().setTime(state->oldtime);
     
    7571}
    7672
    77 ActionState::ptr WorldStepWorldTimeAction::performRedo(ActionState::ptr _state){
    78   WorldStepWorldTimeState *state = assert_cast<WorldStepWorldTimeState*>(_state.get());
     73ActionState::ptr WorldStepForwardWorldTimeAction::performRedo(ActionState::ptr _state){
     74  WorldStepForwardWorldTimeState *state = assert_cast<WorldStepForwardWorldTimeState*>(_state.get());
    7975
    80   World::getInstance().setTime(state->oldtime+state->params.steps.get());
     76  World::getInstance().setTime(state->oldtime+state->params.steps_forward.get());
    8177  LOG(0, "Current time step is now: " << WorldTime::getTime() << ".");
    8278
     
    8480}
    8581
    86 bool WorldStepWorldTimeAction::canUndo() {
     82bool WorldStepForwardWorldTimeAction::canUndo() {
    8783  return true;
    8884}
    8985
    90 bool WorldStepWorldTimeAction::shouldUndo() {
     86bool WorldStepForwardWorldTimeAction::shouldUndo() {
    9187  return true;
    9288}
  • TabularUnified tests/Python/AllActions/options.dat

    r4d1aef r0efd21  
    225225skiplines       "2"
    226226start-step      "0"
    227 step-world-time "1"
     227step-backward   "1"
     228step-forward    "1"
    228229steps   "5"
    229230store-grids     "0"
  • TabularUnified tests/regression/Makefile.am

    r4d1aef r0efd21  
    243243        $(srcdir)/WorldTime/testsuite-worldtime.at \
    244244        $(srcdir)/WorldTime/SetWorldTime/testsuite-worldtime-set-world-time.at \
    245         $(srcdir)/WorldTime/StepWorldTime/testsuite-worldtime-step-world-time.at
     245        $(srcdir)/WorldTime/StepWorldTime/testsuite-worldtime-step-backward.at \
     246        $(srcdir)/WorldTime/StepWorldTime/testsuite-worldtime-step-forward.at
    246247
    247248max_jobs = 4
  • TabularUnified tests/regression/WorldTime/StepWorldTime/testsuite-worldtime-step-backward.at

    r4d1aef r0efd21  
    1818### step through world time
    1919
    20 AT_SETUP([Worldtime - stepping])
    21 AT_KEYWORDS([worldtime step-world-time set-world-time])
     20AT_SETUP([Worldtime - stepping backward])
     21AT_KEYWORDS([worldtime step-backward set-world-time])
    2222
    23 AT_CHECK([../../molecuilder --step-world-time 1], 0, [stdout], [stderr])
    24 AT_CHECK([fgrep "Current time step is now: 1" stdout], 0, [ignore], [ignore])
    25 AT_CHECK([../../molecuilder --set-world-time 4 --step-world-time -2], 0, [stdout], [stderr])
     23AT_CHECK([../../molecuilder --set-world-time 4 --step-backward 2], 0, [stdout], [stderr])
    2624AT_CHECK([fgrep "Current time step is now: 2" stdout], 0, [ignore], [ignore])
     25# test default
     26AT_CHECK([../../molecuilder --set-world-time 1 --step-backward], 0, [stdout], [stderr])
     27AT_CHECK([fgrep "Current time step is now: 0" stdout], 0, [ignore], [ignore])
    2728# stepping back too far fails
    28 AT_CHECK([../../molecuilder --set-world-time 1 --step-world-time -2], 5, [stdout], [stderr])
     29AT_CHECK([../../molecuilder --set-world-time 1 --step-backward 2], 5, [stdout], [stderr])
    2930
    3031AT_CLEANUP
    3132
    3233
    33 AT_SETUP([Worldtime - stepping with Undo])
    34 AT_KEYWORDS([worldtime step-world-time set-world-time undo])
     34AT_SETUP([Worldtime - stepping backward with Undo])
     35AT_KEYWORDS([worldtime step-backward set-world-time undo])
    3536
    36 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time -1 --undo], 0, [stdout], [stderr])
     37AT_CHECK([../../molecuilder --set-world-time 2 --step-backward 1 --undo], 0, [stdout], [stderr])
    3738AT_CHECK([fgrep "Current time step is now again: 2" stdout], 0, [ignore], [ignore])
    3839
    3940AT_CLEANUP
    4041
    41 AT_SETUP([Worldtime - stepping with Redo])
    42 AT_KEYWORDS([worldtime step-world-time set-world-time undo redo])
     42AT_SETUP([Worldtime - stepping backward with Redo])
     43AT_KEYWORDS([worldtime step-backward set-world-time undo redo])
    4344
    44 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time -1 --undo --redo], 0, [stdout], [stderr])
     45AT_CHECK([../../molecuilder --set-world-time 2 --step-backward 1 --undo --redo], 0, [stdout], [stderr])
    4546AT_CHECK([fgrep "Current time step is now: 1" stdout], 0, [ignore], [ignore])
    4647
  • TabularUnified tests/regression/WorldTime/testsuite-worldtime.at

    r4d1aef r0efd21  
    2222
    2323# stepping
    24 m4_include([WorldTime/StepWorldTime/testsuite-worldtime-step-world-time.at])
     24m4_include([WorldTime/StepWorldTime/testsuite-worldtime-step-forward.at])
     25m4_include([WorldTime/StepWorldTime/testsuite-worldtime-step-backward.at])
Note: See TracChangeset for help on using the changeset viewer.