Changeset 8c6b68 for src/Atom


Ignore:
Timestamp:
Apr 10, 2018, 6:43:12 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
6145577
Parents:
efd020
git-author:
Frederik Heber <frederik.heber@…> (08/03/17 10:46:48)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:12)
Message:

atom::removeStep() extended to removing interval of steps.

  • AtomInfo::removeTrajectorySteps() and BondedParticle::removeTrajectorySteps() changed and all calls adapted.
Location:
src/Atom
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/Atom/TesselPoint.cpp

    refd020 r8c6b68  
    5858};
    5959
    60 void TesselPoint::removeStep(const unsigned int _step)
     60void TesselPoint::removeSteps(const unsigned int _firststep, const unsigned int _laststep)
    6161{
    62   ASSERT(0, "TesselPoint::removeStep() should never be called, TesselPoints don't have trajectories.");
    63   AtomInfo::removeTrajectoryStep(_step);
     62  ASSERT(0, "TesselPoint::removeSteps() should never be called, TesselPoints don't have trajectories.");
     63  AtomInfo::removeTrajectorySteps(_firststep, _laststep);
    6464};
    6565
  • src/Atom/TesselPoint.hpp

    refd020 r8c6b68  
    4343   * This allows to decrease all trajectories contained in different classes
    4444   * by one consistently. This is implemented by the topmost class which calls
    45    * the real functions, \sa removeTrajectoryStep(), by all necessary subclasses.
     45   * the real functions, \sa removeTrajectorySteps(), by all necessary subclasses.
     46   *
     47   * \param _firststep first step in interval to be removed
     48   * \param _laststep last step in interval to be removed
    4649   */
    47   virtual void removeStep(const unsigned int _step);
     50  virtual void removeSteps(const unsigned int _firststep, const unsigned int _laststep);
    4851
    4952  /** Getter for this.
  • src/Atom/atom.cpp

    refd020 r8c6b68  
    108108}
    109109
    110 void atom::removeStep(const unsigned int _step)
    111 {
    112   LOG(4,"atom::removeStep() called.");
     110void atom::removeSteps(const unsigned int _firststep, const unsigned int _laststep)
     111{
     112  LOG(4,"atom::removeSteps() called.");
    113113  // append to position, velocity and force vector
    114   AtomInfo::removeTrajectoryStep(_step);
     114  AtomInfo::removeTrajectorySteps(_firststep, _laststep);
    115115  // append to ListOfBonds vector
    116   BondedParticleInfo::removeTrajectoryStep(_step);
     116  BondedParticleInfo::removeTrajectorySteps(_firststep, _laststep);
    117117}
    118118
  • src/Atom/atom.hpp

    refd020 r8c6b68  
    7979   * This allows to decrease all trajectories contained in different classes
    8080   * by one consistently. This is implemented by the topmost class which calls
    81    * the real functions, \sa removeTrajectoryStep(), by all necessary subclasses.
    82    */
    83   virtual void removeStep(const unsigned int _step);
     81   * the real functions, \sa removeTrajectorySteps(), by all necessary subclasses.
     82   *
     83   * \param _firststep first step in interval to be removed
     84   * \param _laststep last step in interval to be removed
     85   */
     86  virtual void removeSteps(const unsigned int _firststep, const unsigned int _laststep);
    8487
    8588  /** Output of a single atom with given numbering.
  • src/Atom/atom_atominfo.cpp

    refd020 r8c6b68  
    101101}
    102102
    103 void AtomInfo::removeTrajectoryStep(const unsigned int _step)
     103void AtomInfo::eraseInTrajctory(
     104    VectorTrajectory_t &_trajectory,
     105    const unsigned int _firststep, const unsigned int _laststep)
     106{
     107  const VectorTrajectory_t::iterator firstiter = _trajectory.lower_bound(_firststep);
     108  const VectorTrajectory_t::iterator lastiter = _trajectory.upper_bound(_laststep);
     109  _trajectory.erase(firstiter, lastiter);
     110}
     111
     112void AtomInfo::removeTrajectorySteps(const unsigned int _firststep, const unsigned int _laststep)
    104113{
    105114  NOTIFY(TrajectoryChanged);
    106   AtomicPosition.erase(_step);
    107   AtomicVelocity.erase(_step);
    108   AtomicForce.erase(_step);
    109   LOG(5,"AtomInfo::removeTrajectoryStep() called, size is ("
     115  eraseInTrajctory(AtomicPosition, _firststep, _laststep);
     116  eraseInTrajctory(AtomicVelocity, _firststep, _laststep);
     117  eraseInTrajctory(AtomicForce, _firststep, _laststep);
     118  LOG(5,"AtomInfo::removeTrajectorySteps() called, size is ("
    110119      << AtomicPosition.size() << ","
    111120      << AtomicVelocity.size() << ","
  • src/Atom/atom_atominfo.hpp

    refd020 r8c6b68  
    5858  virtual void UpdateStep(const unsigned int _step)=0;
    5959
    60   /** Pops the last step in all trajectory vectors.
     60  /** Pops all steps in the interval [\a _firststep, \a _laststep] in all trajectory vectors.
    6161   *
    6262   * This allows to decrease all trajectories contained in different classes
    6363   * by one consistently. This is implemented by the topmost class which calls
    64    * the real functions, \sa removeTrajectoryStep(), by all necessary subclasses.
    65    */
    66   virtual void removeStep(const unsigned int _step)=0;
     64   * the real functions, \sa removeTrajectorySteps(), by all necessary subclasses.
     65   *
     66   * \param _firststep first step in interval to be removed
     67   * \param _laststep last step in interval to be removed
     68   */
     69  virtual void removeSteps(const unsigned int _firststep, const unsigned int _laststep)=0;
    6770
    6871  /** DEPRECATED: Getter for element indicated by AtomicElement.
     
    314317  /** Function used by this and inheriting classes to decrease the trajectory
    315318   * vectors by one.
    316    */
    317   void removeTrajectoryStep(const unsigned int _step);
     319   *
     320   * \param _firststep first step in interval to be removed
     321   * \param _laststep last step in interval to be removed
     322   */
     323  void removeTrajectorySteps(const unsigned int _firststep, const unsigned int _laststep);
    318324
    319325  // make these protected only such that deriving atom class still has full
     
    325331  VectorTrajectory_t AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
    326332  VectorTrajectory_t AtomicForce;       //!< Force vector of atom, giving last force within cell
     333
     334  /** Helper function to avoid an interval of steps in VectorTrajectory_t.
     335   *
     336   * \param  _trajectory trajectory to remove in
     337   * \param _firststep first step in interval to be removed
     338   * \param _laststep last step in interval to be removed
     339   */
     340  static void eraseInTrajctory(
     341      VectorTrajectory_t &_trajectory,
     342      const unsigned int _firststep, const unsigned int _laststep);
    327343
    328344private:
  • src/Atom/atom_bondedparticleinfo.cpp

    refd020 r8c6b68  
    5151}
    5252
    53 void BondedParticleInfo::removeTrajectoryStep(const unsigned int _step)
     53void BondedParticleInfo::removeTrajectorySteps(const unsigned int _firststep, const unsigned int _laststep)
    5454{
    55   ListOfBonds.erase(_step);
    56   LOG(5,"BondedParticleInfo::removeTrajectoryStep() called, size is " << ListOfBonds.size());
     55  const BondTrajectory_t::iterator firstiter = ListOfBonds.lower_bound(_firststep);
     56  const BondTrajectory_t::iterator lastiter = ListOfBonds.upper_bound(_laststep);
     57  ListOfBonds.erase(firstiter, lastiter);
     58  LOG(5,"BondedParticleInfo::removeTrajectorySteps() called, size is " << ListOfBonds.size());
    5759}
    5860
  • src/Atom/atom_bondedparticleinfo.hpp

    refd020 r8c6b68  
    5252   * This allows to decrease all trajectories contained in different classes
    5353   * by one consistently. This is implemented by the topmost class which calls
    54    * the real functions, \sa removeTrajectoryStep(), by all necessary subclasses.
     54   * the real functions, \sa removeTrajectorySteps(), by all necessary subclasses.
     55   *
     56   * \param _firststep first step in interval to be removed
     57   * \param _laststep last step in interval to be removed
    5558   */
    56   virtual void removeStep(const unsigned int _step)=0;
     59  virtual void removeSteps(const unsigned int _firststep, const unsigned int _laststep)=0;
    5760
    5861  /** Const accessor to ListOfBonds of WorldTime::CurrentTime.
     
    131134  /** Function used by this and inheriting classes to reduce the ListOfBonds
    132135   * vector by one.
     136   *
     137   * \param _firststep first step in interval to be removed
     138   * \param _laststep last step in interval to be removed
    133139   */
    134   void removeTrajectoryStep(const unsigned int _step);
     140  void removeTrajectorySteps(const unsigned int _firststep, const unsigned int _laststep);
    135141
    136142  typedef std::map<unsigned int, BondList> BondTrajectory_t;
Note: See TracChangeset for help on using the changeset viewer.