Ignore:
Timestamp:
Oct 25, 2011, 12:08:03 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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, Candidate_v1.7.0, 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:
730d7a
Parents:
42127c
git-author:
Frederik Heber <heber@…> (10/20/11 10:17:10)
git-committer:
Frederik Heber <heber@…> (10/25/11 12:08:03)
Message:

Extracted functions from fragmentation_helpers and placed them in KeySet or Graph class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/KeySet.cpp

    r42127c r75363b  
    1818
    1919#include "CodePatterns/MemDebug.hpp"
     20
     21#include <sstream>
     22
     23#include "CodePatterns/Log.hpp"
    2024
    2125#include "KeySet.hpp"
     
    6670  return false; // if we reach this point, they are equal
    6771}
     72
     73/** Scans a single line for number and puts them into \a KeySet.
     74 * \param *buffer buffer to scan
     75 * \return true - at least one valid atom id parsed, false - CurrentSet is empty
     76 */
     77bool KeySet::ScanBufferIntoKeySet(char *buffer)
     78{
     79  std::stringstream line;
     80  int AtomNr;
     81  int status = 0;
     82
     83  line.str(buffer);
     84  while (!line.eof()) {
     85    line >> AtomNr;
     86    if (AtomNr >= 0) {
     87      insert(AtomNr);  // insert at end, hence in same order as in file!
     88      status++;
     89    } // else it's "-1" or else and thus must not be added
     90  }
     91  std::stringstream output;
     92  for(KeySet::iterator runner = begin(); runner != end(); runner++)
     93    output << (runner == begin() ? "" : " " ) << (*runner);
     94  LOG(2, "INFO: The scanned KeySet is " << output.str());
     95  return (status != 0);
     96}
Note: See TracChangeset for help on using the changeset viewer.