Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/CommandLineUI/CommandLineDialog.cpp

    r5079a0 r0286bc  
    1515#include <Descriptors/MoleculeIdDescriptor.hpp>
    1616#include "CommandLineUI/CommandLineDialog.hpp"
     17
     18#include "Actions/Values.hpp"
    1719
    1820#include "element.hpp"
     
    116118
    117119bool CommandLineDialog::BooleanCommandLineQuery::handle() {
    118   bool badInput = false;
    119   char input = ' ';
    120   do{
    121     badInput = false;
    122     Log() << Verbose(0) << getTitle();
    123     cin >> input;
    124     if ((input == 'y' ) || (input == 'Y')) {
    125       tmp = true;
    126     } else if ((input == 'n' ) || (input == 'N')) {
    127       tmp = false;
    128     } else {
    129       badInput=true;
    130       cin.clear();
    131       cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
    132       Log() << Verbose(0) << "Input was not of [yYnN]!" << endl;
    133     }
    134   } while(badInput);
    135   // clear the input buffer of anything still in the line
    136   cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
    137   return true;
     120  if (CommandLineParser::getInstance().vm.count(getTitle())) {
     121    tmp = CommandLineParser::getInstance().vm[getTitle()].as<bool>();
     122    return true;
     123  } else
     124    return false;
    138125}
    139126
     
    192179  if (CommandLineParser::getInstance().vm.count(getTitle())) {
    193180    IdxOfMol = CommandLineParser::getInstance().vm[getTitle()].as<int>();
    194     tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
     181    cout << "IdxOfMol " << IdxOfMol << endl;
     182    if (IdxOfMol >= 0)
     183      tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
     184    else
     185      tmp = NULL;
    195186    return true;
    196187  } else
     
    206197
    207198bool CommandLineDialog::VectorCommandLineQuery::handle() {
    208   vector<double> temp;
    209   if (CommandLineParser::getInstance().vm.count(getTitle())) {
    210     temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >();
    211     assert((temp.size() == 3) && "Vector from command line does not have three components.");
    212     for (int i=0;i<NDIM;i++)
    213       tmp->at(i) = temp[i];
     199  VectorValue temp;
     200  if (CommandLineParser::getInstance().vm.count(getTitle())) {
     201    temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >();
     202    tmp->at(0) = temp.x;
     203    tmp->at(1) = temp.y;
     204    tmp->at(2) = temp.z;
    214205    return true;
    215206  } else
     
    226217
    227218bool CommandLineDialog::BoxCommandLineQuery::handle() {
    228   vector<double> temp;
    229   if (CommandLineParser::getInstance().vm.count(getTitle())) {
    230     temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >();
    231     assert((temp.size() == 6) && "Symmetric box matrix from command line does not have six components.");
    232     for (int i=0;i<6;i++)
    233       tmp[i] = temp[i];
     219  BoxValue temp;
     220  if (CommandLineParser::getInstance().vm.count(getTitle())) {
     221    temp = CommandLineParser::getInstance().vm[getTitle()].as< BoxValue >();
     222    tmp[0] = temp.xx;
     223    tmp[1] = temp.xy;
     224    tmp[2] = temp.xz;
     225    tmp[3] = temp.yy;
     226    tmp[4] = temp.yz;
     227    tmp[5] = temp.zz;
    234228    return true;
    235229  } else
Note: See TracChangeset for help on using the changeset viewer.