print_vector.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  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. using namespace std;
  15. for (int i=0; i<v.size(); ++i)
  16. std::cerr << v[i] << " ";
  17. std::cerr << std::endl;
  18. }
  19. template <typename T>
  20. IGL_INLINE void igl::print_vector( std::vector< std::vector<T> >& v)
  21. {
  22. using namespace std;
  23. for (int i=0; i<v.size(); ++i)
  24. {
  25. std::cerr << i << ": ";
  26. for (int j=0; j<v[i].size(); ++j)
  27. std::cerr << v[i][j] << " ";
  28. std::cerr << std::endl;
  29. }
  30. }
  31. template <typename T>
  32. IGL_INLINE void igl::print_vector( std::vector< std::vector< std::vector<T> > >& v)
  33. {
  34. using namespace std;
  35. for (int m=0; m<v.size(); ++m)
  36. {
  37. std::cerr << "Matrix " << m << std::endl;
  38. for (int i=0; i<v[m].size(); ++i)
  39. {
  40. std::cerr << i << ": ";
  41. for (int j=0; j<v[m][i].size(); ++j)
  42. std::cerr << v[m][i][j] << " ";
  43. std::cerr << std::endl;
  44. }
  45. std::cerr << "---- end " << m << std::endl;
  46. }
  47. }
  48. #ifdef IGL_STATIC_LIBRARY
  49. // Explicit template specialization
  50. #endif