| [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 | 
 | 
|---|
 | 21 | class 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 | 
 | 
|---|
 | 26 | public:
 | 
|---|
 | 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 | 
 | 
|---|
 | 49 | private:
 | 
|---|
 | 50 |   friend class boost::serialization::access;
 | 
|---|
 | 51 |   // serialization
 | 
|---|
 | 52 |   template <typename Archive>
 | 
|---|
 | 53 |   void serialize(Archive& ar, const unsigned int version)
 | 
|---|
 | 54 |   {
 | 
|---|
 | 55 |     ar & boost::serialization::base_object<forces_t>(*this);
 | 
|---|
 | 56 |   }
 | 
|---|
 | 57 | };
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | /** Function to print eigenvalues to ostream.
 | 
|---|
 | 60 |  *
 | 
|---|
 | 61 |  * @param ost output stream
 | 
|---|
 | 62 |  * @param eigenvalues set of eigenvalues to print
 | 
|---|
 | 63 |  * @return ref to given ostream for concatenation
 | 
|---|
 | 64 |  */
 | 
|---|
 | 65 | std::ostream & operator<<(std::ostream &ost, const FragmentForces &forces);
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | // we need to give this class a unique key for serialization
 | 
|---|
 | 68 | // its is only serialized through its base class FragmentJob
 | 
|---|
 | 69 | BOOST_CLASS_EXPORT_KEY(FragmentForces)
 | 
|---|
 | 70 | 
 | 
|---|
 | 71 | #endif /* FRAGMENTFORCES_HPP_ */
 | 
|---|