From d9cff1cf939705b5cbf843c33af7c881221df645 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 14 Feb 2022 16:05:09 -0700 Subject: [PATCH] Avoid implicit-bool conversion for stream objects. --- .../lac/affine_constraints.templates.h | 2 +- .../lac/chunk_sparse_matrix.templates.h | 18 ++-- include/deal.II/lac/cuda_sparse_matrix.h | 2 +- include/deal.II/lac/full_matrix.templates.h | 2 +- .../lac/la_parallel_vector.templates.h | 4 +- include/deal.II/lac/la_vector.templates.h | 10 +-- .../deal.II/lac/read_write_vector.templates.h | 4 +- include/deal.II/lac/sparse_matrix.templates.h | 14 +-- .../deal.II/lac/sparse_matrix_ez.templates.h | 10 +-- .../lac/trilinos_tpetra_vector.templates.h | 4 +- include/deal.II/lac/vector.h | 4 +- include/deal.II/lac/vector.templates.h | 10 +-- source/base/data_out_base.cc | 66 +++++++------- source/base/index_set.cc | 8 +- source/base/parameter_acceptor.cc | 2 +- source/base/parameter_handler.cc | 14 +-- source/base/table_handler.cc | 4 +- source/base/utilities.cc | 2 +- source/distributed/fully_distributed_tria.cc | 2 +- source/distributed/tria.cc | 2 +- source/dofs/dof_tools.cc | 2 +- source/gmsh/utilities.cc | 2 +- source/grid/grid_in.cc | 86 +++++++++---------- source/grid/grid_out.cc | 42 ++++----- source/grid/persistent_tria.cc | 8 +- source/grid/reference_cell.cc | 4 +- source/grid/tria.cc | 8 +- source/lac/chunk_sparsity_pattern.cc | 14 +-- source/lac/cuda_vector.cu | 4 +- source/lac/dynamic_sparsity_pattern.cc | 4 +- source/lac/lapack_full_matrix.cc | 2 +- source/lac/petsc_matrix_base.cc | 2 +- source/lac/petsc_parallel_vector.cc | 4 +- source/lac/petsc_vector_base.cc | 4 +- source/lac/sparsity_pattern.cc | 14 +-- source/lac/trilinos_epetra_vector.cc | 4 +- source/lac/trilinos_sparse_matrix.cc | 2 +- source/lac/trilinos_sparsity_pattern.cc | 4 +- source/lac/trilinos_vector.cc | 4 +- source/numerics/histogram.cc | 4 +- 40 files changed, 201 insertions(+), 201 deletions(-) diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 6e06aea6ce..76c6d8e68a 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -1260,7 +1260,7 @@ AffineConstraints::print(std::ostream &out) const } } - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } diff --git a/include/deal.II/lac/chunk_sparse_matrix.templates.h b/include/deal.II/lac/chunk_sparse_matrix.templates.h index 82c175867d..1d12f1637c 100644 --- a/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -1455,14 +1455,14 @@ template void ChunkSparseMatrix::print(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); Assert(false, ExcNotImplemented()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -1475,7 +1475,7 @@ ChunkSparseMatrix::print_formatted(std::ostream & out, const char * zero_string, const double denominator) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1510,7 +1510,7 @@ ChunkSparseMatrix::print_formatted(std::ostream & out, out << std::setw(width) << zero_string << ' '; out << std::endl; }; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.precision(old_precision); @@ -1524,7 +1524,7 @@ void ChunkSparseMatrix::print_pattern(std::ostream &out, const double threshold) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1555,7 +1555,7 @@ ChunkSparseMatrix::print_pattern(std::ostream &out, out << std::endl; } - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -1564,7 +1564,7 @@ template void ChunkSparseMatrix::block_write(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // first the simple objects, bracketed in [...] out << '[' << max_len << "]["; @@ -1574,7 +1574,7 @@ ChunkSparseMatrix::block_write(std::ostream &out) const reinterpret_cast(val.get())); out << ']'; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -1583,7 +1583,7 @@ template void ChunkSparseMatrix::block_read(std::istream &in) { - AssertThrow(in, ExcIO()); + AssertThrow(in.fail() == false, ExcIO()); char c; diff --git a/include/deal.II/lac/cuda_sparse_matrix.h b/include/deal.II/lac/cuda_sparse_matrix.h index f1598c54ff..3596784661 100644 --- a/include/deal.II/lac/cuda_sparse_matrix.h +++ b/include/deal.II/lac/cuda_sparse_matrix.h @@ -513,7 +513,7 @@ namespace CUDAWrappers } out << std::endl; }; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.precision(old_precision); diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index eb6c714b4d..2ede658c11 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -1793,7 +1793,7 @@ FullMatrix::print_formatted(std::ostream & out, out << std::endl; }; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.flags(old_flags); out.precision(old_precision); diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index b9c8b290af..aae9f31c17 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -2112,7 +2112,7 @@ namespace LinearAlgebra const bool across) const { Assert(partitioner.get() != nullptr, ExcInternalError()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); std::ios::fmtflags old_flags = out.flags(); unsigned int old_precision = out.precision(precision); @@ -2185,7 +2185,7 @@ namespace LinearAlgebra } #endif - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.flags(old_flags); out.precision(old_precision); diff --git a/include/deal.II/lac/la_vector.templates.h b/include/deal.II/lac/la_vector.templates.h index 5d68773869..522ee0ca68 100644 --- a/include/deal.II/lac/la_vector.templates.h +++ b/include/deal.II/lac/la_vector.templates.h @@ -551,7 +551,7 @@ namespace LinearAlgebra Vector::print_as_numpy_array(std::ostream & out, const unsigned int precision) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); boost::io::ios_flags_saver restore_flags(out); out.precision(precision); @@ -561,7 +561,7 @@ namespace LinearAlgebra out << this->values[i] << ' '; out << '\n' << std::flush; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -570,7 +570,7 @@ namespace LinearAlgebra void Vector::block_write(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // Other version of the following // out << size() << std::endl << '['; @@ -593,7 +593,7 @@ namespace LinearAlgebra const char outro = ']'; out.write(&outro, 1); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -602,7 +602,7 @@ namespace LinearAlgebra void Vector::block_read(std::istream &in) { - AssertThrow(in, ExcIO()); + AssertThrow(in.fail() == false, ExcIO()); size_type sz; diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index ddd422fa9d..3b8fd2c185 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -1013,7 +1013,7 @@ namespace LinearAlgebra const unsigned int precision, const bool scientific) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); boost::io::ios_flags_saver restore_flags(out); out.precision(precision); @@ -1030,7 +1030,7 @@ namespace LinearAlgebra out << '[' << idx << "]: " << values[i++] << '\n'; out << std::flush; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 74fba0265f..4b0aadbfb1 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1937,7 +1937,7 @@ SparseMatrix::print_formatted(std::ostream & out, out << std::setw(width) << zero_string << ' '; out << std::endl; }; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.precision(old_precision); @@ -1965,7 +1965,7 @@ SparseMatrix::print_pattern(std::ostream &out, out << ':'; out << std::endl; }; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -1975,7 +1975,7 @@ void SparseMatrix::print_as_numpy_arrays(std::ostream & out, const unsigned int precision) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); boost::io::ios_flags_saver restore_flags(out); out.precision(precision); @@ -2013,7 +2013,7 @@ SparseMatrix::print_as_numpy_arrays(std::ostream & out, out << '\n'; out << std::flush; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -2022,7 +2022,7 @@ template void SparseMatrix::block_write(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // first the simple objects, // bracketed in [...] @@ -2033,7 +2033,7 @@ SparseMatrix::block_write(std::ostream &out) const reinterpret_cast(val.get())); out << ']'; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -2042,7 +2042,7 @@ template void SparseMatrix::block_read(std::istream &in) { - AssertThrow(in, ExcIO()); + AssertThrow(in.fail() == false, ExcIO()); char c; diff --git a/include/deal.II/lac/sparse_matrix_ez.templates.h b/include/deal.II/lac/sparse_matrix_ez.templates.h index 61d50b2a1b..4f45b8bb31 100644 --- a/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -466,7 +466,7 @@ template void SparseMatrixEZ::print(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); const_iterator i = begin(); const const_iterator e = end(); @@ -487,7 +487,7 @@ SparseMatrixEZ::print_formatted(std::ostream & out, const char * zero_string, const double denominator) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); Assert(m() != 0, ExcNotInitialized()); Assert(n() != 0, ExcNotInitialized()); @@ -533,7 +533,7 @@ template void SparseMatrixEZ::block_write(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // first the simple objects, // bracketed in [...] @@ -551,7 +551,7 @@ SparseMatrixEZ::block_write(std::ostream &out) const out << ']'; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -565,7 +565,7 @@ template void SparseMatrixEZ::block_read(std::istream &in) { - AssertThrow(in, ExcIO()); + AssertThrow(in.fail() == false, ExcIO()); char c; int n; diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index c355e610dd..66091e25e1 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -624,7 +624,7 @@ namespace LinearAlgebra const bool scientific, const bool across) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); boost::io::ios_flags_saver restore_flags(out); // Get a representation of the vector and loop over all @@ -652,7 +652,7 @@ namespace LinearAlgebra // restore the representation // of the vector - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index d273fbb447..3fef3511d9 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -1401,13 +1401,13 @@ inline std::ostream & operator<<(std::ostream &out, const Vector &v) { Assert(v.size() != 0, ExcEmptyObject()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); for (typename Vector::size_type i = 0; i < v.size() - 1; ++i) out << v(i) << ' '; out << v(v.size() - 1); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); return out; } diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index e0672ea510..b611452c37 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -834,7 +834,7 @@ Vector::print(std::ostream & out, const bool across) const { Assert(size() != 0, ExcEmptyObject()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); std::ios::fmtflags old_flags = out.flags(); unsigned int old_precision = out.precision(precision); @@ -853,7 +853,7 @@ Vector::print(std::ostream & out, out << values[i] << std::endl; out << std::endl; - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // reset output format out.flags(old_flags); out.precision(old_precision); @@ -865,7 +865,7 @@ template void Vector::block_write(std::ostream &out) const { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // other version of the following // out << size() << std::endl << '['; @@ -889,7 +889,7 @@ Vector::block_write(std::ostream &out) const const char outro = ']'; out.write(&outro, 1); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -898,7 +898,7 @@ template void Vector::block_read(std::istream &in) { - AssertThrow(in, ExcIO()); + AssertThrow(in.fail() == false, ExcIO()); size_type sz; diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index d78c072718..806948d404 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -3322,7 +3322,7 @@ namespace DataOutBase // tested, therefore currently not allowed. AssertThrow(dim > 0, ExcNotImplemented()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -3392,7 +3392,7 @@ namespace DataOutBase out.flush(); // assert the stream is still ok - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -3412,7 +3412,7 @@ namespace DataOutBase // Point output is currently not implemented. AssertThrow(dim > 0, ExcNotImplemented()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -3674,7 +3674,7 @@ namespace DataOutBase out.flush(); // assert the stream is still ok - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -3692,7 +3692,7 @@ namespace DataOutBase const GnuplotFlags &flags, std::ostream & out) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most @@ -4067,7 +4067,7 @@ namespace DataOutBase // make sure everything now gets to disk out.flush(); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -4093,7 +4093,7 @@ namespace DataOutBase const PovrayFlags & flags, std::ostream & out) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most @@ -4410,7 +4410,7 @@ namespace DataOutBase // make sure everything now gets to disk out.flush(); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } } // namespace @@ -4465,7 +4465,7 @@ namespace DataOutBase const EpsFlags &flags, std::ostream & out) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -4765,7 +4765,7 @@ namespace DataOutBase out.flush(); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -4790,7 +4790,7 @@ namespace DataOutBase AssertThrow(dim > 0, ExcNotImplemented()); Assert(dim <= 3, ExcNotImplemented()); - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -4902,7 +4902,7 @@ namespace DataOutBase out.flush(); // assert the stream is still ok - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -4920,7 +4920,7 @@ namespace DataOutBase const TecplotFlags &flags, std::ostream & out) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); // The FEBLOCK or FEPOINT formats of tecplot only allows full elements (e.g. // triangles), not single points. Other tecplot format allow point output, @@ -5061,7 +5061,7 @@ namespace DataOutBase out.flush(); // assert the stream is still ok - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } @@ -5189,7 +5189,7 @@ namespace DataOutBase } - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); # ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -5477,7 +5477,7 @@ namespace DataOutBase const VtkFlags &flags, std::ostream & out) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); #ifndef DEAL_II_WITH_MPI // verify that there are indeed patches to be written out. most of the @@ -5712,14 +5712,14 @@ namespace DataOutBase out.flush(); // assert the stream is still ok - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); } void write_vtu_header(std::ostream &out, const VtkFlags &flags) { - AssertThrow(out, ExcIO()); + AssertThrow(out.fail() == false, ExcIO()); out << " \n"; out << "