void UpdaterBoostNoUnits::solar_system_coor::operator()(const container_t& p, container_t& dqdt) const
{
    assert(p.size() == m_masses.size());
    assert(dqdt.size() == m_masses.size());
    const auto n = m_masses.size();
    for(size_t i=0 ; i<n ; ++i)
        dqdt[i] = p[i] / m_masses[i];
}
  bool compare(container_t const & lhs, container_t const & rhs, typename container_t::value_type precision)
  {
    if (&lhs == &rhs) {
      return true;
    }
    if (lhs.size() != rhs.size()) {
      return false;
    }
    typename container_t::const_iterator il(lhs.begin());
    typename container_t::const_iterator ir(rhs.begin());
    typename container_t::const_iterator il_end(lhs.end());
    for (/**/; il != il_end; ++il, ++ir) {
      if (fabs(*il - *ir) > precision) {
	return false;
      }
    }
    return true;
  }
Beispiel #3
0
  typename std::enable_if<std::is_class<container_t>::value && sizeof(typename container_t::value_type)!=0
			  //has_member_function size,
			  ,
			  const typename container_t::value_type*>::type
  end(const container_t& _array){

    return &_array[_array.size()];
    
  }
void UpdaterBoostNoUnits::solar_system_momentum::operator()(const container_t& q, container_t& dpdt) const
{
    assert(q.size() == m_masses.size());
    assert(dpdt.size() == m_masses.size());
    const size_t n = q.size();
    for(size_t i=0 ; i<n ; ++i)
    {
        dpdt[i] = Point3D<double>{0};
        for(size_t j=0 ; j<i ; ++j)
        {
            const auto diff = q[j] - q[i];
            const auto d = diff.norm();
            const auto res = diff * ( gravitational_constant * m_masses[i] * m_masses[j] / d / d / d );
            dpdt[i] += res;
            dpdt[j] -= res;

        }
    }
}
Beispiel #5
0
    void erase(const KEY& key)
    {
        const_iterator it = findKey(key);
        if (it != m_contents.end())
        {
            // Avoid std::vector.erase here due to bug in libstdc++ < v4.9
#if PONDER_WORKAROUND_GCC_N2350
            std::size_t pos = it - m_contents.begin();
            const std::size_t sz = m_contents.size() - 1;
            while (pos < sz)
                m_contents[pos] = m_contents[pos + 1], ++pos;
            m_contents.resize(sz);
#else
            m_contents.erase(it);
#endif
        }
    }
Beispiel #6
0
	size_t size() const { return __container.size(); }
Beispiel #7
0
 bool socket_t::send(const container_t& message, int flags) {
   return send(static_cast<const void*>(message.data()), message.size(), flags);
 }
Beispiel #8
0
 std::size_t size() const { return m_contents.size(); }