nt2_resize.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //==============================================================================
  2. // Copyright 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI
  3. // Copyright 2014 NumScale SAS
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // See accompanying file LICENSE.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt
  8. //==============================================================================
  9. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_RESIZE_HPP_INCLUDED
  10. #define BOOST_NUMERIC_ODEINT_EXTERNAL_NT2_NT2_RESIZE_HPP_INCLUDED
  11. #include <nt2/core/container/table/table.hpp>
  12. #include <boost/numeric/odeint/util/same_size.hpp>
  13. namespace boost { namespace numeric { namespace odeint {
  14. template<typename T, typename S>
  15. struct is_resizeable< nt2::container::table<T,S> >
  16. {
  17. typedef boost::true_type type;
  18. static const bool value = type::value;
  19. };
  20. template<typename T, typename S>
  21. struct same_size_impl< nt2::container::table<T,S>
  22. , nt2::container::table<T,S>
  23. >
  24. {
  25. static bool same_size ( const nt2::container::table<T,S> &v1
  26. , const nt2::container::table<T,S> &v2
  27. )
  28. {
  29. return v1.extent() == v2.extent();
  30. }
  31. };
  32. template<typename T, typename S>
  33. struct resize_impl< nt2::container::table<T,S>
  34. , nt2::container::table<T,S>
  35. >
  36. {
  37. static void resize ( nt2::container::table<T,S> &v1
  38. , const nt2::container::table<T,S> &v2
  39. )
  40. {
  41. v1.resize( v2.extent() );
  42. }
  43. };
  44. } } }
  45. #endif