Changeset f721c6
- Timestamp:
- Feb 2, 2010, 4:22:22 PM (15 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:
- 9ad391
- Parents:
- ac9b56
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/Observer.hpp
rac9b56 rf721c6 20 20 * Observation blocks from there, these functions wont trigger notifications. Only the end 21 21 * of the final observation block triggers the update of Observers. 22 * 23 * Returning from observed code should be done using the RETURN_OBSERVER() macro. This way the Observer mechanism 24 * is notified that the method is left. 22 25 * 23 26 * Each observerable can have sub-observables. When one of these sub-observables changes and … … 78 81 #define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0) 79 82 #define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this) 83 #define RETURN_OBSERVER( retval ) do{Observable::finish_observer_internal(this); return (retval);}while(0) 80 84 #endif /* OBSERVER_HPP_ */ -
src/molecule.cpp
rac9b56 rf721c6 103 103 bool molecule::AddAtom(atom *pointer) 104 104 { 105 bool retval = false; 106 START_OBSERVER; 105 107 if (pointer != NULL) { 106 108 pointer->sort = &pointer->nr; … … 119 121 } 120 122 } 121 return add(pointer, end); 122 } else 123 return false; 123 retval = add(pointer, end); 124 } 125 FINISH_OBSERVER; 126 return retval; 124 127 }; 125 128 … … 131 134 atom * molecule::AddCopyAtom(atom *pointer) 132 135 { 136 atom *retval = NULL; 137 START_OBSERVER; 133 138 if (pointer != NULL) { 134 139 atom *walker = new atom(pointer); … … 140 145 NoNonHydrogen++; 141 146 AtomCount++; 142 return walker; 143 } else 144 return NULL; 147 retval=walker; 148 } 149 FINISH_OBSERVER; 150 return retval; 145 151 }; 146 152 … … 181 187 bool molecule::AddHydrogenReplacementAtom(bond *TopBond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem) 182 188 { 189 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 190 START_OBSERVER; 183 191 double bondlength; // bond length of the bond to be replaced/cut 184 192 double bondangle; // bond angle of the bond to be replaced/cut 185 193 double BondRescale; // rescale value for the hydrogen bond length 186 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit187 194 bond *FirstBond = NULL, *SecondBond = NULL; // Other bonds in double bond case to determine "other" plane 188 195 atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added … … 228 235 if (BondRescale == -1) { 229 236 eLog() << Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 230 return false;237 RETURN_OBSERVER(false); 231 238 BondRescale = bondlength; 232 239 } else { … … 308 315 if (bondangle == -1) { 309 316 eLog() << Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 310 return false;317 RETURN_OBSERVER(false); 311 318 bondangle = 0; 312 319 } … … 435 442 Free(&matrix); 436 443 444 FINISH_OBSERVER; 437 445 // Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl; 438 446 return AllWentWell; … … 446 454 bool molecule::AddXYZFile(string filename) 447 455 { 456 448 457 istringstream *input = NULL; 449 458 int NumberOfAtoms = 0; // atom number in xyz read … … 459 468 return false; 460 469 470 START_OBSERVER; 461 471 getline(xyzfile,line,'\n'); // Read numer of atoms in file 462 472 input = new istringstream(line); … … 499 509 xyzfile.close(); 500 510 delete(input); 511 FINISH_OBSERVER; 501 512 return true; 502 513 };
Note:
See TracChangeset
for help on using the changeset viewer.