nt2_resize.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #include <type_traits>
  14. namespace boost { namespace numeric { namespace odeint {
  15. template<typename T, typename S>
  16. struct is_resizeable< nt2::container::table<T,S> >
  17. {
  18. typedef std::true_type type;
  19. static const bool value = type::value;
  20. };
  21. template<typename T, typename S>
  22. struct same_size_impl< nt2::container::table<T,S>
  23. , nt2::container::table<T,S>
  24. >
  25. {
  26. static bool same_size ( const nt2::container::table<T,S> &v1
  27. , const nt2::container::table<T,S> &v2
  28. )
  29. {
  30. return v1.extent() == v2.extent();
  31. }
  32. };
  33. template<typename T, typename S>
  34. struct resize_impl< nt2::container::table<T,S>
  35. , nt2::container::table<T,S>
  36. >
  37. {
  38. static void resize ( nt2::container::table<T,S> &v1
  39. , const nt2::container::table<T,S> &v2
  40. )
  41. {
  42. v1.resize( v2.extent() );
  43. }
  44. };
  45. } } }
  46. #endif