Changeset 0d4168
- Timestamp:
- May 20, 2014, 8:47:03 AM (11 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- cc6e5c
- Parents:
- c09f94
- git-author:
- Frederik Heber <heber@…> (08/28/13 23:05:38)
- git-committer:
- Frederik Heber <heber@…> (05/20/14 08:47:03)
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
rc09f94 r0d4168 136 136 } 137 137 ActionState::ptr state = Action::failure; 138 // try { 139 startTimer();138 startTimer(); 139 try { 140 140 state = performCall(); 141 endTimer(); 142 // } catch(MissingValueException&) { 143 // ELOG(0, "There is a value missing for action " << getName()); 144 // }; 141 } catch (ParameterException &e) { 142 if( const std::string *name=boost::get_error_info<ParameterName>(e) ) 143 ELOG(1, "The following parameter value is not valid: " << *name << "."); 144 state = Action::failure; 145 } 146 endTimer(); 145 147 146 148 if(shouldUndo() && state != failure){ -
src/Actions/ActionQueue.cpp
rc09f94 r0d4168 46 46 #include <vector> 47 47 48 #include "Actions/ActionExceptions.hpp" 48 49 #include "Actions/ActionHistory.hpp" 49 50 #include "Actions/ActionRegistry.hpp" 51 #include "World.hpp" 50 52 51 53 using namespace MoleCuilder; … … 79 81 newaction->prepare(state); 80 82 actionqueue.push_back( newaction ); 81 newaction->call(); 83 try { 84 newaction->call(); 85 } catch(ActionFailureException &e) { 86 std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl; 87 World::getInstance().setExitFlag(5); 88 } 82 89 } 83 90 -
src/Actions/GlobalListOfActions.hpp
rc09f94 r0d4168 48 48 (CommandHelp) \ 49 49 (CommandHelpRedistribute) \ 50 (CommandLoadSession) \51 50 (CommandSetRandomNumbersEngine) \ 52 51 (CommandSetRandomNumbersDistribution) \ … … 170 169 171 170 // define final list 172 #define GLOBALLISTOFACTIONS GLOBALLISTOFACTIONS_LEVMAR 171 172 #ifdef HAVE_PYTHON 173 #define GLOBALLISTOFACTIONS_PYTHON \ 174 BOOST_PP_SEQ_PUSH_BACK( \ 175 GLOBALLISTOFACTIONS_LEVMAR, \ 176 CommandLoadSession \ 177 ) 178 #else 179 #define GLOBALLISTOFACTIONS_PYTHON \ 180 GLOBALLISTOFACTIONS_LEVMAR 181 #endif 182 183 #define GLOBALLISTOFACTIONS GLOBALLISTOFACTIONS_PYTHON 184 185 // define python list 186 // skips CommandLoadSession as this causes dangerous infinite loops 187 #define GLOBALLISTOFPYTHONACTIONS \ 188 GLOBALLISTOFACTIONS_LEVMAR 173 189 174 190 #endif /* GLOBALLISTOFACTIONS_HPP_ */ -
src/Actions/Makefile.am
rc09f94 r0d4168 190 190 Actions/CommandAction/HelpAction.cpp \ 191 191 Actions/CommandAction/HelpRedistributeAction.cpp \ 192 Actions/CommandAction/LoadSessionAction.cpp \193 192 Actions/CommandAction/StoreSessionAction.cpp \ 194 193 Actions/CommandAction/VerboseAction.cpp \ … … 201 200 Actions/CommandAction/HelpAction.hpp \ 202 201 Actions/CommandAction/HelpRedistributeAction.hpp \ 203 Actions/CommandAction/LoadSessionAction.hpp \204 202 Actions/CommandAction/StoreSessionAction.hpp \ 205 203 Actions/CommandAction/VerboseAction.hpp \ … … 212 210 Actions/CommandAction/HelpAction.def \ 213 211 Actions/CommandAction/HelpRedistributeAction.def \ 214 Actions/CommandAction/LoadSessionAction.def \215 212 Actions/CommandAction/StoreSessionAction.def \ 216 213 Actions/CommandAction/VerboseAction.def \ 217 214 Actions/CommandAction/VersionAction.def \ 218 215 Actions/CommandAction/WarrantyAction.def 216 217 if CONDPYTHON 218 CMDACTIONSOURCE += \ 219 Actions/CommandAction/LoadSessionAction.cpp 220 CMDACTIONHEADER += \ 221 Actions/CommandAction/LoadSessionAction.hpp 222 CMDACTIONDEFS += \ 223 Actions/CommandAction/LoadSessionAction.def 224 endif 219 225 220 226 FILLACTIONSOURCE = \ -
src/Parameters/Parameter_impl.hpp
rc09f94 r0d4168 23 23 value(instance.value.getValidator()) 24 24 { 25 value.set(instance.value. get());25 value.set(instance.value.value); 26 26 } 27 27 … … 260 260 { 261 261 Parameter<T> *instance = new Parameter<T>(ParameterInterface::getName(), value.getValidator()); 262 // do not use get, we do not check for validity here 262 263 if (value.ValueSet) 263 instance->set(value. get());264 instance->set(value.value); 264 265 return instance; 265 266 } -
src/Parameters/Value_impl.hpp
rc09f94 r0d4168 119 119 inline const T & Value<T>::get() const throw(ParameterValueException) 120 120 { 121 if (!isValid(value)) throw ParameterValueException(); 121 122 if (!ValueSet) throw ParameterValueException(); 122 123 return value; … … 130 131 inline void Value<T>::set(const T & _value) throw(ParameterException) 131 132 { 132 if (!isValid(_value)) throw ParameterValueException(); 133 // any value may be set, this allows Actions to have invalid parameters 134 // (e.g. because the given atom id does not yet exist) that are checked 135 // on performCall() 136 // if (!isValid(_value)) throw ParameterValueException(); 133 137 if (!ValueSet) 134 138 ValueSet = true; … … 168 172 inline const std::string Value<T>::getAsString() const throw(ParameterValueException) 169 173 { 170 if (!ValueSet) throw ParameterValueException(); 171 return toString(value); 174 return toString(get()); 172 175 } 173 176 -
src/Parameters/unittests/ContinuousValueTest.cpp
rc09f94 r0d4168 145 145 void ContinuousValueTest::settergetterIntAsStringTest() 146 146 { 147 // unset calling of get, throws ParameterValueException 148 { 149 Value<int> test(*ValidIntRange); 150 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 151 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 152 } 153 154 // setting invalid and getting it, throws ParameterValueException 155 { 156 Value<int> test(*ValidIntRange); 157 test.setAsString(toString(5)); 158 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 159 test.setAsString(toString(0)); 160 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 161 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 162 } 163 164 // checking all valid ones 165 { 166 Value<int> test(*ValidIntRange); 167 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 168 for (int i=1; i<=4;++i) { 169 test.setAsString(toString(i)); 170 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 171 CPPUNIT_ASSERT_EQUAL(toString(i), test.getAsString()); 172 } 173 } 174 } 175 176 /** Unit test for setters and getters. 177 * 178 */ 179 void ContinuousValueTest::settergetterIntTest() 180 { 147 181 // create instance 148 182 Value<int> test(*ValidIntRange); … … 150 184 // unset calling of get, throws ParameterValueException 151 185 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 152 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException);153 154 // setting invalid, throws ParameterValueException155 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;156 CPPUNIT_ASSERT_THROW(test.setAsString(toString(5)), ParameterValueException);157 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;158 CPPUNIT_ASSERT_THROW(test.setAsString(toString(0)), ParameterValueException);159 160 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet);161 // checking all valid ones162 for (int i=1; i<=4;++i) {163 test.setAsString(toString(i));164 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet);165 CPPUNIT_ASSERT_EQUAL(toString(i), test.getAsString());166 }167 }168 169 /** Unit test for setters and getters.170 *171 */172 void ContinuousValueTest::settergetterIntTest()173 {174 // create instance175 Value<int> test(*ValidIntRange);176 177 // unset calling of get, throws ParameterValueException178 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;179 186 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 180 187 181 // setting invalid, throws ParameterValueException 182 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 183 CPPUNIT_ASSERT_THROW(test.set(5), ParameterValueException); 184 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 185 CPPUNIT_ASSERT_THROW(test.set(0), ParameterValueException); 188 // setting invalid and getting it, throws ParameterValueException 189 test.set(5); 190 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 191 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 192 test.set(0); 193 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 194 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 186 195 187 196 // checking all valid ones … … 381 390 void ContinuousValueTest::settergetterVectorTest() 382 391 { 383 // create instance384 Value<Vector> test(*ValidVectorRange);385 386 392 // unset calling of get, throws 387 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 388 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 389 390 // setting invalid, throws 391 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 392 CPPUNIT_ASSERT_THROW(test.set(Vector(5,0,0)), ParameterValueException); 393 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 394 CPPUNIT_ASSERT_THROW(test.set(Vector(5,20,5)), ParameterValueException); 395 396 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 393 { 394 Value<Vector> test(*ValidVectorRange); 395 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 396 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 397 } 398 399 // setting invalid and getting it, throws 400 { 401 Value<Vector> test(*ValidVectorRange); 402 test.set(Vector(5,0,0)); 403 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 404 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 405 test.set(Vector(5,20,5)); 406 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 407 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 408 } 409 397 410 // checking some valid ones 398 for (int i=1; i<=4;++i) { 399 Vector v(i,5,5); 400 test.set(v); 401 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 402 CPPUNIT_ASSERT_EQUAL(v, test.get()); 411 { 412 Value<Vector> test(*ValidVectorRange); 413 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 414 for (int i=1; i<=4;++i) { 415 Vector v(i,5,5); 416 test.set(v); 417 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 418 CPPUNIT_ASSERT_EQUAL(v, test.get()); 419 } 403 420 } 404 421 } -
src/Parameters/unittests/DiscreteValueTest.cpp
rc09f94 r0d4168 174 174 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 175 175 176 // setting invalid, throws 177 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 178 CPPUNIT_ASSERT_THROW(test.set(4), ParameterValueException); 179 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 180 CPPUNIT_ASSERT_THROW(test.set(0), ParameterValueException); 176 // setting invalid and getting it, throws 177 test.set(4); 178 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 179 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 180 test.set(0); 181 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 182 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 181 183 182 184 // checking all valid ones … … 200 202 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 201 203 202 // setting invalid, throws 203 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 204 CPPUNIT_ASSERT_THROW(test.setAsString(toString(4)), ParameterValueException); 205 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 206 CPPUNIT_ASSERT_THROW(test.setAsString(toString(0)), ParameterValueException); 204 // setting invalid and getting it, throws 205 test.setAsString(toString(4)); 206 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 207 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 208 test.setAsString(toString(0)); 209 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 210 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 207 211 208 212 // checking all valid ones -
src/UIElements/Dialog.cpp
rc09f94 r0d4168 68 68 bool Dialog::display(){ 69 69 handleAll(); 70 if(checkAll()){ 71 setAll(); 72 return true; 73 } 74 else{ 75 return false; 76 } 70 setAll(); 71 return true; 72 // if(checkAll()){ 73 // setAll(); 74 // return true; 75 // } 76 // else{ 77 // return false; 78 // } 77 79 } 78 80 … … 107 109 list<Query*>::iterator iter; 108 110 for(iter=queries.begin(); iter!=queries.end(); iter++) { 109 try {111 // try { 110 112 (*iter)->setResult(); 111 } catch (ParameterException &e) {112 if( const std::string *name=boost::get_error_info<ParameterName>(e) )113 ELOG(1, "The following parameter value is not valid: " << *name << ".");114 break;115 }113 // } catch (ParameterException &e) { 114 // if( const std::string *name=boost::get_error_info<ParameterName>(e) ) 115 // ELOG(1, "The following parameter value is not valid: " << *name << "."); 116 // break; 117 // } 116 118 } 117 119 } -
src/builder_init.cpp
rc09f94 r0d4168 164 164 { 165 165 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(); 166 try { 167 mainWindow->display(); 168 } catch(ActionFailureException &e) { 169 std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl; 170 World::getInstance().setExitFlag(5); 171 } 166 mainWindow->display(); 172 167 delete mainWindow; 173 168 } -
tests/regression/Atoms/Add/testsuite-atoms-add.at
rc09f94 r0d4168 53 53 AT_SETUP([Atoms - adding outside boundary fails]) 54 54 AT_KEYWORDS([atoms boundary add-atom]) 55 AT_XFAIL_IF([/bin/true])56 55 57 AT_CHECK([../../molecuilder -i test2.conf -o mpqc pcp xyz tremolo pdb --set-boundary-conditions "Ignore,Ignore,Ignore" -a 1 --domain-position "0., 0., -1."], 134, [ignore], [ignore])56 AT_CHECK([../../molecuilder -i test2.conf -o mpqc pcp xyz tremolo pdb --set-boundary-conditions "Ignore,Ignore,Ignore" -a 1 --domain-position "0., 0., -1."], 5, [ignore], [ignore]) 58 57 59 58 AT_CLEANUP -
tests/regression/Options/Session/testsuite-options-load-session-python.at
rc09f94 r0d4168 19 19 20 20 AT_SETUP([Standard Options - load session]) 21 AT_KEYWORDS([options load-session])22 AT_TESTED([python diff ])23 AT_SKIP_IF([../../molecuilder -- load-session dummy.py; if test $? -eq 5; then /bin/false; else /bin/true; fi])21 AT_KEYWORDS([options python load-session]) 22 AT_TESTED([python diff grep]) 23 AT_SKIP_IF([../../molecuilder --help --actionname load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 24 24 25 25 # check that session is stored and can be executed when correctly prefixed … … 32 32 33 33 AT_SETUP([Standard Options - load complex session]) 34 AT_KEYWORDS([options load-session])35 AT_TESTED([python diff ])36 AT_SKIP_IF([../../molecuilder -- load-session dummy.py; if test $? -eq 5; then /bin/false; else /bin/true; fi])34 AT_KEYWORDS([options python load-session]) 35 AT_TESTED([python diff grep]) 36 AT_SKIP_IF([../../molecuilder --help --actionname load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 37 37 38 38 # check that session is stored and can be executed when correctly prefixed -
tests/regression/Options/Session/testsuite-options-store-session-python.at
rc09f94 r0d4168 19 19 20 20 AT_SETUP([Standard Options - store session as Python]) 21 AT_KEYWORDS([options store-session])22 AT_TESTED([python diff ])23 AT_SKIP_IF([../../molecuilder -- load-session dummy.py; if test $? -eq 5; then /bin/false; else /bin/true; fi])21 AT_KEYWORDS([options python store-session]) 22 AT_TESTED([python diff grep]) 23 AT_SKIP_IF([../../molecuilder --help --actionname load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 24 24 25 25 # check that session is stored and can be executed when correctly prefixed … … 32 32 33 33 AT_SETUP([Standard Options - store complex session as Python]) 34 AT_KEYWORDS([options store-session])35 AT_TESTED([python diff ])36 AT_SKIP_IF([../../molecuilder -- load-session dummy.py; if test $? -eq 5; then /bin/false; else /bin/true; fi])34 AT_KEYWORDS([options python store-session]) 35 AT_TESTED([python diff grep]) 36 AT_SKIP_IF([../../molecuilder --help --actionname load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 37 37 38 38 # check that session is stored and can be executed when correctly prefixed
Note:
See TracChangeset
for help on using the changeset viewer.