Changeset f79d65 for src/Actions


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.
Location:
src/Actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Values.cpp

    r2eded3e rf79d65  
    3737#include "CodePatterns/Assert.hpp"
    3838
     39#include <boost/lexical_cast.hpp>
     40#include <boost/tokenizer.hpp>
     41
    3942#include "Box.hpp"
    4043#include "LinearAlgebra/BoxVector.hpp"
     
    4447#include "Values.hpp"
    4548
     49static const Vector parseAsVector(const std::string &_string)
     50{
     51  Vector temp;
     52  // dissect by ","
     53  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
     54  boost::char_separator<char> value_separator(",)(");
     55
     56  bool status = true;
     57  tokenizer tokens(_string, value_separator);
     58  if (!_string.empty()) {
     59    tokenizer::iterator tok_iter = tokens.begin();
     60    for (size_t i=0;i<NDIM;++i) {
     61      if (tok_iter == tokens.end()) {
     62        status = false;
     63        break;
     64      }
     65      temp[i] = boost::lexical_cast<double>(*(tok_iter++));
     66    }
     67  }
     68  if (!status)
     69    temp.Zero();
     70
     71  return temp;
     72}
     73
    4674Vector VectorValue::toVector() const
    4775{
    48   Vector returnVector(vector);
     76  Vector returnVector = parseAsVector(vectorstring);
    4977
    5078  return returnVector;
     
    5482{
    5583  BoxVector returnVector;
    56   static_cast<Vector>(returnVector) = Vector(vector); // under its hood it's still a Vector
     84  static_cast<Vector>(returnVector) = parseAsVector(vectorstring); // under its hood it's still a Vector
    5785
    5886  ASSERT(_box.isValid(returnVector),
  • src/Actions/Values.hpp

    r2eded3e rf79d65  
    2727 * are registered as VectorValue and lateron inside the CommandLineQuery placed
    2828 * into the real vector.
     29 *
     30 * We use this abstraction also for Geometry Objects, i.e. string names
     31 * referencing vectors in the GeomtryRegistry.
    2932 */
    3033struct VectorValue
    3134{
    32   double vector[NDIM];
     35  std::string vectorstring;
    3336
    3437  Vector toVector() const;
Note: See TracChangeset for help on using the changeset viewer.