source: src/Fragmentation/Summation/SetValues/FragmentForces.hpp@ 0ee9cb3

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 0ee9cb3 was 291ad9, checked in by Frederik Heber <heber@…>, 9 years ago

Added operator+=() to FragmentForces and unit test.

  • FIX: operator==() was not working properly.
  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[d200ae]1/*
2 * FragmentForces.hpp
3 *
4 * Created on: Oct 23, 2014
5 * Author: heber
6 */
7
8#ifndef FRAGMENTFORCES_HPP_
9#define FRAGMENTFORCES_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <vector>
17
18#include "boost/serialization/export.hpp"
19#include "boost/serialization/vector.hpp"
20
21class FragmentForces : public std::vector< std::vector<double> >
22{
23 //!> let ostream access private parts
24 friend std::ostream & operator<<(std::ostream &ost, const FragmentForces &forces);
25
26public:
27 //!> typedef for a vector with three components
28 typedef std::vector<double> force_t;
29 //!> typedef for a vector containing the force per fragment atom
30 typedef std::vector<force_t> forces_t;
31
32 /** Default constructor for FragmentForces.
33 *
34 */
35 FragmentForces() {}
36
37 /** Equality operator.
38 *
39 * @param other other instance to check against
40 * @return true - both are equal, false - some FragmentForces differ
41 */
42 bool operator==(const FragmentForces& other) const;
43
44 bool operator!=(const FragmentForces& other) const
45 {
46 return (!(*this == other));
47 }
48
[291ad9]49 void operator+=(const FragmentForces& other);
50
[d200ae]51private:
52 friend class boost::serialization::access;
53 // serialization
54 template <typename Archive>
55 void serialize(Archive& ar, const unsigned int version)
56 {
57 ar & boost::serialization::base_object<forces_t>(*this);
58 }
59};
60
61/** Function to print eigenvalues to ostream.
62 *
63 * @param ost output stream
64 * @param eigenvalues set of eigenvalues to print
65 * @return ref to given ostream for concatenation
66 */
67std::ostream & operator<<(std::ostream &ost, const FragmentForces &forces);
68
69// we need to give this class a unique key for serialization
70// its is only serialized through its base class FragmentJob
71BOOST_CLASS_EXPORT_KEY(FragmentForces)
72
73#endif /* FRAGMENTFORCES_HPP_ */
Note: See TracBrowser for help on using the repository browser.