print_vector.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "print_vector.h"
  9. #include <iostream>
  10. #include <vector>
  11. template <typename T>
  12. IGL_INLINE void igl::print_vector( std::vector<T>& v)
  13. {
  14. for (int i=0; i<v.size(); ++i)
  15. std::cerr << v[i] << " ";
  16. std::cerr << std::endl;
  17. }
  18. template <typename T>
  19. IGL_INLINE void igl::print_vector( std::vector< std::vector<T> >& v)
  20. {
  21. for (int i=0; i<v.size(); ++i)
  22. {
  23. std::cerr << i << ": ";
  24. for (int j=0; j<v[i].size(); ++j)
  25. std::cerr << v[i][j] << " ";
  26. std::cerr << std::endl;
  27. }
  28. }
  29. template <typename T>
  30. IGL_INLINE void igl::print_vector( std::vector< std::vector< std::vector<T> > >& v)
  31. {
  32. for (int m=0; m<v.size(); ++m)
  33. {
  34. std::cerr << "Matrix " << m << std::endl;
  35. for (int i=0; i<v[m].size(); ++i)
  36. {
  37. std::cerr << i << ": ";
  38. for (int j=0; j<v[m][i].size(); ++j)
  39. std::cerr << v[m][i][j] << " ";
  40. std::cerr << std::endl;
  41. }
  42. std::cerr << "---- end " << m << std::endl;
  43. }
  44. }
  45. #ifdef IGL_STATIC_LIBRARY
  46. // Explicit template instantiation
  47. #endif