Changeset e2373df for src


Ignore:
Timestamp:
Feb 24, 2011, 6:36:33 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, 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:
fb9eba
Parents:
fb0b62
git-author:
Frederik Heber <heber@…> (02/24/11 14:48:51)
git-committer:
Frederik Heber <heber@…> (02/24/11 18:36:33)
Message:

TesselPoint, Atom and AtomInfo have virtual UpdateSteps() to allow consistent extending of trajectories.

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/TesselPoint.cpp

    rfb0b62 re2373df  
    2020#include "CodePatterns/MemDebug.hpp"
    2121
     22#include "CodePatterns/Log.hpp"
     23
    2224#include "TesselPoint.hpp"
    2325
     
    3537{};
    3638
     39void TesselPoint::UpdateSteps()
     40{
     41  ASSERT(0, "TesselPoint::UpdateSteps() should never be called, TesselPoints don't have trajectories.");
     42  AtomInfo::AppendTrajectoryStep();
     43};
     44
    3745std::ostream & TesselPoint::operator << (std::ostream &ost) const
    3846{
  • src/TesselPoint.hpp

    rfb0b62 re2373df  
    2626  ~TesselPoint();
    2727
     28  /** Pushes back another step in all trajectory vectors.
     29   *
     30   * This allows to extend all trajectories contained in different classes
     31   * consistently. This is implemented by the topmost class which calls the
     32   * real functions, \sa AppendTrajectoryStep(), by all necessary subclasses.
     33   *
     34   * Note that this function is actually not sensible with TesselPoints
     35   * as they should not have trajectories but is implemented as they can be
     36   * used stand-alone.
     37   *
     38   */
     39  virtual void UpdateSteps();
     40
    2841  std::ostream & operator << (std::ostream &ost) const;
    2942};
  • src/atom.cpp

    rfb0b62 re2373df  
    2121#include "atom.hpp"
    2222#include "bond.hpp"
     23#include "CodePatterns/Log.hpp"
    2324#include "config.hpp"
    2425#include "element.hpp"
     
    7879};
    7980
     81
     82void atom::UpdateSteps()
     83{
     84  LOG(4,"atom::UpdateSteps() called.");
     85  // append to position, velocity and force vector
     86  AtomInfo::AppendTrajectoryStep();
     87}
    8088
    8189/** Climbs up the father list until NULL, last is returned.
  • src/atom.hpp

    rfb0b62 re2373df  
    5252
    5353  virtual atom *clone();
     54
     55  /** Pushes back another step in all trajectory vectors.
     56   *
     57   * This allows to extend all trajectories contained in different classes
     58   * consistently. This is implemented by the topmost class which calls the
     59   * real functions, \sa AppendTrajectoryStep(), by all necessary subclasses.
     60   */
     61  virtual void UpdateSteps();
    5462
    5563  bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const;
  • src/atom_atominfo.cpp

    rfb0b62 re2373df  
    7474};
    7575
     76void AtomInfo::AppendTrajectoryStep()
     77{
     78  AtomicPosition.push_back(zeroVec);
     79  AtomicVelocity.push_back(zeroVec);
     80  AtomicForce.push_back(zeroVec);
     81}
     82
    7683const element *AtomInfo::getType() const
    7784{
     
    191198    AtomicVelocity[_step] = _newvelocity;
    192199  } else if (_step == size) {
    193     AtomicVelocity.push_back(_newvelocity);
     200    UpdateSteps();
     201    AtomicVelocity[_step] = _newvelocity;
    194202  }
    195203}
     
    232240    AtomicForce[_step] = _newforce;
    233241  } else if (_step == size) {
    234     AtomicForce.push_back(_newforce);
     242    UpdateSteps();
     243    AtomicForce[_step] = _newforce;
    235244  }
    236245}
     
    266275    AtomicPosition[_step] = _vector;
    267276  } else if (_step == size) {
    268     AtomicPosition.push_back(_vector);
     277    UpdateSteps();
     278    AtomicPosition[_step] = _vector;
    269279  }
    270280  //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
     
    438448void AtomInfo::ResizeTrajectory(size_t MaxSteps)
    439449{
    440   if (AtomicPosition.size() <= (unsigned int)(MaxSteps)) {
    441     DoLog(0) && (Log() << Verbose(0) << "Increasing size for trajectory array from " << AtomicPosition.size() << " to " << (MaxSteps+1) << "." << endl);
    442     AtomicPosition.resize(MaxSteps+1, zeroVec);
    443     AtomicVelocity.resize(MaxSteps+1, zeroVec);
    444     AtomicForce.resize(MaxSteps+1, zeroVec);
    445   }
    446   for (size_t i = AtomicPosition.size(); i <= MaxSteps; ++i) {
    447     AtomicPosition[i] = zeroVec;
    448     AtomicVelocity[i] = zeroVec;
    449     AtomicForce[i] = zeroVec;
    450   }
    451 };
     450  for (;AtomicPosition.size() <= (unsigned int)(MaxSteps);)
     451    UpdateSteps();
     452}
    452453
    453454size_t AtomInfo::getTrajectorySize() const
  • src/atom_atominfo.hpp

    rfb0b62 re2373df  
    4141  AtomInfo(const VectorInterface &_v);
    4242  virtual ~AtomInfo();
     43
     44  /** Pushes back another step in all trajectory vectors.
     45   *
     46   * This allows to extend all trajectories contained in different classes
     47   * consistently. This is implemented by the topmost class which calls the
     48   * real functions, \sa AppendTrajectoryStep(), by all necessary subclasses.
     49   */
     50  virtual void UpdateSteps()=0;
    4351
    4452  /** Getter for AtomicElement.
     
    242250
    243251protected:
     252  /** Function used by this and inheriting classes to extend the trajectory
     253   * vectors.
     254   */
     255  void AppendTrajectoryStep();
     256
    244257  // make these protected only such that deriving atom class still has full
    245258  // access needed for clone and alike
Note: See TracChangeset for help on using the changeset viewer.