Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/VerletIntegrationAction.cpp

    r112b09 r047878  
    99
    1010#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
     11#include "Actions/ActionRegistry.hpp"
     12#include "log.hpp"
     13#include "molecule.hpp"
     14#include "verbose.hpp"
     15#include "World.hpp"
    1116
    1217#include <iostream>
     
    1823#include "UIElements/UIFactory.hpp"
    1924#include "UIElements/Dialog.hpp"
    20 #include "Actions/MapOfActions.hpp"
    21 
    22 #include "atom.hpp"
    23 #include "log.hpp"
    24 #include "molecule.hpp"
    25 #include "verbose.hpp"
    26 #include "World.hpp"
     25#include "UIElements/ValueStorage.hpp"
    2726
    2827/****** MoleculeVerletIntegrationAction *****/
     
    4948{}
    5049
     50void MoleculeVerletIntegration(std::string &forcesfile) {
     51  ValueStorage::getInstance().setCurrentValue(MoleculeVerletIntegrationAction::NAME, forcesfile);
     52  ActionRegistry::getInstance().getActionByName(MoleculeVerletIntegrationAction::NAME)->call(Action::NonInteractive);
     53};
     54
     55Dialog* MoleculeVerletIntegrationAction::fillDialog(Dialog *dialog) {
     56  ASSERT(dialog,"No Dialog given when filling action dialog");
     57
     58  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
     59
     60  return dialog;
     61}
     62
    5163Action::state_ptr MoleculeVerletIntegrationAction::performCall() {
    5264  string filename;
    53   Dialog *dialog = UIFactory::getInstance().makeDialog();
    5465  molecule *mol = NULL;
    5566
    56   dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME));
    57   dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     67  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
    5868
    59   if(dialog->display()) {
     69  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     70    mol = iter->second;
    6071    DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl);
    6172    // TODO: sollte besser stream nutzen, nicht filename direkt (es sei denn, ist prefix), besser fuer unit test
    6273    char outputname[MAXSTRINGSIZE];
    6374    strcpy(outputname, filename.c_str());
    64     if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig())))
     75    if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig()), 0))
    6576      DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    6677    else
    6778      DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    68 
    69     delete dialog;
    70     return Action::success;
    7179  }
    72   delete dialog;
    73   return Action::failure;
     80  return Action::success;
    7481}
    7582
Note: See TracChangeset for help on using the changeset viewer.