From: Bruno Turcksin Date: Wed, 26 Jun 2019 21:21:56 +0000 (-0400) Subject: Rename print_numpy_array functions to print_as_numpy_array and X-Git-Tag: v9.2.0-rc1~1420^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8299%2Fhead;p=dealii.git Rename print_numpy_array functions to print_as_numpy_array and print_as_numpy_array --- diff --git a/doc/news/changes/minor/20180602BrunoTurcksin b/doc/news/changes/minor/20180602BrunoTurcksin index 718facd291..ea8c412056 100644 --- a/doc/news/changes/minor/20180602BrunoTurcksin +++ b/doc/news/changes/minor/20180602BrunoTurcksin @@ -1,4 +1,5 @@ -New: Add function print_numpy_array to SparseMatrix and LinearAlgebra::Vector to -output the object in a format readable with numpy.loadtxt. +New: Add functions SparseMatrix::print_as_numpy_arrays() and +LinearAlgebra::Vector::print_as_numpy_array() to output the +object in a format readable with numpy.loadtxt.
(Bruno Turcksin, 2019/06/02) diff --git a/include/deal.II/lac/la_vector.h b/include/deal.II/lac/la_vector.h index 3002f7d5a7..a4e8da0a5c 100644 --- a/include/deal.II/lac/la_vector.h +++ b/include/deal.II/lac/la_vector.h @@ -361,8 +361,8 @@ namespace LinearAlgebra * */ void - print_numpy_array(std::ostream & out, - const unsigned int precision = 9) const; + print_as_numpy_array(std::ostream & out, + const unsigned int precision = 9) const; /** * Write the vector en bloc to a file. This is done in a binary mode, so diff --git a/include/deal.II/lac/la_vector.templates.h b/include/deal.II/lac/la_vector.templates.h index 71149db40a..c2fd83948a 100644 --- a/include/deal.II/lac/la_vector.templates.h +++ b/include/deal.II/lac/la_vector.templates.h @@ -564,8 +564,8 @@ namespace LinearAlgebra template void - Vector::print_numpy_array(std::ostream & out, - const unsigned int precision) const + Vector::print_as_numpy_array(std::ostream & out, + const unsigned int precision) const { AssertThrow(out, ExcIO()); boost::io::ios_flags_saver restore_flags(out); diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index b7e6a9b34f..e1797cd7bb 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -1584,7 +1584,7 @@ public: print_pattern(std::ostream &out, const double threshold = 0.) const; /** - * Print the vector to the output stream @p out in a format that can be + * Print the matrix to the output stream @p out in a format that can be * read by numpy::readtxt(). To load the matrix in python just do * * [data, row, column] = numpy.loadtxt('my_matrix.txt') @@ -1592,7 +1592,8 @@ public: * */ void - print_numpy_array(std::ostream &out, const unsigned int precision = 9) const; + print_as_numpy_arrays(std::ostream & out, + const unsigned int precision = 9) const; /** * Write the data of this object en bloc to a file. This is done in a binary diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 5af8e7e07f..f14692be46 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1968,8 +1968,8 @@ SparseMatrix::print_pattern(std::ostream &out, template void -SparseMatrix::print_numpy_array(std::ostream & out, - const unsigned int precision) const +SparseMatrix::print_as_numpy_arrays(std::ostream & out, + const unsigned int precision) const { AssertThrow(out, ExcIO()); boost::io::ios_flags_saver restore_flags(out); diff --git a/tests/lac/la_vector_print.cc b/tests/lac/la_vector_print.cc index c7f2317730..0062327f3a 100644 --- a/tests/lac/la_vector_print.cc +++ b/tests/lac/la_vector_print.cc @@ -14,7 +14,7 @@ // --------------------------------------------------------------------- -// Check that print_numpy_array works +// Check that print_as_numpy_array works #include @@ -30,7 +30,7 @@ print_vector() for (unsigned int i = 0; i < size; ++i) vec(i) = static_cast(i); - vec.print_numpy_array(deallog.get_file_stream()); + vec.print_as_numpy_array(deallog.get_file_stream()); } diff --git a/tests/lac/sparse_matrix_print.cc b/tests/lac/sparse_matrix_print.cc index 143a8fcefc..8ed3ed71ee 100644 --- a/tests/lac/sparse_matrix_print.cc +++ b/tests/lac/sparse_matrix_print.cc @@ -14,7 +14,7 @@ // --------------------------------------------------------------------- -// Check that print_numpy_array works +// Check that print_as_numpy_arrays works #include #include @@ -39,7 +39,7 @@ print_sparse_matrix() for (unsigned int i = 0; i < n; ++i) for (unsigned int j = 0; j < n; ++j) A.set(i, j, static_cast(i + j)); - A.print_numpy_array(deallog.get_file_stream()); + A.print_as_numpy_arrays(deallog.get_file_stream()); }