/* * detail.hpp * * Created on: Jun 12, 2016 * Author: heber */ #ifndef FRAGMENTATION_SUMMATION_SETVALUES_DETAIL_HPP_ #define FRAGMENTATION_SUMMATION_SETVALUES_DETAIL_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include namespace detail { /** This class represents a force, i.e. a vector with three components. * * This is used as a specific type with the necessary summation functions * for IndexedValue. */ struct force : public std::vector { //!> typedef for a single vector typedef std::vector vector_t; /** Default constructor for a force vector. * * We assure that we have always three components. */ force() : std::vector(FixedSize, 0.) {} /** Constructor for a force vector. * * \param _c1 first component * \param _c2 second component * \param _c3 third component */ force(const double &_c1, const double &_c2, const double &_c3); /** Constructor for a force vector. * * \param _components vector of three components */ force(const vector_t &_components); /** Assignment operator for the force components. * * \param _c1 first component * \param _c2 second component * \param _c3 third component */ force& operator()(const double &_c1, const double &_c2, const double &_c3); /** Assignment operator for the force components. * * \param _components vector of three components */ force& operator()(const vector_t &_components); /** Sum operator. * * \param _components vector of three components */ force& operator+=(const vector_t &_components); /** Subtraction operator. * * \param _components vector of three components */ force& operator-=(const vector_t &_components); /** Summation operator for two force vectors. * * \param other other force vector * \param prefactor prefactor to use in summation (e.g. -1 gives a subtraction) */ void superposeOtherIndexedVectors(const force &other, const double prefactor); //!> fixed size of all value static const size_t FixedSize; //!> static instance representing a null vector static const vector_t nullvector; }; }; #endif /* FRAGMENTATION_SUMMATION_SETVALUES_DETAIL_HPP_ */