- Timestamp:
- May 8, 2017, 1:54:50 PM (8 years ago)
- Branches:
- ForceAnnealing_goodresults, ForceAnnealing_tocheck
- Children:
- d7bd62
- Parents:
- a443e1
- git-author:
- Frederik Heber <heber@…> (03/30/17 21:59:00)
- git-committer:
- Frederik Heber <frederik.heber@…> (05/08/17 13:54:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/CommandLineUI/CommandLineParser_validate.cpp
ra443e1 rcb5231 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.