Changeset f79d65 for src/Actions
- 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)
- Location:
- src/Actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Values.cpp
r2eded3e rf79d65 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), -
src/Actions/Values.hpp
r2eded3e rf79d65 27 27 * are registered as VectorValue and lateron inside the CommandLineQuery placed 28 28 * into the real vector. 29 * 30 * We use this abstraction also for Geometry Objects, i.e. string names 31 * referencing vectors in the GeomtryRegistry. 29 32 */ 30 33 struct VectorValue 31 34 { 32 double vector[NDIM];35 std::string vectorstring; 33 36 34 37 Vector toVector() const;
Note:
See TracChangeset
for help on using the changeset viewer.