- Timestamp:
- Jun 19, 2017, 8:24:16 AM (8 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/CommandLineUI/CommandLineParser_validate.cpp
r2eded3e rf79d65 66 66 std::string("value"), 67 67 std::string("VectorValue") 68 ); 69 #endif 70 } 71 VV.vectorstring = values.at(0); 72 v = boost::any(VectorValue(VV)); 73 } 74 75 void 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") 68 90 ); 69 91 #endif … … 83 105 components.push_back(std::string(Biter,argument.end())); 84 106 85 if (components.size() != 3) {86 std::cerr << "Specified vector does not have three components but " << components.size() << std::endl;87 #if BOOST_VERSION < 10420088 throw boost::program_options::validation_error("Specified vector does not have three components");89 #else90 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 #endif96 }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 values108 if (values.size() != 1) {109 std::cerr << "Not one vector but " << values.size() << " given " << std::endl;110 #if BOOST_VERSION < 104200111 throw boost::program_options::validation_error("Unequal to one vector given");112 #else113 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 #endif119 }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 134 107 if (components.size() != 6) { 135 108 std::cerr << "Specified vector does not have three components but " << components.size() << std::endl;
Note:
See TracChangeset
for help on using the changeset viewer.