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/CommandLineUI/CommandLineParser_validate.cpp

    r2eded3e rf79d65  
    6666        std::string("value"),
    6767        std::string("VectorValue")
     68    );
     69#endif
     70  }
     71  VV.vectorstring = values.at(0);
     72  v = boost::any(VectorValue(VV));
     73}
     74
     75void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int)
     76{
     77  RealSpaceMatrixValue RSMV;
     78  std::vector<std::string> components;
     79
     80  // split comma-separated values
     81  if (values.size() != 1) {
     82    std::cerr <<  "Not one vector but " << values.size() << " given " << std::endl;
     83#if BOOST_VERSION < 104200
     84    throw boost::program_options::validation_error("Unequal to one vector given");
     85#else
     86    throw boost::program_options::validation_error(
     87        boost::program_options::validation_error::invalid_option_value,
     88        std::string("value"),
     89        std::string("BoxValue")
    6890    );
    6991#endif
     
    83105  components.push_back(std::string(Biter,argument.end()));
    84106
    85   if (components.size() != 3) {
    86     std::cerr <<  "Specified vector does not have three components but " << components.size() << std::endl;
    87 #if BOOST_VERSION < 104200
    88     throw boost::program_options::validation_error("Specified vector does not have three components");
    89 #else
    90     throw boost::program_options::validation_error(
    91         boost::program_options::validation_error::invalid_option_value,
    92         std::string("value"),
    93         std::string("VectorValue")
    94     );
    95 #endif
    96   }
    97   for (size_t i=0;i<NDIM;++i)
    98     VV.vector[i] = boost::lexical_cast<double>(components.at(i));
    99   v = boost::any(VectorValue(VV));
    100 }
    101 
    102 void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int)
    103 {
    104   RealSpaceMatrixValue RSMV;
    105   std::vector<std::string> components;
    106 
    107   // split comma-separated values
    108   if (values.size() != 1) {
    109     std::cerr <<  "Not one vector but " << values.size() << " given " << std::endl;
    110 #if BOOST_VERSION < 104200
    111     throw boost::program_options::validation_error("Unequal to one vector given");
    112 #else
    113     throw boost::program_options::validation_error(
    114         boost::program_options::validation_error::invalid_option_value,
    115         std::string("value"),
    116         std::string("BoxValue")
    117     );
    118 #endif
    119   }
    120   std::string argument(values.at(0));
    121   std::string::iterator Aiter = argument.begin();
    122   std::string::iterator Biter = argument.begin();
    123   for (; Aiter != argument.end(); ++Aiter) {
    124     if (*Aiter == ',') {
    125       components.push_back(std::string(Biter,Aiter));
    126       do {
    127         Aiter++;
    128       } while (*Aiter == ' ' || *Aiter == '\t');
    129       Biter = Aiter;
    130     }
    131   }
    132   components.push_back(std::string(Biter,argument.end()));
    133 
    134107  if (components.size() != 6) {
    135108    std::cerr <<  "Specified vector does not have three components but " << components.size() << std::endl;
Note: See TracChangeset for help on using the changeset viewer.