Changeset cb5231 for src/Actions/Values.cpp
- 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/Actions/Values.cpp
ra443e1 rcb5231 37 37 #include "CodePatterns/Assert.hpp" 38 38 39 #include <boost/lexical_cast.hpp> 40 #include <boost/tokenizer.hpp> 41 39 42 #include "Box.hpp" 40 43 #include "LinearAlgebra/BoxVector.hpp" … … 44 47 #include "Values.hpp" 45 48 49 static 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 46 74 Vector VectorValue::toVector() const 47 75 { 48 Vector returnVector (vector);76 Vector returnVector = parseAsVector(vectorstring); 49 77 50 78 return returnVector; … … 54 82 { 55 83 BoxVector returnVector; 56 static_cast<Vector>(returnVector) = Vector(vector); // under its hood it's still a Vector84 static_cast<Vector>(returnVector) = parseAsVector(vectorstring); // under its hood it's still a Vector 57 85 58 86 ASSERT(_box.isValid(returnVector),
Note:
See TracChangeset
for help on using the changeset viewer.