Ignore:
Timestamp:
Jun 19, 2017, 8:24:16 AM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChangeBugEmailaddress, ChemicalSpaceEvaluator, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
Children:
1ba51c
Parents:
2eded3e
git-author:
Frederik Heber <heber@…> (03/30/17 21:59:00)
git-committer:
Frederik Heber <frederik.heber@…> (06/19/17 08:24:16)
Message:

Vector(s) are now stored as strings in Querys intermediately.

  • they get evaluated first after being stored in a Parameter/Value on request via get().
  • Needed to change all Vector(s)..Query's of all UIs and also the general base classes inside Dialog.
  • QtQueryList need to be specialized in order to allow a QtQueryList<Vector> to actually store a vector of strings.
  • we may use setAsString() in order to set the Parameter thankfully.
  • TESTS: All regression tests on Geometry Actions are now working. Removed XFAIL from Options/Session test that use Python, i.e. the ones we marked four commits ago.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextUI/Query/VectorsTextQuery.cpp

    r2eded3e rf79d65  
    4141#include "CodePatterns/Log.hpp"
    4242#include "CodePatterns/Verbose.hpp"
     43#include "Geometry/GeometryRegistry.hpp"
    4344#include "LinearAlgebra/Vector.hpp"
    4445#include "LinearAlgebra/RealSpaceMatrix.hpp"
     
    5455
    5556bool TextDialog::VectorsTextQuery::handle() {
     57  std::stringstream output;
    5658  std::cout << getDescription() << std::endl;
    5759  char coords[3] = {'x', 'y', 'z'};
    5860  const RealSpaceMatrix &M = World::getInstance().getDomain().getM();
    59   for (int i=0;i<3;i++)
    60     std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: ");
     61  std::cout << "Enter three comma-separated coordinates, vector name, ? for list or empty for end." << std::endl;
     62  while (true) {
     63    for (int i=0;i<3;i++)
     64      std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: ");
    6165
    62   std::string line;
    63   getline(std::cin,line);
     66    std::string line;
     67    getline(std::cin,line);
    6468
    65   // dissect by ","
    66   double coord = 0.;
    67   std::string::iterator olditerspace = line.begin();
    68   std::string::iterator olditercomma = line.begin();
    69   int counter = 0;
    70   Vector temp_element;
    71   for(std::string::iterator vectoriter = line.begin(); vectoriter != line.end(); ++vectoriter) {
    72     if (*vectoriter == ',')
    73       counter++;
    74     if ((*vectoriter == ' ') && (counter == 2)) {
    75       counter = 0;
    76       for(std::string::iterator componentiter = olditerspace; (componentiter != vectoriter) && (counter !=3); ++componentiter) {
    77         if (*componentiter == ',') {
    78           std::istringstream stream(std::string(componentiter, olditercomma));
    79           stream >> coord;
    80           temp_element[counter++] = coord;
    81           olditercomma = componentiter;
    82         }
     69    if (line == "?") {
     70      GeometryRegistry &reg = GeometryRegistry::getInstance();
     71
     72      GeometryRegistry::const_iterator iter;
     73      for (iter = reg.getBeginIter(); iter != reg.getEndIter(); iter ++){
     74        GeometryObject *v = iter->second;
     75        std::cout << "\t" << *v << std::endl;
    8376      }
    84       if ((olditercomma != line.begin()) && (counter != 3)) { // insert last part also
    85         std::istringstream stream(std::string(olditercomma, vectoriter));
    86         stream >> coord;
    87         temp_element[counter++] = coord;
    88       }
    89       temp.push_back(temp_element);
    90       olditerspace = vectoriter;
     77    } else if (line.empty()) {
     78      break;
     79    } else {
     80      // simply append with white-space delimiter
     81      temp.push_back(line);
    9182    }
    9283  }
Note: See TracChangeset for help on using the changeset viewer.