From 6aa25e4a6743d57259141cbcaada2159ab2e370c Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 7 Apr 2017 01:08:28 +0200 Subject: [PATCH] Use nullptr for null pointers --- examples/step-13/step-13.cc | 2 +- examples/step-17/step-17.cc | 2 +- examples/step-18/step-18.cc | 2 +- examples/step-32/step-32.cc | 2 +- examples/step-34/step-34.cc | 2 +- include/deal.II/algorithms/any_data.h | 28 +-- .../deal.II/algorithms/operator.templates.h | 8 +- .../algorithms/theta_timestepping.templates.h | 4 +- include/deal.II/base/aligned_vector.h | 28 +-- include/deal.II/base/array_view.h | 2 +- include/deal.II/base/data_out_base.h | 4 +- include/deal.II/base/function.templates.h | 2 +- include/deal.II/base/index_set.h | 4 +- include/deal.II/base/logstream.h | 2 +- include/deal.II/base/memory_consumption.h | 2 +- include/deal.II/base/parameter_handler.h | 4 +- include/deal.II/base/smartpointer.h | 22 +-- include/deal.II/base/subscriptor.h | 4 +- include/deal.II/base/thread_management.h | 16 +- .../deal.II/base/time_stepping.templates.h | 10 +- include/deal.II/base/work_stream.h | 24 +-- include/deal.II/dofs/dof_accessor.templates.h | 50 +++--- include/deal.II/dofs/dof_handler.h | 8 +- include/deal.II/fe/fe_enriched.h | 2 +- include/deal.II/fe/fe_poly.templates.h | 6 +- include/deal.II/fe/fe_poly_face.templates.h | 4 +- include/deal.II/fe/fe_tools.h | 24 +-- include/deal.II/grid/filtered_iterator.h | 2 +- include/deal.II/grid/grid_out.h | 10 +- include/deal.II/grid/grid_tools.h | 2 +- include/deal.II/grid/tria.h | 2 +- include/deal.II/grid/tria_accessor.h | 22 +-- .../deal.II/grid/tria_accessor.templates.h | 32 ++-- include/deal.II/grid/tria_iterator.h | 4 +- .../deal.II/grid/tria_iterator.templates.h | 4 +- include/deal.II/grid/tria_objects.h | 4 +- include/deal.II/hp/dof_handler.h | 2 +- include/deal.II/lac/block_matrix_base.h | 2 +- .../lac/block_sparse_matrix.templates.h | 4 +- include/deal.II/lac/block_vector.h | 2 +- include/deal.II/lac/block_vector_base.h | 2 +- include/deal.II/lac/chunk_sparse_matrix.h | 24 +-- .../lac/chunk_sparse_matrix.templates.h | 148 ++++++++-------- include/deal.II/lac/constraint_matrix.h | 4 +- .../deal.II/lac/constraint_matrix.templates.h | 8 +- include/deal.II/lac/iterative_inverse.h | 4 +- .../lac/la_parallel_block_vector.templates.h | 22 +-- .../lac/la_parallel_vector.templates.h | 92 +++++----- include/deal.II/lac/la_vector.templates.h | 22 +-- include/deal.II/lac/packaged_operation.h | 2 +- include/deal.II/lac/petsc_compatibility.h | 6 +- include/deal.II/lac/pointer_matrix.h | 56 +++--- include/deal.II/lac/precondition.h | 46 ++--- include/deal.II/lac/precondition_block.h | 2 +- .../lac/precondition_block.templates.h | 18 +- include/deal.II/lac/precondition_selector.h | 10 +- include/deal.II/lac/read_write_vector.h | 8 +- .../deal.II/lac/read_write_vector.templates.h | 16 +- include/deal.II/lac/relaxation_block.h | 2 +- .../deal.II/lac/relaxation_block.templates.h | 8 +- include/deal.II/lac/solver_bicgstab.h | 18 +- include/deal.II/lac/solver_cg.h | 12 +- include/deal.II/lac/solver_gmres.h | 14 +- include/deal.II/lac/solver_minres.h | 14 +- include/deal.II/lac/solver_richardson.h | 8 +- include/deal.II/lac/sparse_decomposition.h | 2 +- .../lac/sparse_decomposition.templates.h | 6 +- include/deal.II/lac/sparse_matrix.h | 24 +-- include/deal.II/lac/sparse_matrix.templates.h | 164 +++++++++--------- include/deal.II/lac/sparse_matrix_ez.h | 6 +- include/deal.II/lac/sparse_vanka.h | 2 +- include/deal.II/lac/sparse_vanka.templates.h | 22 +-- include/deal.II/lac/sparsity_pattern.h | 6 +- include/deal.II/lac/trilinos_precondition.h | 4 +- include/deal.II/lac/trilinos_sparse_matrix.h | 12 +- .../deal.II/lac/trilinos_sparsity_pattern.h | 2 +- include/deal.II/lac/trilinos_vector.h | 2 +- include/deal.II/lac/trilinos_vector_base.h | 10 +- include/deal.II/lac/vector.h | 10 +- include/deal.II/lac/vector.templates.h | 20 +-- include/deal.II/lac/vector_memory.h | 2 +- include/deal.II/lac/vector_memory.templates.h | 8 +- .../deal.II/lac/vector_operations_internal.h | 8 +- include/deal.II/lac/vector_view.h | 2 +- include/deal.II/matrix_free/dof_info.h | 10 +- .../deal.II/matrix_free/dof_info.templates.h | 4 +- include/deal.II/matrix_free/fe_evaluation.h | 124 ++++++------- .../matrix_free/mapping_info.templates.h | 2 +- include/deal.II/matrix_free/matrix_free.h | 22 +-- .../matrix_free/matrix_free.templates.h | 18 +- include/deal.II/matrix_free/operators.h | 30 ++-- .../matrix_free/shape_info.templates.h | 8 +- include/deal.II/meshworker/assembler.h | 2 +- include/deal.II/meshworker/dof_info.h | 2 +- include/deal.II/meshworker/integration_info.h | 20 +-- include/deal.II/meshworker/loop.h | 6 +- include/deal.II/meshworker/output.h | 6 +- include/deal.II/meshworker/simple.h | 22 +-- include/deal.II/multigrid/mg_block_smoother.h | 4 +- include/deal.II/multigrid/mg_coarse.h | 26 +-- include/deal.II/multigrid/mg_smoother.h | 4 +- .../deal.II/multigrid/mg_transfer.templates.h | 4 +- .../mg_transfer_component.templates.h | 4 +- include/deal.II/multigrid/multigrid.h | 14 +- .../deal.II/multigrid/multigrid.templates.h | 16 +- include/deal.II/numerics/data_postprocessor.h | 2 +- .../numerics/dof_output_operator.templates.h | 4 +- include/deal.II/numerics/error_estimator.h | 12 +- .../numerics/error_estimator.templates.h | 10 +- .../numerics/matrix_creator.templates.h | 58 +++---- include/deal.II/numerics/matrix_tools.h | 26 +-- include/deal.II/numerics/solution_transfer.h | 6 +- include/deal.II/numerics/vector_tools.h | 8 +- .../deal.II/numerics/vector_tools.templates.h | 130 +++++++------- source/base/exceptions.cc | 14 +- source/base/function_parser.cc | 2 +- source/base/index_set.cc | 2 +- source/base/job_identifier.cc | 2 +- source/base/logstream.cc | 12 +- source/base/mpi.cc | 4 +- source/base/multithread_info.cc | 2 +- source/base/parameter_handler.cc | 58 +++---- source/base/path_search.cc | 4 +- source/base/polynomial.cc | 16 +- source/base/subscriptor.cc | 8 +- source/base/thread_management.cc | 2 +- source/base/timer.cc | 6 +- source/base/utilities.cc | 12 +- source/distributed/p4est_wrappers.cc | 4 +- source/distributed/shared_tria.cc | 2 +- source/distributed/solution_transfer.cc | 6 +- source/distributed/tria.cc | 68 ++++---- source/dofs/dof_accessor.cc | 4 +- source/dofs/dof_accessor_get.cc | 6 +- source/dofs/dof_accessor_set.cc | 6 +- source/dofs/dof_handler.cc | 50 +++--- source/dofs/dof_handler_policy.cc | 12 +- source/dofs/dof_tools.cc | 14 +- source/dofs/dof_tools_constraints.cc | 2 +- source/dofs/dof_tools_sparsity.cc | 4 +- source/fe/fe_bernstein.cc | 6 +- source/fe/fe_dgp.cc | 12 +- source/fe/fe_dgp_monomial.cc | 12 +- source/fe/fe_dgp_nonparametric.cc | 12 +- source/fe/fe_dgq.cc | 6 +- source/fe/fe_enriched.cc | 14 +- source/fe/fe_face.cc | 4 +- source/fe/fe_nedelec.cc | 8 +- source/fe/fe_nothing.cc | 2 +- source/fe/fe_poly.cc | 8 +- source/fe/fe_poly_tensor.cc | 6 +- source/fe/fe_q_base.cc | 14 +- source/fe/fe_q_bubbles.cc | 4 +- source/fe/fe_q_dg0.cc | 2 +- source/fe/fe_q_hierarchical.cc | 16 +- source/fe/fe_raviart_thomas_nodal.cc | 6 +- source/fe/fe_system.cc | 18 +- source/fe/fe_tools.cc | 8 +- source/fe/fe_tools_extrapolate.cc | 20 +-- source/fe/fe_tools_interpolate.cc | 4 +- source/fe/fe_trace.cc | 2 +- source/fe/fe_values.cc | 68 ++++---- source/fe/mapping_cartesian.cc | 16 +- source/fe/mapping_fe_field.cc | 14 +- source/fe/mapping_manifold.cc | 16 +- source/fe/mapping_q.cc | 16 +- source/fe/mapping_q_generic.cc | 22 +-- source/grid/grid_generator.cc | 8 +- source/grid/grid_in.cc | 18 +- source/grid/grid_out.cc | 28 +-- source/grid/grid_tools.cc | 10 +- source/grid/intergrid_map.cc | 8 +- source/grid/manifold_lib.cc | 4 +- source/grid/tria.cc | 80 ++++----- source/grid/tria_boundary.cc | 4 +- source/hp/dof_handler.cc | 34 ++-- source/hp/fe_values.cc | 2 +- source/lac/block_matrix_array.cc | 2 +- source/lac/block_sparsity_pattern.cc | 2 +- source/lac/chunk_sparsity_pattern.cc | 6 +- source/lac/constraint_matrix.cc | 4 +- source/lac/exceptions.cc | 4 +- source/lac/lapack_full_matrix.cc | 6 +- source/lac/petsc_matrix_base.cc | 4 +- source/lac/petsc_matrix_free.cc | 4 +- source/lac/petsc_parallel_sparse_matrix.cc | 14 +- source/lac/petsc_parallel_vector.cc | 2 +- source/lac/petsc_precondition.cc | 14 +- source/lac/petsc_solver.cc | 4 +- source/lac/petsc_sparse_matrix.cc | 4 +- source/lac/petsc_vector_base.cc | 8 +- source/lac/slepc_solver.cc | 2 +- source/lac/slepc_spectral_transformation.cc | 2 +- source/lac/sparse_direct.cc | 18 +- source/lac/sparsity_pattern.cc | 66 +++---- source/lac/sparsity_tools.cc | 8 +- source/lac/tridiagonal_matrix.cc | 2 +- source/lac/trilinos_block_sparse_matrix.cc | 2 +- source/lac/trilinos_epetra_vector.cc | 22 +-- source/lac/trilinos_precondition.cc | 48 ++--- source/lac/trilinos_precondition_ml.cc | 6 +- source/lac/trilinos_precondition_muelu.cc | 4 +- source/lac/trilinos_sparse_matrix.cc | 54 +++--- source/lac/trilinos_sparsity_pattern.cc | 6 +- source/lac/trilinos_vector.cc | 16 +- source/lac/trilinos_vector_base.cc | 10 +- source/multigrid/mg_level_global_transfer.cc | 8 +- source/multigrid/mg_transfer_block.cc | 4 +- source/multigrid/mg_transfer_internal.cc | 14 +- source/multigrid/mg_transfer_prebuilt.cc | 2 +- source/multigrid/multigrid.cc | 6 +- source/numerics/data_out.cc | 4 +- source/numerics/data_out_dof_data.cc | 42 ++--- source/numerics/data_out_faces.cc | 4 +- source/numerics/data_out_rotation.cc | 4 +- source/numerics/data_out_stack.cc | 6 +- source/numerics/error_estimator_1d.cc | 12 +- source/numerics/point_value_history.cc | 2 +- source/numerics/solution_transfer.cc | 8 +- source/numerics/time_dependent.cc | 48 ++--- tests/algorithms/any_data_01.cc | 4 +- tests/algorithms/newton_02.cc | 2 +- tests/aniso/up_and_down.cc | 8 +- tests/base/array_view_06.cc | 2 +- tests/base/memory_consumption_02.cc | 18 ++ tests/base/patterns_01.cc | 2 +- tests/bits/error_estimator_01.cc | 4 +- tests/bits/error_estimator_02.cc | 4 +- tests/bits/step-13.cc | 2 +- tests/bits/step-14.cc | 4 +- tests/codim_one/bem_integration.cc | 2 +- tests/codim_one/error_estimator_01.cc | 4 +- tests/codim_one/error_estimator_02.cc | 2 +- tests/dofs/dof_renumbering_02.cc | 8 +- tests/dofs/dof_renumbering_03.cc | 4 +- tests/dofs/dof_renumbering_04.cc | 4 +- tests/dofs/dof_renumbering_05.cc | 4 +- tests/dofs/dof_renumbering_06.cc | 4 +- tests/dofs/dof_renumbering_07.cc | 4 +- tests/dofs/dof_renumbering_08.cc | 4 +- tests/dofs/dof_renumbering_zorder_01.cc | 4 +- tests/dofs/dof_renumbering_zorder_02.cc | 4 +- tests/dofs/dof_test.cc | 6 +- tests/dofs/dof_tools_14.cc | 2 +- tests/dofs/dof_tools_16a.cc | 2 +- tests/dofs/dof_tools_16b.cc | 2 +- tests/dofs/dof_tools_16c.cc | 2 +- tests/dofs/dof_tools_16d.cc | 2 +- tests/fail/hp-step-14.cc | 4 +- tests/fail/rt_6.cc | 2 +- tests/fe/abf_01.cc | 8 +- tests/fe/abf_02.cc | 8 +- tests/fe/deformed_projection.h | 8 +- tests/fe/up_and_down.cc | 22 +-- tests/grid/grid_transform_02.cc | 2 +- tests/grid/grid_transform_3d.cc | 2 +- tests/grid/intergrid_constraints.cc | 4 +- .../create_laplace_matrix_constraints_02.cc | 2 +- .../create_laplace_matrix_constraints_02b.cc | 2 +- tests/hp/create_mass_matrix_constraints_02.cc | 2 +- .../hp/create_mass_matrix_constraints_02b.cc | 2 +- tests/hp/step-13.cc | 2 +- tests/integrators/cochain_01.cc | 2 +- tests/integrators/mesh_worker_03.cc | 2 +- tests/lac/constraints.cc | 2 +- tests/mappings/mapping.cc | 4 +- tests/metis/metis_01a.cc | 4 +- tests/mpi/tria_ghost_owners_01.cc | 4 +- tests/mpi/tria_ghost_owners_02.cc | 4 +- tests/multigrid/mg_renumbered_02.cc | 4 +- tests/multigrid/mg_renumbered_03.cc | 4 +- tests/numerics/boundaries.cc | 2 +- .../create_laplace_matrix_constraints_01.cc | 2 +- .../create_laplace_matrix_constraints_02.cc | 2 +- .../create_laplace_matrix_constraints_02b.cc | 2 +- .../create_mass_matrix_constraints_01.cc | 2 +- .../create_mass_matrix_constraints_02.cc | 2 +- .../create_mass_matrix_constraints_02b.cc | 2 +- tests/numerics/error_estimator.cc | 2 +- tests/numerics/error_estimator_02.cc | 8 +- tests/numerics/project_boundary_01.cc | 2 +- tests/physics/step-18-rotation_matrix.cc | 2 +- tests/physics/step-18.cc | 2 +- tests/quick_tests/affinity.cc | 2 +- tests/serialization/pointer_01.cc | 2 +- tests/serialization/pointer_05.cc | 4 +- tests/slepc/00.cc | 2 +- tests/slepc_complex/00.cc | 2 +- tests/trilinos/mg_transfer_prebuilt_01.cc | 2 +- tests/vector_tools/integrate_difference_02.cc | 2 +- tests/vector_tools/integrate_difference_03.cc | 2 +- tests/vector_tools/integrate_difference_04.cc | 2 +- 292 files changed, 1741 insertions(+), 1727 deletions(-) diff --git a/examples/step-13/step-13.cc b/examples/step-13/step-13.cc index 0ee0a64f93..a80a185976 100644 --- a/examples/step-13/step-13.cc +++ b/examples/step-13/step-13.cc @@ -1466,7 +1466,7 @@ namespace Step13 // Create a solver object of the kind indicated by the argument to this // function. If the name is not recognized, throw an exception! - LaplaceSolver::Base *solver = 0; + LaplaceSolver::Base *solver = nullptr; if (solver_name == "global") solver = new LaplaceSolver::RefinementGlobal (triangulation, fe, quadrature, diff --git a/examples/step-17/step-17.cc b/examples/step-17/step-17.cc index e3966f8f34..e5c5968b68 100644 --- a/examples/step-17/step-17.cc +++ b/examples/step-17/step-17.cc @@ -782,7 +782,7 @@ namespace Step17 localized_solution, local_error_per_cell, ComponentMask(), - 0, + nullptr, MultithreadInfo::n_threads(), this_mpi_process); diff --git a/examples/step-18/step-18.cc b/examples/step-18/step-18.cc index 8097a8a6d6..f0e9af6ffe 100644 --- a/examples/step-18/step-18.cc +++ b/examples/step-18/step-18.cc @@ -1510,7 +1510,7 @@ namespace Step18 incremental_displacement, error_per_cell, ComponentMask(), - 0, + nullptr, MultithreadInfo::n_threads(), this_mpi_process); diff --git a/examples/step-32/step-32.cc b/examples/step-32/step-32.cc index 1479a59274..4fbf5042d7 100644 --- a/examples/step-32/step-32.cc +++ b/examples/step-32/step-32.cc @@ -3479,7 +3479,7 @@ namespace Step32 temperature_solution, estimated_error_per_cell, ComponentMask(), - 0, + nullptr, 0, triangulation.locally_owned_subdomain()); diff --git a/examples/step-34/step-34.cc b/examples/step-34/step-34.cc index fc1981cd56..af57be39f4 100644 --- a/examples/step-34/step-34.cc +++ b/examples/step-34/step-34.cc @@ -895,7 +895,7 @@ namespace Step34 Assert(index < fe.dofs_per_cell, ExcIndexRange(0, fe.dofs_per_cell, index)); - static Quadrature<1> *q_pointer = NULL; + static Quadrature<1> *q_pointer = nullptr; if (q_pointer) delete q_pointer; q_pointer = new QGaussLogR<1>(singular_quadrature_order, diff --git a/include/deal.II/algorithms/any_data.h b/include/deal.II/algorithms/any_data.h index b1e8c05b1f..23a3027b32 100644 --- a/include/deal.II/algorithms/any_data.h +++ b/include/deal.II/algorithms/any_data.h @@ -215,7 +215,7 @@ AnyData::entry (const unsigned int i) { AssertIndexRange(i, size()); type *p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); return *p; } @@ -228,9 +228,9 @@ AnyData::entry (const unsigned int i) const { AssertIndexRange(i, size()); const type *p = boost::any_cast(&data[i]); - if (p==0 ) + if (p==nullptr ) p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); return *p; } @@ -243,9 +243,9 @@ AnyData::read(const unsigned int i) const { AssertIndexRange(i, size()); const type *p = boost::any_cast(&data[i]); - if (p==0) + if (p==nullptr) p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); return *p; } @@ -258,9 +258,9 @@ AnyData::read_ptr(const unsigned int i) const { AssertIndexRange(i, size()); const type *const *p = boost::any_cast(&data[i]); - if (p==0) + if (p==nullptr) p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type *).name(),data[i].type().name())); return *p; } @@ -273,10 +273,10 @@ AnyData::try_read_ptr(const unsigned int i) const { AssertIndexRange(i, size()); const type *const *p = boost::any_cast(&data[i]); - if (p==0) + if (p==nullptr) p = boost::any_cast(&data[i]); - if (p==0) - return 0; + if (p==nullptr) + return nullptr; return *p; } @@ -357,7 +357,7 @@ AnyData::entry (const std::string &n) const { const unsigned int i = find(n); const type *p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); return *p; } @@ -383,9 +383,9 @@ AnyData::read_ptr(const std::string &n) const { const unsigned int i = find(n); const type *const *p = boost::any_cast(&data[i]); - if (p==0) + if (p==nullptr) p = boost::any_cast(&data[i]); - Assert(p != 0, + Assert(p != nullptr, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); return *p; } @@ -417,7 +417,7 @@ AnyData::try_read(const std::string &n) const std::find(names.begin(), names.end(), n); // Return null pointer if not found if (it == names.end()) - return 0; + return nullptr; // Compute index and return casted pointer unsigned int i=it-names.begin(); diff --git a/include/deal.II/algorithms/operator.templates.h b/include/deal.II/algorithms/operator.templates.h index 21a40493e8..7b82ebe63f 100644 --- a/include/deal.II/algorithms/operator.templates.h +++ b/include/deal.II/algorithms/operator.templates.h @@ -32,7 +32,7 @@ namespace Algorithms OutputOperator::OutputOperator() : step (numbers::invalid_unsigned_int), - os(0) + os(nullptr) {} template @@ -45,13 +45,13 @@ namespace Algorithms OutputOperator & OutputOperator::operator<< (const AnyData &vectors) { - if (os == 0) + if (os == nullptr) { deallog << "Step " << step << std::endl; for (unsigned int i=0; i(i); - if (v == 0) continue; + if (v == nullptr) continue; deallog << vectors.name(i); for (unsigned int j=0; jsize(); ++j) deallog << ' ' << (*v)(j); @@ -65,7 +65,7 @@ namespace Algorithms for (unsigned int i=0; i(i); - if (v == 0) continue; + if (v == nullptr) continue; for (unsigned int j=0; jsize(); ++j) (*os) << ' ' << (*v)(j); } diff --git a/include/deal.II/algorithms/theta_timestepping.templates.h b/include/deal.II/algorithms/theta_timestepping.templates.h index 919c8ae4d0..7b691225ab 100644 --- a/include/deal.II/algorithms/theta_timestepping.templates.h +++ b/include/deal.II/algorithms/theta_timestepping.templates.h @@ -114,7 +114,7 @@ namespace Algorithms src2.add(&vtheta, "Theta"); src2.merge(in); - if (output != 0) + if (output != nullptr) (*output) << 0U << out; for (unsigned int count = 1; d_explicit.time < control.final(); ++count) @@ -138,7 +138,7 @@ namespace Algorithms (*op_explicit)(out1, src1); (*op_implicit)(out, src2); - if (output != 0 && control.print()) + if (output != nullptr && control.print()) (*output) << count << out; d_explicit.time = control.now(); diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index f4de6d563b..9f3c431e43 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -470,9 +470,9 @@ template < class T > inline AlignedVector::AlignedVector () : - _data (0), - _end_data (0), - _end_allocated (0) + _data (nullptr), + _end_data (nullptr), + _end_allocated (nullptr) {} @@ -482,9 +482,9 @@ inline AlignedVector::AlignedVector (const size_type size, const T &init) : - _data (0), - _end_data (0), - _end_allocated (0) + _data (nullptr), + _end_data (nullptr), + _end_allocated (nullptr) { if (size > 0) resize (size, init); @@ -505,9 +505,9 @@ template < class T > inline AlignedVector::AlignedVector (const AlignedVector &vec) : - _data (0), - _end_data (0), - _end_allocated (0) + _data (nullptr), + _end_data (nullptr), + _end_allocated (nullptr) { // copy the data from vec reserve (vec._end_data - vec._data); @@ -650,7 +650,7 @@ AlignedVector::reserve (const size_type size_alloc) free(new_data); } else - Assert(new_data == 0, ExcInternalError()); + Assert(new_data == nullptr, ExcInternalError()); } else if (size_alloc == 0) clear(); @@ -663,7 +663,7 @@ inline void AlignedVector::clear () { - if (_data != 0) + if (_data != nullptr) { if (std::is_trivial::value == false) while (_end_data != _data) @@ -671,9 +671,9 @@ AlignedVector::clear () free(_data); } - _data = 0; - _end_data = 0; - _end_allocated = 0; + _data = nullptr; + _end_data = nullptr; + _end_allocated = nullptr; } diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 6850c1b2a3..a9f0788161 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -157,7 +157,7 @@ template inline ArrayView::ArrayView() : - starting_element (NULL), + starting_element ((nullptr)), n_elements(0) {} diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index b86e49ede7..5a9ddd19ac 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -896,8 +896,8 @@ namespace DataOutBase /** * Constructor. */ - TecplotFlags (const char *tecplot_binary_file_name = NULL, - const char *zone_name = NULL, + TecplotFlags (const char *tecplot_binary_file_name = nullptr, + const char *zone_name = nullptr, const double solution_time = -1.0); /** diff --git a/include/deal.II/base/function.templates.h b/include/deal.II/base/function.templates.h index 53f213041c..139bc47378 100644 --- a/include/deal.II/base/function.templates.h +++ b/include/deal.II/base/function.templates.h @@ -451,7 +451,7 @@ ConstantFunction (const Number *begin_ptr, const unsigned int n_components) ZeroFunction (n_components), function_value_vector (n_components) { - Assert (begin_ptr != 0, ExcMessage ("Null pointer encountered!")); + Assert (begin_ptr != nullptr, ExcMessage ("Null pointer encountered!")); std::copy (begin_ptr, begin_ptr+n_components, function_value_vector.begin()); } diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 2e4864fa34..57492087ef 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -917,7 +917,7 @@ IndexSet::size_type IndexSet::IntervalAccessor::n_elements() const inline bool IndexSet::IntervalAccessor::is_valid() const { - return index_set != NULL && range_idx < index_set->n_intervals(); + return index_set !=nullptr&& range_idx < index_set->n_intervals(); } inline @@ -999,7 +999,7 @@ IndexSet::IntervalIterator::IntervalIterator(const IndexSet *idxset, const Index inline IndexSet::IntervalIterator::IntervalIterator() - : accessor(NULL) + : accessor((nullptr)) {} inline diff --git a/include/deal.II/base/logstream.h b/include/deal.II/base/logstream.h index 6e11df3a49..1ac72713f3 100644 --- a/include/deal.II/base/logstream.h +++ b/include/deal.II/base/logstream.h @@ -574,7 +574,7 @@ LogStream::get_stream() // note that in all of this we need not worry about thread-safety // because we operate on a thread-local object and by definition // there can only be one access at a time - if (outstreams.get().get() == 0) + if (outstreams.get().get() == nullptr) { outstreams.get().reset (new std::ostringstream); outstreams.get()->setf(std::ios::showpoint | std::ios::left); diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 3b85d74db8..af99222dd5 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -280,7 +280,7 @@ namespace MemoryConsumption inline std::size_t memory_consumption (const char *string) { - if (string == NULL) + if (string == (nullptr)) { return 0; } diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index bf7dd90e44..489ed9cee3 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -288,8 +288,8 @@ namespace Patterns /** * Creates a new object on the heap using @p new if the given * @p description is a valid format (for example created by calling - * description() on an existing object), or NULL otherwise. Ownership of - * the returned object is transferred to the caller of this function, + * description() on an existing object), or nullptr otherwise. Ownership + * of the returned object is transferred to the caller of this function, * which should be freed using @p delete. */ static Double *create (const std::string &description); diff --git a/include/deal.II/base/smartpointer.h b/include/deal.II/base/smartpointer.h index 3079f9e7aa..4c8e5fadfa 100644 --- a/include/deal.II/base/smartpointer.h +++ b/include/deal.II/base/smartpointer.h @@ -200,7 +200,7 @@ template inline SmartPointer::SmartPointer () : - t (0), id(typeid(P).name()) + t (nullptr), id(typeid(P).name()) {} @@ -211,7 +211,7 @@ SmartPointer::SmartPointer (T *t) : t (t), id(typeid(P).name()) { - if (t != 0) + if (t != nullptr) t->subscribe(id); } @@ -223,7 +223,7 @@ SmartPointer::SmartPointer (T *t, const char *id) : t (t), id(id) { - if (t != 0) + if (t != nullptr) t->subscribe(id); } @@ -248,7 +248,7 @@ SmartPointer::SmartPointer (const SmartPointer &tt) : t (tt.t), id(tt.id) { - if (t != 0) + if (t != nullptr) t->subscribe(id); } @@ -258,7 +258,7 @@ template inline SmartPointer::~SmartPointer () { - if (t != 0) + if (t != nullptr) t->unsubscribe(id); } @@ -288,10 +288,10 @@ SmartPointer &SmartPointer::operator = (T *tt) if (t == tt) return *this; - if (t != 0) + if (t != nullptr) t->unsubscribe(id); t = tt; - if (tt != 0) + if (tt != nullptr) tt->subscribe(id); return *this; } @@ -331,10 +331,10 @@ SmartPointer::operator = (const SmartPointer &tt) if (&tt == this) return *this; - if (t != 0) + if (t != nullptr) t->unsubscribe(id); t = static_cast(tt); - if (tt != 0) + if (tt != nullptr) tt->subscribe(id); return *this; } @@ -354,7 +354,7 @@ template inline T &SmartPointer::operator * () const { - Assert(t != 0, ExcNotInitialized()); + Assert(t != nullptr, ExcNotInitialized()); return *t; } @@ -364,7 +364,7 @@ template inline T *SmartPointer::operator -> () const { - Assert(t != 0, ExcNotInitialized()); + Assert(t != nullptr, ExcNotInitialized()); return t; } diff --git a/include/deal.II/base/subscriptor.h b/include/deal.II/base/subscriptor.h index 4e13aef717..f826949f8c 100644 --- a/include/deal.II/base/subscriptor.h +++ b/include/deal.II/base/subscriptor.h @@ -101,7 +101,7 @@ public: * Subscribes a user of the object. The subscriber may be identified by text * supplied as identifier. */ - void subscribe (const char *identifier = 0) const; + void subscribe (const char *identifier = nullptr) const; /** * Unsubscribes a user from the object. @@ -109,7 +109,7 @@ public: * @note The identifier must be the same pointer as the one * supplied to subscribe(), not just the same text. */ - void unsubscribe (const char *identifier = 0) const; + void unsubscribe (const char *identifier = nullptr) const; /** * Return the present number of subscriptions to this object. This allows to diff --git a/include/deal.II/base/thread_management.h b/include/deal.II/base/thread_management.h index d4833cf784..9387292954 100644 --- a/include/deal.II/base/thread_management.h +++ b/include/deal.II/base/thread_management.h @@ -192,8 +192,8 @@ namespace Threads * raises an exception if the count argument is one. */ DummyBarrier (const unsigned int count, - const char *name = 0, - void *arg = 0); + const char *name = nullptr, + void *arg = nullptr); /** * Wait for all threads to reach this point. Since there may only be one @@ -416,8 +416,8 @@ namespace Threads * Constructor. Initialize the underlying POSIX barrier data structure. */ PosixThreadBarrier (const unsigned int count, - const char *name = 0, - void *arg = 0); + const char *name = nullptr, + void *arg = nullptr); /** * Destructor. Release all resources. @@ -720,7 +720,7 @@ namespace Threads private: RT *value; public: - inline return_value () : value(0) {} + inline return_value () : value(nullptr) {} inline RT &get () const { @@ -2782,7 +2782,7 @@ namespace Threads { internal::handle_unknown_exception (); } - return 0; + return nullptr; } /** @@ -2900,7 +2900,7 @@ namespace Threads TaskDescriptor::TaskDescriptor (const std::function &function) : function (function), - task(NULL), + task((nullptr)), task_is_done (false) {} @@ -2970,7 +2970,7 @@ namespace Threads // of the arena". rather, let's explicitly destroy the empty // task object. before that, make sure that the task has been // shut down, expressed by a zero reference count - AssertNothrow (task != 0, ExcInternalError()); + AssertNothrow (task != nullptr, ExcInternalError()); AssertNothrow (task->ref_count()==0, ExcInternalError()); task->destroy (*task); } diff --git a/include/deal.II/base/time_stepping.templates.h b/include/deal.II/base/time_stepping.templates.h index c105d7c56e..f7342a1a0e 100644 --- a/include/deal.II/base/time_stepping.templates.h +++ b/include/deal.II/base/time_stepping.templates.h @@ -415,7 +415,7 @@ namespace TimeStepping refine_tol(refine_tol), coarsen_tol(coarsen_tol), last_same_as_first(false), - last_stage(NULL) + last_stage((nullptr)) { initialize(method); } @@ -665,10 +665,10 @@ namespace TimeStepping template void EmbeddedExplicitRungeKutta::free_memory() { - if (last_stage!=NULL) + if (last_stage!=(nullptr)) delete last_stage; - last_stage = NULL; + last_stage = (nullptr); } @@ -762,7 +762,7 @@ namespace TimeStepping // Save the last stage if necessary if (last_same_as_first==true) { - if (last_stage==NULL) + if (last_stage==(nullptr)) last_stage = new VectorType(f_stages.back()); else *last_stage = f_stages.back(); @@ -817,7 +817,7 @@ namespace TimeStepping // of the first stage. if (last_same_as_first==true) { - if (last_stage!=NULL) + if (last_stage!=(nullptr)) { f_stages[0] = *last_stage; i = 1; diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index b15ed09266..f57a06d603 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -306,8 +306,8 @@ namespace WorkStream ItemType () : n_items (0), - scratch_data (0), - sample_scratch_data (0), + scratch_data (nullptr), + sample_scratch_data (nullptr), currently_in_use (false) {} }; @@ -367,7 +367,7 @@ namespace WorkStream // another thread where we release items and set 'false' // flags to 'true', but that too does not produce any // problems) - ItemType *current_item = 0; + ItemType *current_item = nullptr; for (unsigned int i=0; in_items == 0) // there were no items // left. terminate the pipeline - return 0; + return nullptr; else return current_item; } @@ -513,7 +513,7 @@ namespace WorkStream // we can't take an iterator into the list now and expect it to // still be valid after calling the worker, but we at least do // not have to lock the following section - ScratchData *scratch_data = 0; + ScratchData *scratch_data = nullptr; { typename ItemType::ScratchDataList & scratch_data_list = current_item->scratch_data->get(); @@ -531,7 +531,7 @@ namespace WorkStream } // if no object was found, create one and mark it as used - if (scratch_data == 0) + if (scratch_data == nullptr) { scratch_data = new ScratchData(*current_item->sample_scratch_data); @@ -672,7 +672,7 @@ namespace WorkStream // return an invalid item since we are at the end of the // pipeline - return 0; + return nullptr; } @@ -790,8 +790,8 @@ namespace WorkStream // This means that we can't take an iterator into the list // now and expect it to still be valid after calling the worker, // but we at least do not have to lock the following section. - ScratchData *scratch_data = 0; - CopyData *copy_data = 0; + ScratchData *scratch_data = nullptr; + CopyData *copy_data = nullptr; { ScratchAndCopyDataList &scratch_and_copy_data_list = data.get(); @@ -809,9 +809,9 @@ namespace WorkStream } // if no element in the list was found, create one and mark it as used - if (scratch_data == 0) + if (scratch_data == nullptr) { - Assert (copy_data==0, ExcInternalError()); + Assert (copy_data==nullptr, ExcInternalError()); scratch_data = new ScratchData(sample_scratch_data); copy_data = new CopyData(sample_copy_data); diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 45043e91f0..a3e5fc0ab4 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -60,7 +60,7 @@ DoFAccessor (const Triangulation(dof_handler)) { - Assert (tria == NULL || &dof_handler->get_triangulation() == tria, + Assert (tria ==nullptr|| &dof_handler->get_triangulation() == tria, ExcMessage ("You can't create a DoF accessor in which the DoFHandler object " "uses a different triangulation than the one you pass as argument.")); } @@ -83,7 +83,7 @@ inline DoFAccessor::DoFAccessor (const DoFAccessor &other) : BaseClass(other), - dof_handler(0) + dof_handler(nullptr) { Assert (false, ExcMessage("You are trying to assign iterators that are incompatible. " "Reasons for incompatibility are that they point to different " @@ -112,7 +112,7 @@ inline void DoFAccessor::set_dof_handler (DoFHandlerType *dh) { - Assert (dh != 0, ExcInvalidObject()); + Assert (dh != nullptr, ExcInvalidObject()); this->dof_handler = dh; } @@ -134,7 +134,7 @@ void DoFAccessor::copy_from (const TriaAccessorBase &da) { - Assert (this->dof_handler != 0, ExcInvalidObject()); + Assert (this->dof_handler != nullptr, ExcInvalidObject()); BaseClass::copy_from(da); } @@ -1088,7 +1088,7 @@ namespace internal (void)fe_index; Assert ((fe_index == dealii::DoFHandler::default_fe_index), ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, + Assert (dof_handler.selected_fe != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, @@ -1114,7 +1114,7 @@ namespace internal Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, @@ -1177,7 +1177,7 @@ namespace internal (void)fe_index; Assert ((fe_index == dealii::DoFHandler::default_fe_index), ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, + Assert (dof_handler.selected_fe != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, @@ -1202,7 +1202,7 @@ namespace internal Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, @@ -1255,7 +1255,7 @@ namespace internal n_active_vertex_fe_indices (const dealii::hp::DoFHandler &dof_handler, const unsigned int vertex_index) { - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); @@ -1303,7 +1303,7 @@ namespace internal const unsigned int vertex_index, const unsigned int n) { - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index), @@ -1606,7 +1606,7 @@ DoFAccessor::mg_vertex_dof_index (co const unsigned int fe_index) const { (void)fe_index; - Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (this->dof_handler != nullptr, ExcInvalidObject ()); Assert (vertex < GeometryInfo::vertices_per_cell, ExcIndexRange (vertex, 0, GeometryInfo::vertices_per_cell)); Assert (i < this->dof_handler->get_fe ()[fe_index].dofs_per_vertex, ExcIndexRange (i, 0, this->dof_handler->get_fe ()[fe_index].dofs_per_vertex)); return this->dof_handler->mg_vertex_dofs[this->vertex_index (vertex)].get_index (level, i); @@ -1641,7 +1641,7 @@ DoFAccessor::set_mg_vertex_dof_index const unsigned int fe_index) const { (void)fe_index; - Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (this->dof_handler != nullptr, ExcInvalidObject ()); Assert (vertex < GeometryInfo::vertices_per_cell, ExcIndexRange (vertex, 0, GeometryInfo::vertices_per_cell)); Assert (i < this->dof_handler->get_fe ()[fe_index].dofs_per_vertex, ExcIndexRange (i, 0, this->dof_handler->get_fe ()[fe_index].dofs_per_vertex)); this->dof_handler->mg_vertex_dofs[this->vertex_index (vertex)].set_index (level, i, index); @@ -1920,7 +1920,7 @@ DoFAccessor::get_dof_indices (std::vector &dof_indices, const unsigned int fe_index) const { - Assert (this->dof_handler != 0, ExcNotInitialized()); + Assert (this->dof_handler != nullptr, ExcNotInitialized()); Assert (static_cast(this->level()) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); @@ -1983,7 +1983,7 @@ void DoFAccessor::get_mg_dof_indices std::vector &dof_indices, const unsigned int fe_index) const { - Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (this->dof_handler != nullptr, ExcInvalidObject ()); switch (structdim) { @@ -2035,7 +2035,7 @@ void DoFAccessor::set_mg_dof_indices const std::vector &dof_indices, const unsigned int fe_index) { - Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (this->dof_handler != nullptr, ExcInvalidObject ()); switch (structdim) { @@ -2245,7 +2245,7 @@ DoFAccessor (const Triangulation<1,spacedim> *, const int , const DoFHandlerType<1,spacedim> *) : - dof_handler(0) + dof_handler(nullptr) { Assert (false, ExcMessage ("This constructor can not be called for face iterators in 1d.")); @@ -2279,7 +2279,7 @@ void DoFAccessor<0,DoFHandlerType<1,spacedim>, level_dof_access>::set_dof_handler (DoFHandlerType<1,spacedim> *dh) { - Assert (dh != 0, ExcInvalidObject()); + Assert (dh != nullptr, ExcInvalidObject()); this->dof_handler = dh; } @@ -2350,7 +2350,7 @@ get_mg_dof_indices (const int, { (void) dof_indices; (void) fe_index; - Assert (this->dof_handler != 0, ExcInvalidObject ()); + Assert (this->dof_handler != nullptr, ExcInvalidObject ()); Assert (dof_indices.size () == this->dof_handler->get_fe ()[fe_index].dofs_per_vertex, ExcVectorDoesNotMatch ()); @@ -2437,7 +2437,7 @@ const FiniteElement::dimension,DoFHandlerType<1,space DoFAccessor<0,DoFHandlerType<1,spacedim>, level_dof_access>:: get_fe (const unsigned int fe_index) const { - Assert (this->dof_handler != 0, ExcInvalidObject()); + Assert (this->dof_handler != nullptr, ExcInvalidObject()); return dof_handler->get_fe()[fe_index]; } @@ -2994,7 +2994,7 @@ namespace internal const unsigned int i) { typedef dealii::DoFAccessor, level_dof_access> BaseClass; - Assert (accessor.dof_handler != 0, + Assert (accessor.dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); Assert (static_cast(accessor.level()) < accessor.dof_handler->levels.size(), @@ -3015,7 +3015,7 @@ namespace internal OutputVector &global_destination) { typedef dealii::DoFAccessor, level_dof_access> BaseClass; - Assert (accessor.dof_handler != 0, + Assert (accessor.dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); Assert (static_cast(local_source_end-local_source_begin) == @@ -3140,7 +3140,7 @@ namespace internal OutputMatrix &global_destination) { typedef dealii::DoFAccessor, level_dof_access> BaseClass; - Assert (accessor.dof_handler != 0, + Assert (accessor.dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); Assert (local_source.m() == accessor.get_fe().dofs_per_cell, typename BaseClass::ExcMatrixDoesNotMatch()); @@ -3606,7 +3606,7 @@ const FiniteElement & DoFCellAccessor::get_fe () const { Assert ((dynamic_cast*> - (this->dof_handler) != 0) + (this->dof_handler) != nullptr) || (this->has_children() == false), ExcMessage ("In hp::DoFHandler objects, finite elements are only associated " @@ -3623,7 +3623,7 @@ unsigned int DoFCellAccessor::active_fe_index () const { Assert ((dynamic_cast*> - (this->dof_handler) != 0) + (this->dof_handler) != nullptr) || (this->has_children() == false), ExcMessage ("You can not ask for the active_fe_index on a cell that has " @@ -3641,7 +3641,7 @@ void DoFCellAccessor::set_active_fe_index (const unsigned int i) { Assert ((dynamic_cast*> - (this->dof_handler) != 0) + (this->dof_handler) != nullptr) || (this->has_children() == false), ExcMessage ("You can not set the active_fe_index on a cell that has " diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index 03fc17b4d2..c9b88b8148 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -1214,7 +1214,7 @@ inline const FiniteElement & DoFHandler::get_fe () const { - Assert(selected_fe!=0, ExcMessage("You are trying to access the DoFHandler's FiniteElement object before it has been initialized.")); + Assert(selected_fe!=nullptr, ExcMessage("You are trying to access the DoFHandler's FiniteElement object before it has been initialized.")); return *selected_fe; } @@ -1225,7 +1225,7 @@ inline const Triangulation & DoFHandler::get_tria () const { - Assert(tria != 0, ExcNotInitialized()); + Assert(tria != nullptr, ExcNotInitialized()); return *tria; } @@ -1236,7 +1236,7 @@ inline const Triangulation & DoFHandler::get_triangulation () const { - Assert(tria != 0, ExcNotInitialized()); + Assert(tria != nullptr, ExcNotInitialized()); return *tria; } @@ -1322,7 +1322,7 @@ void DoFHandler::load (Archive &ar, delete levels[i]; levels.resize (0); delete faces; - faces = 0; + faces = nullptr; ar &levels; ar &faces; diff --git a/include/deal.II/fe/fe_enriched.h b/include/deal.II/fe/fe_enriched.h index 4163ae8c2f..8f2de8c5d8 100644 --- a/include/deal.II/fe/fe_enriched.h +++ b/include/deal.II/fe/fe_enriched.h @@ -136,7 +136,7 @@ DEAL_II_NAMESPACE_OPEN * @code * FE_Enriched fe_non_enriched(FE_Q(1), * FE_Nothing(1,true), - * NULL); + * (nullptr)); * @endcode * and will result in the correct constraints for enriched DoFs attributed to * support points on the interface between the two regions. diff --git a/include/deal.II/fe/fe_poly.templates.h b/include/deal.II/fe/fe_poly.templates.h index 8641d8d192..6095450a81 100644 --- a/include/deal.II/fe/fe_poly.templates.h +++ b/include/deal.II/fe/fe_poly.templates.h @@ -231,7 +231,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &, // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); const UpdateFlags flags(fe_data.update_each); @@ -293,7 +293,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // offset determines which data set @@ -372,7 +372,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // offset determines which data set diff --git a/include/deal.II/fe/fe_poly_face.templates.h b/include/deal.II/fe/fe_poly_face.templates.h index 9b38857776..7247e4e9fe 100644 --- a/include/deal.II/fe/fe_poly_face.templates.h +++ b/include/deal.II/fe/fe_poly_face.templates.h @@ -105,7 +105,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); if (fe_data.update_each & update_values) @@ -176,7 +176,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); const unsigned int foffset = fe_data.shape_values.size() * face_no; diff --git a/include/deal.II/fe/fe_tools.h b/include/deal.II/fe/fe_tools.h index b8aecedbc1..98275c1666 100644 --- a/include/deal.II/fe/fe_tools.h +++ b/include/deal.II/fe/fe_tools.h @@ -994,13 +994,13 @@ namespace FETools FiniteElementData multiply_dof_numbers (const FiniteElement *fe1, const unsigned int N1, - const FiniteElement *fe2=NULL, + const FiniteElement *fe2=nullptr, const unsigned int N2=0, - const FiniteElement *fe3=NULL, + const FiniteElement *fe3=nullptr, const unsigned int N3=0, - const FiniteElement *fe4=NULL, + const FiniteElement *fe4=nullptr, const unsigned int N4=0, - const FiniteElement *fe5=NULL, + const FiniteElement *fe5=nullptr, const unsigned int N5=0); /** @@ -1038,13 +1038,13 @@ namespace FETools std::vector compute_restriction_is_additive_flags (const FiniteElement *fe1, const unsigned int N1, - const FiniteElement *fe2=NULL, + const FiniteElement *fe2=nullptr, const unsigned int N2=0, - const FiniteElement *fe3=NULL, + const FiniteElement *fe3=nullptr, const unsigned int N3=0, - const FiniteElement *fe4=NULL, + const FiniteElement *fe4=nullptr, const unsigned int N4=0, - const FiniteElement *fe5=NULL, + const FiniteElement *fe5=nullptr, const unsigned int N5=0); /** @@ -1091,13 +1091,13 @@ namespace FETools std::vector compute_nonzero_components (const FiniteElement *fe1, const unsigned int N1, - const FiniteElement *fe2=NULL, + const FiniteElement *fe2=nullptr, const unsigned int N2=0, - const FiniteElement *fe3=NULL, + const FiniteElement *fe3=nullptr, const unsigned int N3=0, - const FiniteElement *fe4=NULL, + const FiniteElement *fe4=nullptr, const unsigned int N4=0, - const FiniteElement *fe5=NULL, + const FiniteElement *fe5=nullptr, const unsigned int N5=0, const bool do_tensor_product = true); diff --git a/include/deal.II/grid/filtered_iterator.h b/include/deal.II/grid/filtered_iterator.h index 00d9c343eb..0a9df177d3 100644 --- a/include/deal.II/grid/filtered_iterator.h +++ b/include/deal.II/grid/filtered_iterator.h @@ -945,7 +945,7 @@ FilteredIterator:: ~FilteredIterator () { delete predicate; - predicate = 0; + predicate = nullptr; } diff --git a/include/deal.II/grid/grid_out.h b/include/deal.II/grid/grid_out.h index 2cd4a58d81..8547991e92 100644 --- a/include/deal.II/grid/grid_out.h +++ b/include/deal.II/grid/grid_out.h @@ -919,7 +919,7 @@ public: template void write_gnuplot (const Triangulation &tria, std::ostream &out, - const Mapping *mapping=0) const; + const Mapping *mapping=nullptr) const; /** * Write the triangulation in the msh format. @@ -998,7 +998,7 @@ public: template void write_eps (const Triangulation &tria, std::ostream &out, - const Mapping *mapping=0) const; + const Mapping *mapping=nullptr) const; /** * Write two-dimensional XFig-file. @@ -1021,7 +1021,7 @@ public: template void write_xfig (const Triangulation &tria, std::ostream &out, - const Mapping *mapping=0) const; + const Mapping *mapping=nullptr) const; /** * Write the triangulation in the SVG format. @@ -1128,7 +1128,7 @@ public: void write (const Triangulation &tria, std::ostream &out, const OutputFormat output_format, - const Mapping *mapping=0) const; + const Mapping *mapping=nullptr) const; /** * Write mesh in default format set by ParameterHandler. @@ -1136,7 +1136,7 @@ public: template void write (const Triangulation &tria, std::ostream &out, - const Mapping *mapping=0) const; + const Mapping *mapping=nullptr) const; /** * Set flags for DX output diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 8464c04d2a..51d9284ccf 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -351,7 +351,7 @@ namespace GridTools template void laplace_transform (const std::map > &new_points, Triangulation &tria, - const Function *coefficient = 0, + const Function *coefficient = nullptr, const bool solve_for_absolute_positions = false); /** diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 0297637e4a..56b9f2aba6 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -930,7 +930,7 @@ namespace internal * classes. Again, see * @ref GlossUserData "the glossary for more information". * - * The value of these user indices or pointers is @p NULL by default. Note + * The value of these user indices or pointers is @pnullptrby default. Note * that the pointers are not inherited to children upon refinement. Still, * after a remeshing they are available on all cells, where they were set on * the previous mesh. diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index 5266f721e9..0c105a5c62 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -284,10 +284,10 @@ protected: /** * Constructor. Protected, thus only callable from friend classes. */ - TriaAccessorBase (const Triangulation *parent = 0, + TriaAccessorBase (const Triangulation *parent = nullptr, const int level = -1, const int index = -1, - const AccessorData * = 0); + const AccessorData * = nullptr); /** * Copy constructor. Creates an object with exactly the same data. @@ -592,10 +592,10 @@ public: /** * Constructor. */ - TriaAccessor (const Triangulation *parent = 0, + TriaAccessor (const Triangulation *parent = nullptr, const int level = -1, const int index = -1, - const AccessorData *local_data = 0); + const AccessorData *local_data = nullptr); /** * Conversion constructor. This constructor exists to make certain @@ -1104,7 +1104,7 @@ public: void set_user_pointer (void *p) const; /** - * Reset the user pointer to a @p NULL pointer. See + * Reset the user pointer to a @pnullptrpointer. See * @ref GlossUserData * for more information. */ @@ -1518,10 +1518,10 @@ public: * compatibility with the other accessor classes. @p index can be used to * set the global index of the vertex we point to. */ - TriaAccessor (const Triangulation *tria = NULL, + TriaAccessor (const Triangulation *tria = nullptr, const int level = 0, const int index = 0, - const AccessorData * = 0); + const AccessorData * = nullptr); /** * Constructor. Should never be called and thus produces an error. @@ -1894,10 +1894,10 @@ public: * compatibility with the other accessor classes. However, it doesn't do * anything useful here and so may not actually be called. */ - TriaAccessor (const Triangulation<1,spacedim> *tria = 0, + TriaAccessor (const Triangulation<1,spacedim> *tria = nullptr, const int = 0, const int = 0, - const AccessorData * = 0); + const AccessorData * = nullptr); /** * Constructor. Should never be called and thus produces an error. @@ -2302,10 +2302,10 @@ public: /** * Constructor. */ - CellAccessor (const Triangulation *parent = 0, + CellAccessor (const Triangulation *parent = nullptr, const int level = -1, const int index = -1, - const AccessorData *local_data = 0); + const AccessorData *local_data = nullptr); /** * Copy constructor. diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 37310ca79a..3380734e66 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -118,7 +118,7 @@ inline bool TriaAccessorBase::operator == (const TriaAccessorBase &a) const { - Assert (tria == a.tria || tria == 0 || a.tria == 0, + Assert (tria == a.tria || tria == nullptr || a.tria == nullptr, TriaAccessorExceptions::ExcCantCompareIterators()); return ((present_level == a.present_level) && (present_index == a.present_index)); @@ -131,7 +131,7 @@ inline bool TriaAccessorBase::operator != (const TriaAccessorBase &a) const { - Assert (tria == a.tria || tria == 0 || a.tria == 0, + Assert (tria == a.tria || tria == nullptr || a.tria == nullptr, TriaAccessorExceptions::ExcCantCompareIterators()); return ((present_level != a.present_level) || (present_index != a.present_index)); @@ -311,7 +311,7 @@ namespace internal const dealii::internal::int2type<1>) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } inline @@ -320,7 +320,7 @@ namespace internal const dealii::internal::int2type<2>) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } inline @@ -329,7 +329,7 @@ namespace internal const dealii::internal::int2type<3>) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } /** @@ -343,7 +343,7 @@ namespace internal const dealii::internal::int2type<3>) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } /** @@ -356,7 +356,7 @@ namespace internal const dealii::internal::int2type) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } template @@ -1705,7 +1705,7 @@ template void TriaAccessor::clear_user_pointer () const { Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed()); - this->objects().user_pointer(this->present_index) = 0; + this->objects().user_pointer(this->present_index) = nullptr; } @@ -2134,7 +2134,7 @@ inline TriaAccessor<0, dim, spacedim>:: TriaAccessor (const TriaAccessor &) : - tria (NULL), + tria ((nullptr)), global_vertex_index (numbers::invalid_unsigned_int) { Assert(false, ExcImpossibleInDim(0)); @@ -2148,7 +2148,7 @@ inline TriaAccessor<0, dim, spacedim>:: TriaAccessor (const InvalidAccessor &) : - tria (NULL), + tria ((nullptr)), global_vertex_index (numbers::invalid_unsigned_int) { Assert(false, ExcImpossibleInDim(0)); @@ -2530,7 +2530,7 @@ inline TriaAccessor<0, 1, spacedim>:: TriaAccessor (const TriaAccessor &) : - tria (0), + tria (nullptr), vertex_kind (interior_vertex), global_vertex_index (numbers::invalid_unsigned_int) { @@ -2545,7 +2545,7 @@ inline TriaAccessor<0, 1, spacedim>:: TriaAccessor (const InvalidAccessor &) : - tria (0), + tria (nullptr), vertex_kind (interior_vertex), global_vertex_index (numbers::invalid_unsigned_int) { @@ -3383,7 +3383,7 @@ CellAccessor::is_locally_owned () const const parallel::Triangulation *pt = dynamic_cast *>(this->tria); - if (pt == 0) + if (pt == nullptr) return true; else return (this->subdomain_id() == pt->locally_owned_subdomain()); @@ -3405,7 +3405,7 @@ CellAccessor::is_locally_owned_on_level () const const parallel::Triangulation *pt = dynamic_cast *>(this->tria); - if (pt == 0) + if (pt == nullptr) return true; else return (this->level_subdomain_id() == pt->locally_owned_subdomain()); @@ -3431,7 +3431,7 @@ CellAccessor::is_ghost () const const parallel::Triangulation *pt = dynamic_cast *>(this->tria); - if (pt == 0) + if (pt == nullptr) return false; else return (this->subdomain_id() != pt->locally_owned_subdomain()); @@ -3455,7 +3455,7 @@ CellAccessor::is_artificial () const const parallel::Triangulation *pt = dynamic_cast *>(this->tria); - if (pt == 0) + if (pt == nullptr) return false; else return this->subdomain_id() == numbers::artificial_subdomain_id; diff --git a/include/deal.II/grid/tria_iterator.h b/include/deal.II/grid/tria_iterator.h index f0b23d7fa5..a3a3488515 100644 --- a/include/deal.II/grid/tria_iterator.h +++ b/include/deal.II/grid/tria_iterator.h @@ -272,7 +272,7 @@ public: TriaRawIterator (const Triangulation *parent, const int level, const int index, - const typename AccessorType::AccessorData *local_data = 0); + const typename AccessorType::AccessorData *local_data = nullptr); /** * This is a conversion operator (constructor) which takes another iterator @@ -568,7 +568,7 @@ public: TriaIterator (const Triangulation *parent, const int level, const int index, - const typename Accessor::AccessorData *local_data = 0); + const typename Accessor::AccessorData *local_data = nullptr); /** * Construct from an accessor of type OtherAccessor that is convertible to diff --git a/include/deal.II/grid/tria_iterator.templates.h b/include/deal.II/grid/tria_iterator.templates.h index 4dbaa4f16b..1b579eebad 100644 --- a/include/deal.II/grid/tria_iterator.templates.h +++ b/include/deal.II/grid/tria_iterator.templates.h @@ -37,7 +37,7 @@ template inline TriaRawIterator::TriaRawIterator () : - accessor (0, -2, -2, 0) + accessor (nullptr, -2, -2, nullptr) {} @@ -68,7 +68,7 @@ TriaRawIterator::TriaRawIterator ( const TriaAccessorBase &tria_accessor, const typename Accessor::AccessorData *local_data) : - accessor(0, -2, -2, local_data) + accessor(nullptr, -2, -2, local_data) { accessor.copy_from(tria_accessor); } diff --git a/include/deal.II/grid/tria_objects.h b/include/deal.II/grid/tria_objects.h index 2357abbbc9..77de4e7f59 100644 --- a/include/deal.II/grid/tria_objects.h +++ b/include/deal.II/grid/tria_objects.h @@ -371,7 +371,7 @@ namespace internal */ UserData() { - p = 0; + p = nullptr; } /** @@ -693,7 +693,7 @@ namespace internal { user_data_type = data_unknown; for (unsigned int i=0; i & DoFHandler::get_fe () const { - Assert (finite_elements != 0, + Assert (finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); return *finite_elements; diff --git a/include/deal.II/lac/block_matrix_base.h b/include/deal.II/lac/block_matrix_base.h index 587b6812fe..e775be4483 100644 --- a/include/deal.II/lac/block_matrix_base.h +++ b/include/deal.II/lac/block_matrix_base.h @@ -1553,7 +1553,7 @@ BlockMatrixBase::clear () for (unsigned int c=0; csub_objects[r][c]; - this->sub_objects[r][c] = 0; + this->sub_objects[r][c] = nullptr; delete p; } sub_objects.reinit (0,0); diff --git a/include/deal.II/lac/block_sparse_matrix.templates.h b/include/deal.II/lac/block_sparse_matrix.templates.h index 22fa11a2ca..de2d415560 100644 --- a/include/deal.II/lac/block_sparse_matrix.templates.h +++ b/include/deal.II/lac/block_sparse_matrix.templates.h @@ -45,7 +45,7 @@ BlockSparseMatrix::~BlockSparseMatrix () // delete previous content of // the subobjects array clear (); - sparsity_pattern = 0; + sparsity_pattern = nullptr; } @@ -78,7 +78,7 @@ void BlockSparseMatrix::clear () { BlockMatrixBase >::clear(); - sparsity_pattern = 0; + sparsity_pattern = nullptr; } diff --git a/include/deal.II/lac/block_vector.h b/include/deal.II/lac/block_vector.h index 2d04587fcf..f8ce49936e 100644 --- a/include/deal.II/lac/block_vector.h +++ b/include/deal.II/lac/block_vector.h @@ -324,7 +324,7 @@ public: * * This function is deprecated. */ - void print (const char *format = 0) const DEAL_II_DEPRECATED; + void print (const char *format = nullptr) const DEAL_II_DEPRECATED; /** * Print to a stream. diff --git a/include/deal.II/lac/block_vector_base.h b/include/deal.II/lac/block_vector_base.h index 394b0f40aa..6902ce35af 100644 --- a/include/deal.II/lac/block_vector_base.h +++ b/include/deal.II/lac/block_vector_base.h @@ -88,7 +88,7 @@ public: * derived from BlockVectorBase). */ static const bool value = (sizeof(check_for_block_vector - ((VectorType *)0)) + ((VectorType *)nullptr)) == sizeof(yes_type)); }; diff --git a/include/deal.II/lac/chunk_sparse_matrix.h b/include/deal.II/lac/chunk_sparse_matrix.h index e784ebc0f2..00ec01ebbb 100644 --- a/include/deal.II/lac/chunk_sparse_matrix.h +++ b/include/deal.II/lac/chunk_sparse_matrix.h @@ -1368,7 +1368,7 @@ inline typename ChunkSparseMatrix::size_type ChunkSparseMatrix::m () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->rows; } @@ -1378,7 +1378,7 @@ inline typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->cols; } @@ -1389,7 +1389,7 @@ inline const ChunkSparsityPattern & ChunkSparseMatrix::get_sparsity_pattern () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return *cols; } @@ -1427,7 +1427,7 @@ void ChunkSparseMatrix::set (const size_type i, AssertIsFinite(value); - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); // it is allowed to set elements of the matrix that are not part of the // sparsity pattern, if the value to which we set it is zero const size_type index = compute_location(i,j); @@ -1450,7 +1450,7 @@ void ChunkSparseMatrix::add (const size_type i, AssertIsFinite(value); - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); if (value != 0.) { @@ -1486,8 +1486,8 @@ inline ChunkSparseMatrix & ChunkSparseMatrix::operator *= (const number factor) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); const size_type chunk_size = cols->get_chunk_size(); @@ -1513,8 +1513,8 @@ inline ChunkSparseMatrix & ChunkSparseMatrix::operator /= (const number factor) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (factor !=0, ExcDivideByZero()); const number factor_inv = 1. / factor; @@ -1544,7 +1544,7 @@ inline number ChunkSparseMatrix::operator () (const size_type i, const size_type j) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); AssertThrow (compute_location(i,j) != SparsityPattern::invalid_entry, ExcInvalidIndex(i,j)); return val[compute_location(i,j)]; @@ -1557,7 +1557,7 @@ inline number ChunkSparseMatrix::el (const size_type i, const size_type j) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); const size_type index = compute_location(i,j); if (index != ChunkSparsityPattern::invalid_entry) @@ -1572,7 +1572,7 @@ template inline number ChunkSparseMatrix::diag_element (const size_type i) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); AssertIndexRange(i, m()); diff --git a/include/deal.II/lac/chunk_sparse_matrix.templates.h b/include/deal.II/lac/chunk_sparse_matrix.templates.h index 6e26eb9271..a210200b7b 100644 --- a/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -285,8 +285,8 @@ namespace internal template ChunkSparseMatrix::ChunkSparseMatrix () : - cols(0, "ChunkSparseMatrix"), - val(0), + cols(nullptr, "ChunkSparseMatrix"), + val(nullptr), max_len(0) {} @@ -296,11 +296,11 @@ template ChunkSparseMatrix::ChunkSparseMatrix (const ChunkSparseMatrix &m) : Subscriptor (m), - cols(0, "ChunkSparseMatrix"), - val(0), + cols(nullptr, "ChunkSparseMatrix"), + val(nullptr), max_len(0) { - Assert (m.cols==0 && m.val==0 && m.max_len==0, + Assert (m.cols==nullptr && m.val==nullptr && m.max_len==0, ExcMessage("This constructor can only be called if the provided argument " "is an empty matrix. This constructor can not be used to " "copy-construct a non-empty matrix. Use the " @@ -314,7 +314,7 @@ ChunkSparseMatrix & ChunkSparseMatrix::operator = (const ChunkSparseMatrix &m) { (void)m; - Assert (m.cols==0 && m.val==0 && m.max_len==0, + Assert (m.cols==nullptr && m.val==nullptr && m.max_len==0, ExcMessage("This operator can only be called if the provided right " "hand side is an empty matrix. This operator can not be " "used to copy a non-empty matrix. Use the " @@ -328,8 +328,8 @@ ChunkSparseMatrix::operator = (const ChunkSparseMatrix &m) template ChunkSparseMatrix::ChunkSparseMatrix (const ChunkSparsityPattern &c) : - cols(0, "ChunkSparseMatrix"), - val(0), + cols(nullptr, "ChunkSparseMatrix"), + val(nullptr), max_len(0) { reinit (c); @@ -341,8 +341,8 @@ template ChunkSparseMatrix::ChunkSparseMatrix (const ChunkSparsityPattern &c, const IdentityMatrix &id) : - cols(0, "ChunkSparseMatrix"), - val(0), + cols(nullptr, "ChunkSparseMatrix"), + val(nullptr), max_len(0) { (void)id; @@ -359,9 +359,9 @@ ChunkSparseMatrix::ChunkSparseMatrix (const ChunkSparsityPattern &c, template ChunkSparseMatrix::~ChunkSparseMatrix () { - cols = 0; + cols = nullptr; - if (val != 0) + if (val != nullptr) delete[] val; } @@ -390,7 +390,7 @@ ChunkSparseMatrix::operator = (const double d) (void)d; Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (cols->sparsity_pattern.compressed || cols->empty(), ChunkSparsityPattern::ExcNotCompressed()); @@ -448,9 +448,9 @@ ChunkSparseMatrix::reinit (const ChunkSparsityPattern &sparsity) if (cols->empty()) { - if (val != 0) + if (val != nullptr) delete[] val; - val = 0; + val = nullptr; max_len = 0; return; } @@ -462,7 +462,7 @@ ChunkSparseMatrix::reinit (const ChunkSparsityPattern &sparsity) chunk_size * chunk_size; if (N > max_len || max_len == 0) { - if (val != 0) + if (val != nullptr) delete[] val; val = new number[N]; max_len = N; @@ -480,9 +480,9 @@ template void ChunkSparseMatrix::clear () { - cols = 0; + cols = nullptr; if (val) delete[] val; - val = 0; + val = nullptr; max_len = 0; } @@ -492,7 +492,7 @@ template bool ChunkSparseMatrix::empty () const { - if (cols == 0) + if (cols == nullptr) return true; else return cols->empty(); @@ -504,7 +504,7 @@ template typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_nonzero_elements () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->n_nonzero_elements (); } @@ -514,7 +514,7 @@ template typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_actually_nonzero_elements () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); // count those elements that are nonzero, even if they lie in the padding // around the matrix. since we have the invariant that padding elements are @@ -532,7 +532,7 @@ template void ChunkSparseMatrix::symmetrize () { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (cols->rows == cols->cols, ExcNotQuadratic()); Assert (false, ExcNotImplemented()); @@ -545,8 +545,8 @@ template ChunkSparseMatrix & ChunkSparseMatrix::copy_from (const ChunkSparseMatrix &matrix) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (cols == matrix.cols, ExcDifferentChunkSparsityPatterns()); // copy everything, including padding elements @@ -584,8 +584,8 @@ void ChunkSparseMatrix::add (const number factor, const ChunkSparseMatrix &matrix) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (cols == matrix.cols, ExcDifferentChunkSparsityPatterns()); // add everything, including padding elements @@ -661,8 +661,8 @@ void ChunkSparseMatrix::vmult (OutVector &dst, const InVector &src) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -682,15 +682,15 @@ void ChunkSparseMatrix::Tvmult (OutVector &dst, const InVector &src) const { - Assert (val != 0, ExcNotInitialized()); - Assert (cols != 0, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert(n() == dst.size(), ExcDimensionMismatch(n(),dst.size())); Assert(m() == src.size(), ExcDimensionMismatch(m(),src.size())); Assert (!PointerComparison::equal(&src, &dst), ExcSourceEqualsDestination()); - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -710,8 +710,8 @@ void ChunkSparseMatrix::vmult_add (OutVector &dst, const InVector &src) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -737,8 +737,8 @@ void ChunkSparseMatrix::Tvmult_add (OutVector &dst, const InVector &src) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -830,8 +830,8 @@ template somenumber ChunkSparseMatrix::matrix_norm_square (const Vector &v) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); @@ -940,8 +940,8 @@ somenumber ChunkSparseMatrix::matrix_scalar_product (const Vector &u, const Vector &v) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == u.size(), ExcDimensionMismatch(m(),u.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); @@ -1046,8 +1046,8 @@ template typename ChunkSparseMatrix::real_type ChunkSparseMatrix::l1_norm () const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); @@ -1078,8 +1078,8 @@ template typename ChunkSparseMatrix::real_type ChunkSparseMatrix::linfty_norm () const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); // this function works like l1_norm(). it can be made more efficient // (without allocating a temporary vector) as is done in the SparseMatrix @@ -1133,8 +1133,8 @@ ChunkSparseMatrix::residual (Vector &dst, const Vector &u, const Vector &b) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(m() == b.size(), ExcDimensionMismatch(m(),b.size())); Assert(n() == u.size(), ExcDimensionMismatch(n(),u.size())); @@ -1249,8 +1249,8 @@ ChunkSparseMatrix::precondition_Jacobi (Vector &dst, { (void)dst; (void)src; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n())); @@ -1272,8 +1272,8 @@ ChunkSparseMatrix::precondition_SSOR (Vector &dst, // CVS archives to see the original version which is much clearer... (void)dst; (void)src; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n())); @@ -1290,8 +1290,8 @@ ChunkSparseMatrix::precondition_SOR (Vector &dst, const Vector &src, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); @@ -1307,8 +1307,8 @@ ChunkSparseMatrix::precondition_TSOR (Vector &dst, const Vector &src, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); @@ -1324,8 +1324,8 @@ ChunkSparseMatrix::SOR (Vector &dst, const number /*om*/) const { (void)dst; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1340,8 +1340,8 @@ ChunkSparseMatrix::TSOR (Vector &dst, const number /*om*/) const { (void)dst; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1360,8 +1360,8 @@ ChunkSparseMatrix::PSOR (Vector &dst, (void)dst; (void)permutation; (void)inverse_permutation; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1385,8 +1385,8 @@ ChunkSparseMatrix::TPSOR (Vector &dst, (void)dst; (void)permutation; (void)inverse_permutation; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1409,8 +1409,8 @@ ChunkSparseMatrix::SOR_step (Vector &v, { (void)v; (void)b; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); @@ -1430,8 +1430,8 @@ ChunkSparseMatrix::TSOR_step (Vector &v, { (void)v; (void)b; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); @@ -1462,8 +1462,8 @@ ChunkSparseMatrix::SSOR (Vector &dst, const number /*om*/) const { (void)dst; - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcMessage("This operation is only valid on square matrices.")); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1478,8 +1478,8 @@ void ChunkSparseMatrix::print (std::ostream &out) const { AssertThrow (out, ExcIO()); - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (false, ExcNotImplemented()); @@ -1497,8 +1497,8 @@ void ChunkSparseMatrix::print_formatted (std::ostream &out, { AssertThrow (out, ExcIO()); - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); unsigned int width = width_; @@ -1545,8 +1545,8 @@ void ChunkSparseMatrix::print_pattern (std::ostream &out, { AssertThrow (out, ExcIO()); - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); const size_type chunk_size = cols->get_chunk_size(); diff --git a/include/deal.II/lac/constraint_matrix.h b/include/deal.II/lac/constraint_matrix.h index ba56b63973..365159117e 100644 --- a/include/deal.II/lac/constraint_matrix.h +++ b/include/deal.II/lac/constraint_matrix.h @@ -1567,7 +1567,7 @@ ConstraintMatrix::get_constraint_entries (const size_type line) const const size_type line_index = calculate_line_index(line); if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_size_type) - return 0; + return nullptr; else return &lines[lines_cache[line_index]].entries; } @@ -1785,7 +1785,7 @@ public: * derived from BlockMatrixBase). */ static const bool value = (sizeof(check_for_block_matrix - ((MatrixType *)0)) + ((MatrixType *)nullptr)) == sizeof(yes_type)); }; diff --git a/include/deal.II/lac/constraint_matrix.templates.h b/include/deal.II/lac/constraint_matrix.templates.h index 88076c6149..fdc1b1029d 100644 --- a/include/deal.II/lac/constraint_matrix.templates.h +++ b/include/deal.II/lac/constraint_matrix.templates.h @@ -680,7 +680,7 @@ distribute_local_to_global (const Vector &local_vector, // global dof index const size_type line_index = calculate_line_index (local_dof_indices_col[i]); const ConstraintLine *position = - lines_cache.size() <= line_index ? 0 : &lines[lines_cache[line_index]]; + lines_cache.size() <= line_index ? nullptr : &lines[lines_cache[line_index]]; // Gauss elimination of the matrix columns with the inhomogeneity. // Go through them one by one and again check whether they are @@ -757,7 +757,7 @@ namespace internal const Epetra_MpiComm *mpi_comm = dynamic_cast(&vec.trilinos_vector().Comm()); - Assert (mpi_comm != 0, ExcInternalError()); + Assert (mpi_comm != nullptr, ExcInternalError()); output.reinit (needed_elements, mpi_comm->GetMpiComm()); #else output.reinit (needed_elements, MPI_COMM_WORLD); @@ -2283,7 +2283,7 @@ ConstraintMatrix::distribute_local_to_global ( vals.resize (n_actual_dofs); } else - Assert (sparse_matrix != 0, ExcInternalError()); + Assert (sparse_matrix != nullptr, ExcInternalError()); // now do the actual job. go through all the global rows that we will touch // and call resolve_matrix_row for each of those. @@ -2512,7 +2512,7 @@ distribute_local_to_global (const FullMatrix & SparseMatrix *sparse_matrix = dynamic_cast *>(&global_matrix.block(block, block_col)); - Assert (sparse_matrix != 0, ExcInternalError()); + Assert (sparse_matrix != nullptr, ExcInternalError()); internals::resolve_matrix_row (global_rows, i, start_block, end_block, local_matrix, sparse_matrix); } diff --git a/include/deal.II/lac/iterative_inverse.h b/include/deal.II/lac/iterative_inverse.h index d9ab0537a1..190936dc43 100644 --- a/include/deal.II/lac/iterative_inverse.h +++ b/include/deal.II/lac/iterative_inverse.h @@ -149,8 +149,8 @@ template inline void IterativeInverse::vmult (VectorType &dst, const VectorType &src) const { - Assert(matrix.get() != 0, ExcNotInitialized()); - Assert(preconditioner.get() != 0, ExcNotInitialized()); + Assert(matrix.get() != nullptr, ExcNotInitialized()); + Assert(preconditioner.get() != nullptr, ExcNotInitialized()); dst = 0.; solver.solve(*matrix, dst, src, *preconditioner); } diff --git a/include/deal.II/lac/la_parallel_block_vector.templates.h b/include/deal.II/lac/la_parallel_block_vector.templates.h index 645f387933..cdce69c73a 100644 --- a/include/deal.II/lac/la_parallel_block_vector.templates.h +++ b/include/deal.II/lac/la_parallel_block_vector.templates.h @@ -316,7 +316,7 @@ namespace LinearAlgebra BlockVector::scale (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -332,7 +332,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -362,7 +362,7 @@ namespace LinearAlgebra BlockVector::operator += (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -379,7 +379,7 @@ namespace LinearAlgebra BlockVector::operator -= (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -407,7 +407,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -425,11 +425,11 @@ namespace LinearAlgebra const VectorSpaceVector &ww) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); - Assert(dynamic_cast *>(&ww)!=NULL, + Assert(dynamic_cast *>(&ww)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &w = dynamic_cast &>(ww); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -447,7 +447,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -541,7 +541,7 @@ namespace LinearAlgebra Assert (this->n_blocks() > 0, ExcEmptyObject()); // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); @@ -669,13 +669,13 @@ namespace LinearAlgebra const VectorSpaceVector &ww) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &v = dynamic_cast &>(vv); AssertDimension(this->n_blocks(), v.n_blocks()); // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&ww)!=NULL, + Assert(dynamic_cast *>(&ww)!=nullptr, ExcVectorTypeNotCompatible()); const BlockVector &w = dynamic_cast &>(ww); AssertDimension(this->n_blocks(), w.n_blocks()); diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index e096652690..d23101c5b4 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -62,9 +62,9 @@ namespace LinearAlgebra { if (new_alloc_size > allocated_size) { - Assert (((allocated_size > 0 && val != 0) || - val == 0), ExcInternalError()); - if (val != 0) + Assert (((allocated_size > 0 && val != nullptr) || + val == nullptr), ExcInternalError()); + if (val != nullptr) free(val); Utilities::System::posix_memalign ((void **)&val, 64, sizeof(Number)*new_alloc_size); @@ -73,9 +73,9 @@ namespace LinearAlgebra } else if (new_alloc_size == 0) { - if (val != 0) + if (val != nullptr) free(val); - val = 0; + val = nullptr; allocated_size = 0; } thread_loop_partitioner.reset(new ::dealii::parallel::internal::TBBPartitioner()); @@ -94,9 +94,9 @@ namespace LinearAlgebra resize_val (size); // delete previous content in import data - if (import_data != 0) + if (import_data != nullptr) delete[] import_data; - import_data = 0; + import_data = nullptr; // set partitioner to serial version partitioner.reset (new Utilities::MPI::Partitioner (size)); @@ -117,7 +117,7 @@ namespace LinearAlgebra const bool omit_zeroing_entries) { clear_mpi_requests(); - Assert (v.partitioner.get() != 0, ExcNotInitialized()); + Assert (v.partitioner.get() != nullptr, ExcNotInitialized()); // check whether the partitioners are // different (check only if the are allocated @@ -134,7 +134,7 @@ namespace LinearAlgebra if (omit_zeroing_entries == false) this->operator= (Number()); - if (import_data != 0) + if (import_data != nullptr) { delete [] import_data; @@ -142,7 +142,7 @@ namespace LinearAlgebra // is only used as temporary storage for compress() and // update_ghost_values, and we might have vectors where we never // call these methods and hence do not need to have the storage. - import_data = 0; + import_data = nullptr; } vector_is_ghosted = false; @@ -196,7 +196,7 @@ namespace LinearAlgebra // initialize to zero this->operator= (Number()); - if (import_data != 0) + if (import_data != nullptr) { delete [] import_data; @@ -204,7 +204,7 @@ namespace LinearAlgebra // is only used as temporary storage for compress() and // update_ghost_values, and we might have vectors where we never // call these methods and hence do not need to have the storage. - import_data = 0; + import_data = nullptr; } vector_is_ghosted = false; @@ -217,8 +217,8 @@ namespace LinearAlgebra : partitioner (new Utilities::MPI::Partitioner()), allocated_size (0), - val (0), - import_data (0) + val (nullptr), + import_data (nullptr) { reinit(0); } @@ -230,8 +230,8 @@ namespace LinearAlgebra : Subscriptor(), allocated_size (0), - val (0), - import_data (0), + val (nullptr), + import_data (nullptr), vector_is_ghosted (false) { reinit (v, true); @@ -252,8 +252,8 @@ namespace LinearAlgebra const MPI_Comm communicator) : allocated_size (0), - val (0), - import_data (0), + val (nullptr), + import_data (nullptr), vector_is_ghosted (false) { reinit (local_range, ghost_indices, communicator); @@ -266,8 +266,8 @@ namespace LinearAlgebra const MPI_Comm communicator) : allocated_size (0), - val (0), - import_data (0), + val (nullptr), + import_data (nullptr), vector_is_ghosted (false) { reinit (local_range, communicator); @@ -279,8 +279,8 @@ namespace LinearAlgebra Vector::Vector (const size_type size) : allocated_size (0), - val (0), - import_data (0), + val (nullptr), + import_data (nullptr), vector_is_ghosted (false) { reinit (size, false); @@ -293,8 +293,8 @@ namespace LinearAlgebra Vector (const std::shared_ptr &partitioner) : allocated_size (0), - val (0), - import_data (0), + val (nullptr), + import_data (nullptr), vector_is_ghosted (false) { reinit (partitioner); @@ -308,9 +308,9 @@ namespace LinearAlgebra { resize_val(0); - if (import_data != 0) + if (import_data != nullptr) delete[] import_data; - import_data = 0; + import_data = nullptr; clear_mpi_requests(); } @@ -337,7 +337,7 @@ namespace LinearAlgebra Vector & Vector::operator = (const Vector &c) { - Assert (c.partitioner.get() != 0, ExcNotInitialized()); + Assert (c.partitioner.get() != nullptr, ExcNotInitialized()); // we update ghost values whenever one of the input or output vector // already held ghost values or when we import data from a vector with @@ -352,7 +352,7 @@ namespace LinearAlgebra // c does not have any ghosts (constructed without ghost elements given) // but the current vector does: In that case, we need to exchange data // also when none of the two vector had updated its ghost values before. - if (partitioner.get() == 0) + if (partitioner.get() == nullptr) reinit (c, true); else if (partitioner.get() != c.partitioner.get()) { @@ -567,7 +567,7 @@ namespace LinearAlgebra compress_requests.resize (n_import_targets + n_ghost_targets); // allocate import_data in case it is not set up yet - if (import_data == 0) + if (import_data == nullptr) import_data = new Number[part.n_import_indices()]; // initiate the receive operations @@ -754,13 +754,13 @@ namespace LinearAlgebra part.local_size()+part.n_ghost_indices()); // allocate import_data in case it is not set up yet - if (import_data == 0 && part.n_import_indices() > 0) + if (import_data == nullptr && part.n_import_indices() > 0) import_data = new Number[part.n_import_indices()]; // copy the data to be sent to the import_data field if (part.n_import_indices() > 0) { - Assert (import_data != 0, ExcInternalError()); + Assert (import_data != nullptr, ExcInternalError()); Number *write_position = import_data; std::vector >::const_iterator my_imports = part.import_indices().begin(); @@ -831,7 +831,7 @@ namespace LinearAlgebra // If no communication pattern is given, create one. Otherwise, use the // given one. std::shared_ptr comm_pattern; - if (communication_pattern.get() == NULL) + if (communication_pattern.get() == (nullptr)) { // Split the IndexSet of V in locally owned elements and ghost indices // then create the communication pattern @@ -847,7 +847,7 @@ namespace LinearAlgebra { comm_pattern = std::dynamic_pointer_cast (communication_pattern); - AssertThrow(comm_pattern != NULL, + AssertThrow(comm_pattern != nullptr, ExcMessage("The communication pattern is not of type " "Utilities::MPI::Partitioner.")); } @@ -946,7 +946,7 @@ namespace LinearAlgebra Vector::operator += (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -969,7 +969,7 @@ namespace LinearAlgebra Vector::operator -= (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1009,7 +1009,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1034,10 +1034,10 @@ namespace LinearAlgebra const VectorSpaceVector &ww) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); - Assert(dynamic_cast *>(&ww)!=NULL, + Assert(dynamic_cast *>(&ww)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &w = dynamic_cast &>(ww); @@ -1097,7 +1097,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1175,7 +1175,7 @@ namespace LinearAlgebra Vector::scale (const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1197,7 +1197,7 @@ namespace LinearAlgebra const VectorSpaceVector &vv) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1296,7 +1296,7 @@ namespace LinearAlgebra Vector::operator * (const VectorSpaceVector &vv) const { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); @@ -1486,10 +1486,10 @@ namespace LinearAlgebra const VectorSpaceVector &ww) { // Downcast. Throws an exception if invalid. - Assert(dynamic_cast *>(&vv)!=NULL, + Assert(dynamic_cast *>(&vv)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &v = dynamic_cast &>(vv); - Assert(dynamic_cast *>(&ww)!=NULL, + Assert(dynamic_cast *>(&ww)!=nullptr, ExcVectorTypeNotCompatible()); const Vector &w = dynamic_cast &>(ww); @@ -1537,7 +1537,7 @@ namespace LinearAlgebra // for it. if (partitioner.use_count() > 0) memory += partitioner->memory_consumption()/partitioner.use_count()+1; - if (import_data != 0) + if (import_data != nullptr) memory += (static_cast(partitioner->n_import_indices())* sizeof(Number)); return memory; @@ -1552,7 +1552,7 @@ namespace LinearAlgebra const bool scientific, const bool across) const { - Assert (partitioner.get() !=0, ExcInternalError()); + Assert (partitioner.get() !=nullptr, ExcInternalError()); AssertThrow (out, ExcIO()); std::ios::fmtflags old_flags = out.flags(); unsigned int old_precision = out.precision (precision); diff --git a/include/deal.II/lac/la_vector.templates.h b/include/deal.II/lac/la_vector.templates.h index 460723c942..84ee087754 100644 --- a/include/deal.II/lac/la_vector.templates.h +++ b/include/deal.II/lac/la_vector.templates.h @@ -102,7 +102,7 @@ namespace LinearAlgebra Vector &Vector::operator+= (const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, ExcVectorTypeNotCompatible()); + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. const Vector &down_V = dynamic_cast&>(V); @@ -121,7 +121,7 @@ namespace LinearAlgebra Vector &Vector::operator-= (const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, ExcVectorTypeNotCompatible()); + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. const Vector &down_V = dynamic_cast&>(V); @@ -139,7 +139,7 @@ namespace LinearAlgebra Number Vector::operator* (const VectorSpaceVector &V) const { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -182,7 +182,7 @@ namespace LinearAlgebra void Vector::add(const Number a, const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -202,10 +202,10 @@ namespace LinearAlgebra const Number b, const VectorSpaceVector &W) { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Check that casting will work. - Assert(dynamic_cast*>(&W)!=NULL, + Assert(dynamic_cast*>(&W)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -234,7 +234,7 @@ namespace LinearAlgebra AssertIsFinite(a); // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. It fails, throws an exception. @@ -250,7 +250,7 @@ namespace LinearAlgebra void Vector::scale(const VectorSpaceVector &scaling_factors) { // Check that casting will work. - Assert(dynamic_cast*>(&scaling_factors)!=NULL, + Assert(dynamic_cast*>(&scaling_factors)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast scaling_factors. If fails, throws an exception. @@ -271,7 +271,7 @@ namespace LinearAlgebra AssertIsFinite(a); // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -377,10 +377,10 @@ namespace LinearAlgebra const VectorSpaceVector &W) { // Check that casting will work. - Assert(dynamic_cast*>(&V)!=NULL, + Assert(dynamic_cast*>(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Check that casting will work. - Assert(dynamic_cast*>(&W)!=NULL, + Assert(dynamic_cast*>(&W)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. diff --git a/include/deal.II/lac/packaged_operation.h b/include/deal.II/lac/packaged_operation.h index bba1b6a5cf..5db537acb0 100644 --- a/include/deal.II/lac/packaged_operation.h +++ b/include/deal.II/lac/packaged_operation.h @@ -504,7 +504,7 @@ namespace // type is std::true_type if Matrix provides vmult_add and Tvmult_add, // otherwise it is std::false_type - typedef decltype(test(0, 0, 0)) type; + typedef decltype(test(nullptr, nullptr, nullptr)) type; }; } diff --git a/include/deal.II/lac/petsc_compatibility.h b/include/deal.II/lac/petsc_compatibility.h index b4efc51d22..b3bb1309a5 100644 --- a/include/deal.II/lac/petsc_compatibility.h +++ b/include/deal.II/lac/petsc_compatibility.h @@ -53,7 +53,7 @@ namespace PETScWrappers #if DEAL_II_PETSC_VERSION_LT(3, 7, 0) const PetscErrorCode ierr = PetscOptionsSetValue (name.c_str (), value.c_str ()); #else - const PetscErrorCode ierr = PetscOptionsSetValue (NULL, name.c_str (), value.c_str ()); + const PetscErrorCode ierr = PetscOptionsSetValue ((nullptr), name.c_str (), value.c_str ()); #endif AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -72,7 +72,7 @@ namespace PETScWrappers */ inline PetscErrorCode destroy_matrix (Mat &matrix) { - // PETSc will check whether or not matrix is NULL. + // PETSc will check whether or not matrix is (nullptr). #if DEAL_II_PETSC_VERSION_LT(3, 2, 0) return MatDestroy (matrix); #else @@ -94,7 +94,7 @@ namespace PETScWrappers */ inline PetscErrorCode destroy_krylov_solver (KSP &krylov_solver) { - // PETSc will check whether or not matrix is NULL. + // PETSc will check whether or not matrix is (nullptr). #if DEAL_II_PETSC_VERSION_LT(3, 2, 0) return KSPDestroy (krylov_solver); #else diff --git a/include/deal.II/lac/pointer_matrix.h b/include/deal.II/lac/pointer_matrix.h index 8fc7ddcff2..dd6016681c 100644 --- a/include/deal.II/lac/pointer_matrix.h +++ b/include/deal.II/lac/pointer_matrix.h @@ -120,7 +120,7 @@ public: * * If M is zero, no matrix is stored. */ - PointerMatrix (const MatrixType *M=0); + PointerMatrix (const MatrixType *M=nullptr); /** * Constructor. @@ -449,7 +449,7 @@ inline PointerMatrixBase * new_pointer_matrix_base(MatrixType &matrix, const VectorType &, const char *name = "PointerMatrixAux") { - return new PointerMatrixAux(0, &matrix, name); + return new PointerMatrixAux(nullptr, &matrix, name); } /** @@ -591,7 +591,7 @@ PointerMatrix::PointerMatrix (const MatrixType *M) template PointerMatrix::PointerMatrix (const char *name) - : m(0, name) + : m(nullptr, name) {} @@ -606,7 +606,7 @@ template inline void PointerMatrix::clear () { - m = 0; + m = nullptr; } @@ -623,7 +623,7 @@ template inline bool PointerMatrix::empty () const { - if (m == 0) + if (m == nullptr) return true; return m->empty(); } @@ -633,7 +633,7 @@ inline void PointerMatrix::vmult (VectorType &dst, const VectorType &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->vmult (dst, src); } @@ -643,7 +643,7 @@ inline void PointerMatrix::Tvmult (VectorType &dst, const VectorType &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->Tvmult (dst, src); } @@ -653,7 +653,7 @@ inline void PointerMatrix::vmult_add (VectorType &dst, const VectorType &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->vmult_add (dst, src); } @@ -663,7 +663,7 @@ inline void PointerMatrix::Tvmult_add (VectorType &dst, const VectorType &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->Tvmult_add (dst, src); } @@ -699,7 +699,7 @@ PointerMatrixAux::PointerMatrixAux (VectorMemory inline void PointerMatrixAux::clear () { - m = 0; + m = nullptr; } @@ -744,10 +744,10 @@ inline void PointerMatrixAux::vmult (VectorType &dst, const VectorType &src) const { - if (mem == 0) + if (mem == nullptr) mem = &my_memory; - Assert (mem != 0, ExcNotInitialized()); - Assert (m != 0, ExcNotInitialized()); + Assert (mem != nullptr, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->vmult (dst, src); } @@ -757,10 +757,10 @@ inline void PointerMatrixAux::Tvmult (VectorType &dst, const VectorType &src) const { - if (mem == 0) + if (mem == nullptr) mem = &my_memory; - Assert (mem != 0, ExcNotInitialized()); - Assert (m != 0, ExcNotInitialized()); + Assert (mem != nullptr, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); m->Tvmult (dst, src); } @@ -770,10 +770,10 @@ inline void PointerMatrixAux::vmult_add (VectorType &dst, const VectorType &src) const { - if (mem == 0) + if (mem == nullptr) mem = &my_memory; - Assert (mem != 0, ExcNotInitialized()); - Assert (m != 0, ExcNotInitialized()); + Assert (mem != nullptr, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); VectorType *v = mem->alloc(); v->reinit(dst); m->vmult (*v, src); @@ -787,10 +787,10 @@ inline void PointerMatrixAux::Tvmult_add (VectorType &dst, const VectorType &src) const { - if (mem == 0) + if (mem == nullptr) mem = &my_memory; - Assert (mem != 0, ExcNotInitialized()); - Assert (m != 0, ExcNotInitialized()); + Assert (mem != nullptr, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); VectorType *v = mem->alloc(); v->reinit(dst); m->Tvmult (*v, src); @@ -825,7 +825,7 @@ template inline void PointerMatrixVector::clear () { - m = 0; + m = nullptr; } @@ -852,7 +852,7 @@ inline void PointerMatrixVector::vmult (Vector &dst, const Vector &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); dst(0) = *m * src; @@ -864,7 +864,7 @@ inline void PointerMatrixVector::Tvmult (Vector &dst, const Vector &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); dst.equ (src(0), *m); @@ -876,7 +876,7 @@ inline void PointerMatrixVector::vmult_add (Vector &dst, const Vector &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); dst(0) += *m * src; @@ -888,7 +888,7 @@ inline void PointerMatrixVector::Tvmult_add (Vector &dst, const Vector &src) const { - Assert (m != 0, ExcNotInitialized()); + Assert (m != nullptr, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); dst.add (src(0), *m); diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 0ea8991a07..b11311965e 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -1336,14 +1336,14 @@ template inline void PreconditionRelaxation::clear () { - A = 0; + A = nullptr; } template inline typename PreconditionRelaxation::size_type PreconditionRelaxation::m () const { - Assert (A!=0, ExcNotInitialized()); + Assert (A!=nullptr, ExcNotInitialized()); return A->m(); } @@ -1351,7 +1351,7 @@ template inline typename PreconditionRelaxation::size_type PreconditionRelaxation::n () const { - Assert (A!=0, ExcNotInitialized()); + Assert (A!=nullptr, ExcNotInitialized()); return A->n(); } @@ -1368,7 +1368,7 @@ PreconditionJacobi::vmult (VectorType &dst, const VectorType &src) c "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_Jacobi (dst, src, this->relaxation); } @@ -1385,7 +1385,7 @@ PreconditionJacobi::Tvmult (VectorType &dst, const VectorType &src) "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_Jacobi (dst, src, this->relaxation); } @@ -1402,7 +1402,7 @@ PreconditionJacobi::step (VectorType &dst, const VectorType &src) co "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->Jacobi_step (dst, src, this->relaxation); } @@ -1437,7 +1437,7 @@ PreconditionSOR::vmult (VectorType &dst, const VectorType &src) cons "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_SOR (dst, src, this->relaxation); } @@ -1454,7 +1454,7 @@ PreconditionSOR::Tvmult (VectorType &dst, const VectorType &src) con "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_TSOR (dst, src, this->relaxation); } @@ -1471,7 +1471,7 @@ PreconditionSOR::step (VectorType &dst, const VectorType &src) const "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->SOR_step (dst, src, this->relaxation); } @@ -1488,7 +1488,7 @@ PreconditionSOR::Tstep (VectorType &dst, const VectorType &src) cons "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->TSOR_step (dst, src, this->relaxation); } @@ -1509,7 +1509,7 @@ PreconditionSSOR::initialize (const MatrixType & dynamic_cast *>(&*this->A); // calculate the positions first after the diagonal. - if (mat != 0) + if (mat != nullptr) { const size_type n = this->A->n(); pos_right_of_diagonal.resize(n, static_cast(-1)); @@ -1541,7 +1541,7 @@ PreconditionSSOR::vmult (VectorType &dst, const VectorType &src) con "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_SSOR (dst, src, this->relaxation, pos_right_of_diagonal); } @@ -1558,7 +1558,7 @@ PreconditionSSOR::Tvmult (VectorType &dst, const VectorType &src) co "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->precondition_SSOR (dst, src, this->relaxation, pos_right_of_diagonal); } @@ -1575,7 +1575,7 @@ PreconditionSSOR::step (VectorType &dst, const VectorType &src) cons "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); this->A->SSOR_step (dst, src, this->relaxation); } @@ -1636,7 +1636,7 @@ PreconditionPSOR::vmult (VectorType &dst, const VectorType &src) con "PreconditionPSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); dst = src; this->A->PSOR (dst, *permutation, *inverse_permutation, this->relaxation); } @@ -1654,7 +1654,7 @@ PreconditionPSOR::Tvmult (VectorType &dst, const VectorType &src) co "PreconditionPSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); dst = src; this->A->TPSOR (dst, *permutation, *inverse_permutation, this->relaxation); } @@ -1902,7 +1902,7 @@ namespace internal { (void)matrix; (void)preconditioner; - AssertThrow(preconditioner.get() != NULL, ExcNotInitialized()); + AssertThrow(preconditioner.get() != nullptr, ExcNotInitialized()); } template @@ -1912,10 +1912,10 @@ namespace internal std::shared_ptr > &preconditioner, VectorType &diagonal_inverse) { - if (preconditioner.get() == NULL || + if (preconditioner.get() ==nullptr|| preconditioner->m() != matrix.m()) { - if (preconditioner.get() == NULL) + if (preconditioner.get() == (nullptr)) preconditioner.reset(new DiagonalMatrix()); Assert(preconditioner->m() == 0, @@ -2051,7 +2051,7 @@ PreconditionChebyshev::clear () { is_initialized = false; theta = delta = 1.0; - matrix_ptr = 0; + matrix_ptr = nullptr; { VectorType empty_vector; data.matrix_diagonal_inverse.reinit(empty_vector); @@ -2073,7 +2073,7 @@ PreconditionChebyshev::estimate_eigenv (const VectorType &src) const { Assert(is_initialized == false, ExcInternalError()); - Assert(data.preconditioner.get() != NULL, ExcNotInitialized()); + Assert(data.preconditioner.get() != nullptr, ExcNotInitialized()); update1.reinit(src); update2.reinit(src, true); @@ -2305,7 +2305,7 @@ inline typename PreconditionChebyshev::size_type PreconditionChebyshev::m () const { - Assert (matrix_ptr!=0, ExcNotInitialized()); + Assert (matrix_ptr!=nullptr, ExcNotInitialized()); return matrix_ptr->m(); } @@ -2316,7 +2316,7 @@ inline typename PreconditionChebyshev::size_type PreconditionChebyshev::n () const { - Assert (matrix_ptr!=0, ExcNotInitialized()); + Assert (matrix_ptr!=nullptr, ExcNotInitialized()); return matrix_ptr->n(); } diff --git a/include/deal.II/lac/precondition_block.h b/include/deal.II/lac/precondition_block.h index 76eca4f604..8aab5b675b 100644 --- a/include/deal.II/lac/precondition_block.h +++ b/include/deal.II/lac/precondition_block.h @@ -868,7 +868,7 @@ template inline bool PreconditionBlock::empty () const { - if (A == 0) + if (A == nullptr) return true; return A->empty(); } diff --git a/include/deal.II/lac/precondition_block.templates.h b/include/deal.II/lac/precondition_block.templates.h index 0796baa528..789e87ccc4 100644 --- a/include/deal.II/lac/precondition_block.templates.h +++ b/include/deal.II/lac/precondition_block.templates.h @@ -54,7 +54,7 @@ template PreconditionBlock::PreconditionBlock (bool store) : PreconditionBlockBase(store), blocksize(0), - A(0, typeid(*this).name()), + A(nullptr, typeid(*this).name()), relaxation(1.0) {} @@ -69,7 +69,7 @@ void PreconditionBlock::clear () { PreconditionBlockBase::clear(); blocksize = 0; - A = 0; + A = nullptr; } @@ -115,7 +115,7 @@ void PreconditionBlock::initialize template void PreconditionBlock::invert_permuted_diagblocks() { - Assert (A!=0, ExcNotInitialized()); + Assert (A!=nullptr, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); const MatrixType &M=*A; @@ -226,7 +226,7 @@ void PreconditionBlock::forward_step const Vector &src, const bool transpose_diagonal) const { - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); const MatrixType &M=*this->A; @@ -324,7 +324,7 @@ void PreconditionBlock::backward_step const Vector &src, const bool transpose_diagonal) const { - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); const MatrixType &M=*this->A; @@ -425,7 +425,7 @@ PreconditionBlock::block_size() const template void PreconditionBlock::invert_diagblocks() { - Assert (A!=0, ExcNotInitialized()); + Assert (A!=nullptr, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); const MatrixType &M=*A; @@ -553,7 +553,7 @@ void PreconditionBlockJacobi const Vector &src, bool adding) const { - Assert(this->A!=0, ExcNotInitialized()); + Assert(this->A!=nullptr, ExcNotInitialized()); const MatrixType &M=*this->A; @@ -716,7 +716,7 @@ void PreconditionBlockSOR::forward const bool transpose_diagonal, const bool) const { - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); const MatrixType &M=*this->A; const bool permuted = (this->permutation.size() != 0); @@ -806,7 +806,7 @@ void PreconditionBlockSOR::backward const bool transpose_diagonal, const bool) const { - Assert (this->A!=0, ExcNotInitialized()); + Assert (this->A!=nullptr, ExcNotInitialized()); const MatrixType &M=*this->A; const bool permuted = (this->permutation.size() != 0); diff --git a/include/deal.II/lac/precondition_selector.h b/include/deal.II/lac/precondition_selector.h index b4481ff861..0ca3ae094d 100644 --- a/include/deal.II/lac/precondition_selector.h +++ b/include/deal.II/lac/precondition_selector.h @@ -202,7 +202,7 @@ template PreconditionSelector::~PreconditionSelector() { // release the matrix A - A=0; + A=nullptr; } @@ -217,7 +217,7 @@ template inline typename PreconditionSelector::size_type PreconditionSelector::m () const { - Assert(A!=0, ExcNoMatrixGivenToUse()); + Assert(A!=nullptr, ExcNoMatrixGivenToUse()); return A->m(); } @@ -226,7 +226,7 @@ template inline typename PreconditionSelector::size_type PreconditionSelector::n () const { - Assert(A!=0, ExcNoMatrixGivenToUse()); + Assert(A!=nullptr, ExcNoMatrixGivenToUse()); return A->n(); } @@ -242,7 +242,7 @@ void PreconditionSelector::vmult (VectorType &dst, } else { - Assert(A!=0, ExcNoMatrixGivenToUse()); + Assert(A!=nullptr, ExcNoMatrixGivenToUse()); if (preconditioning=="jacobi") { @@ -272,7 +272,7 @@ void PreconditionSelector::Tvmult (VectorType &dst, } else { - Assert(A!=0, ExcNoMatrixGivenToUse()); + Assert(A!=nullptr, ExcNoMatrixGivenToUse()); if (preconditioning=="jacobi") { diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index 3d15c23daa..9a28632cf8 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -624,7 +624,7 @@ namespace LinearAlgebra inline ReadWriteVector::ReadWriteVector () : - val(NULL) + val((nullptr)) { reinit(0, true); } @@ -636,7 +636,7 @@ namespace LinearAlgebra ReadWriteVector::ReadWriteVector (const ReadWriteVector &v) : Subscriptor(), - val(NULL) + val((nullptr)) { this->operator=(v); } @@ -647,7 +647,7 @@ namespace LinearAlgebra inline ReadWriteVector::ReadWriteVector (const size_type size) : - val(NULL) + val((nullptr)) { reinit (size, false); } @@ -658,7 +658,7 @@ namespace LinearAlgebra inline ReadWriteVector::ReadWriteVector (const IndexSet &locally_stored_indices) : - val(NULL) + val((nullptr)) { reinit (locally_stored_indices); } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index 09a0d65ebe..0436e49d87 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -52,14 +52,14 @@ namespace LinearAlgebra { if (new_alloc_size == 0) { - if (val != NULL) + if (val != (nullptr)) free(val); - val = NULL; + val = (nullptr); thread_loop_partitioner.reset(new parallel::internal::TBBPartitioner()); } else { - if (val != NULL) + if (val != (nullptr)) free(val); Utilities::System::posix_memalign ((void **)&val, 64, sizeof(Number)*new_alloc_size); @@ -206,7 +206,7 @@ namespace LinearAlgebra // If no communication pattern is given, create one. Otherwise, use the // given one. std::shared_ptr comm_pattern; - if (communication_pattern.get() == NULL) + if (communication_pattern.get() == (nullptr)) { comm_pattern.reset(new Utilities::MPI::Partitioner(vec.locally_owned_elements(), get_stored_elements(), @@ -216,7 +216,7 @@ namespace LinearAlgebra { comm_pattern = std::dynamic_pointer_cast (communication_pattern); - AssertThrow(comm_pattern != NULL, + AssertThrow(comm_pattern != nullptr, ExcMessage("The communication pattern is not of type " "Utilities::MPI::Partitioner.")); } @@ -305,7 +305,7 @@ namespace LinearAlgebra // If no communication pattern is given, create one. Otherwise, use the one // given. - if (communication_pattern == NULL) + if (communication_pattern == (nullptr)) { // The first time import is called, we create a communication pattern. // Check if the communication pattern already exists and if it can be @@ -315,7 +315,7 @@ namespace LinearAlgebra { epetra_comm_pattern = std::dynamic_pointer_cast (comm_pattern); - if (epetra_comm_pattern == NULL) + if (epetra_comm_pattern == (nullptr)) epetra_comm_pattern = std::make_shared( create_epetra_comm_pattern(source_elements, mpi_comm)); } @@ -327,7 +327,7 @@ namespace LinearAlgebra { epetra_comm_pattern = std::dynamic_pointer_cast ( communication_pattern); - AssertThrow(epetra_comm_pattern != NULL, + AssertThrow(epetra_comm_pattern != nullptr, ExcMessage(std::string("The communication pattern is not of type ") + "LinearAlgebra::EpetraWrappers::CommunicationPattern.")); } diff --git a/include/deal.II/lac/relaxation_block.h b/include/deal.II/lac/relaxation_block.h index e8f1f330dd..cb1aebfeb6 100644 --- a/include/deal.II/lac/relaxation_block.h +++ b/include/deal.II/lac/relaxation_block.h @@ -91,7 +91,7 @@ public: const typename PreconditionBlockBase::Inversion inversion = PreconditionBlockBase::gauss_jordan, const double threshold = 0., - VectorType *temp_ghost_vector = NULL); + VectorType *temp_ghost_vector = (nullptr)); /** * The mapping from indices to blocks. Each row of this pattern enumerates diff --git a/include/deal.II/lac/relaxation_block.templates.h b/include/deal.II/lac/relaxation_block.templates.h index 648f8f4894..1af48da02b 100644 --- a/include/deal.II/lac/relaxation_block.templates.h +++ b/include/deal.II/lac/relaxation_block.templates.h @@ -83,8 +83,8 @@ inline void RelaxationBlock::clear () { - A = 0; - additional_data = 0; + A = nullptr; + additional_data = nullptr; PreconditionBlockBase::clear (); } @@ -179,7 +179,7 @@ namespace internal // If the following Assertion triggers, you either set temp_ghost_vector // for a serial computation (don't!), or nobody implemented, instantiated, and // tested the parallel version for your vector type. - Assert(other==NULL, ExcNotImplemented()); + Assert(other==nullptr, ExcNotImplemented()); (void)other; return prev; } @@ -194,7 +194,7 @@ namespace internal const TrilinosWrappers::MPI::Vector &prev, TrilinosWrappers::MPI::Vector *other) { - Assert(other!=NULL, + Assert(other!=nullptr, ExcMessage("You need to provide a ghosted vector in RelaxationBlock::AdditionalData::temp_trilinos_ghost_vector.")); Assert(other->size()==prev.size(), ExcInternalError()); diff --git a/include/deal.II/lac/solver_bicgstab.h b/include/deal.II/lac/solver_bicgstab.h index 6378848ad1..2745f93ffd 100644 --- a/include/deal.II/lac/solver_bicgstab.h +++ b/include/deal.II/lac/solver_bicgstab.h @@ -296,15 +296,15 @@ SolverBicgstab::SolverBicgstab (SolverControl &cn, const AdditionalData &data) : Solver(cn), - Vx(NULL), - Vr(NULL), - Vrbar(NULL), - Vp(NULL), - Vy(NULL), - Vz(NULL), - Vt(NULL), - Vv(NULL), - Vb(NULL), + Vx((nullptr)), + Vr((nullptr)), + Vrbar((nullptr)), + Vp((nullptr)), + Vy((nullptr)), + Vz((nullptr)), + Vt((nullptr)), + Vv((nullptr)), + Vb((nullptr)), alpha(0.), beta(0.), omega(0.), diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index 5024e8e960..9faae8f510 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -327,9 +327,9 @@ SolverCG::SolverCG (SolverControl &cn, const AdditionalData &data) : Solver(cn,mem), - Vr(NULL), - Vp(NULL), - Vz(NULL), + Vr((nullptr)), + Vp((nullptr)), + Vz((nullptr)), additional_data(data) {} @@ -340,9 +340,9 @@ SolverCG::SolverCG (SolverControl &cn, const AdditionalData &data) : Solver(cn), - Vr(NULL), - Vp(NULL), - Vz(NULL), + Vr((nullptr)), + Vp((nullptr)), + Vz((nullptr)), additional_data(data) {} diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 9ae3e8b102..0bfb2d8bd9 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -541,7 +541,7 @@ namespace internal VectorMemory &vmem) : mem(vmem), - data (max_size, 0), + data (max_size, nullptr), offset(0) {} @@ -552,7 +552,7 @@ namespace internal { for (typename std::vector::iterator v = data.begin(); v != data.end(); ++v) - if (*v != 0) + if (*v != nullptr) mem.free(*v); } @@ -564,7 +564,7 @@ namespace internal Assert (i+offsetreinit(temp); @@ -877,9 +877,9 @@ SolverGMRES::solve (const MatrixType &A, // Following vectors are needed // when not the default residuals // are used as stopping criterion - VectorType *r=0; - VectorType *x_=0; - dealii::Vector *gamma_=0; + VectorType *r=nullptr; + VectorType *x_=nullptr; + dealii::Vector *gamma_=nullptr; if (!use_default_residual) { r=this->memory.alloc(); diff --git a/include/deal.II/lac/solver_minres.h b/include/deal.II/lac/solver_minres.h index 2ce525dcbc..0cde0917e7 100644 --- a/include/deal.II/lac/solver_minres.h +++ b/include/deal.II/lac/solver_minres.h @@ -169,13 +169,13 @@ SolverMinRes::SolverMinRes (SolverControl &cn, const AdditionalData &) : Solver(cn), - Vu0(NULL), - Vu1(NULL), - Vu2(NULL), - Vm0(NULL), - Vm1(NULL), - Vm2(NULL), - Vv(NULL), + Vu0((nullptr)), + Vu1((nullptr)), + Vu2((nullptr)), + Vm0((nullptr)), + Vm1((nullptr)), + Vm2((nullptr)), + Vv((nullptr)), res2(numbers::signaling_nan()) {} diff --git a/include/deal.II/lac/solver_richardson.h b/include/deal.II/lac/solver_richardson.h index 324af8b4a8..bdfe70b3f4 100644 --- a/include/deal.II/lac/solver_richardson.h +++ b/include/deal.II/lac/solver_richardson.h @@ -194,8 +194,8 @@ SolverRichardson::SolverRichardson(SolverControl &cn, const AdditionalData &data) : Solver (cn,mem), - Vr(NULL), - Vd(NULL), + Vr((nullptr)), + Vd((nullptr)), additional_data(data) {} @@ -206,8 +206,8 @@ SolverRichardson::SolverRichardson(SolverControl &cn, const AdditionalData &data) : Solver (cn), - Vr(NULL), - Vd(NULL), + Vr((nullptr)), + Vd((nullptr)), additional_data(data), res(numbers::signaling_nan()) {} diff --git a/include/deal.II/lac/sparse_decomposition.h b/include/deal.II/lac/sparse_decomposition.h index 2e9e5567c3..b22b38b063 100644 --- a/include/deal.II/lac/sparse_decomposition.h +++ b/include/deal.II/lac/sparse_decomposition.h @@ -148,7 +148,7 @@ public: AdditionalData (const double strengthen_diagonal=0, const unsigned int extra_off_diagonals=0, const bool use_previous_sparsity=false, - const SparsityPattern *use_this_sparsity=0); + const SparsityPattern *use_this_sparsity=nullptr); /** * strengthen_diag times the sum of absolute row entries is diff --git a/include/deal.II/lac/sparse_decomposition.templates.h b/include/deal.II/lac/sparse_decomposition.templates.h index 956cfed739..a4154c43f4 100644 --- a/include/deal.II/lac/sparse_decomposition.templates.h +++ b/include/deal.II/lac/sparse_decomposition.templates.h @@ -32,7 +32,7 @@ SparseLUDecomposition::SparseLUDecomposition() : SparseMatrix(), strengthen_diagonal (0), - own_sparsity(0) + own_sparsity(nullptr) {} @@ -55,7 +55,7 @@ void SparseLUDecomposition::clear() if (own_sparsity) { delete own_sparsity; - own_sparsity=0; + own_sparsity=nullptr; } } @@ -69,7 +69,7 @@ void SparseLUDecomposition::initialize ( { const SparsityPattern &matrix_sparsity=matrix.get_sparsity_pattern(); - const SparsityPattern *sparsity_pattern_to_use = 0; + const SparsityPattern *sparsity_pattern_to_use = nullptr; if (data.use_this_sparsity) sparsity_pattern_to_use = data.use_this_sparsity; diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index 50fa2456f9..ca128cafae 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -1642,7 +1642,7 @@ template inline typename SparseMatrix::size_type SparseMatrix::m () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->rows; } @@ -1651,7 +1651,7 @@ template inline typename SparseMatrix::size_type SparseMatrix::n () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->cols; } @@ -1833,8 +1833,8 @@ inline SparseMatrix & SparseMatrix::operator *= (const number factor) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); number *val_ptr = &val[0]; const number *const end_ptr = &val[cols->n_nonzero_elements()]; @@ -1852,8 +1852,8 @@ inline SparseMatrix & SparseMatrix::operator /= (const number factor) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (factor != number(), ExcDivideByZero()); const number factor_inv = number(1.) / factor; @@ -1874,7 +1874,7 @@ inline number SparseMatrix::operator () (const size_type i, const size_type j) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (cols->operator()(i,j) != SparsityPattern::invalid_entry, ExcInvalidIndex(i,j)); return val[cols->operator()(i,j)]; @@ -1887,7 +1887,7 @@ inline number SparseMatrix::el (const size_type i, const size_type j) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); const size_type index = cols->operator()(i,j); if (index != SparsityPattern::invalid_entry) @@ -1902,7 +1902,7 @@ template inline number SparseMatrix::diag_element (const size_type i) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); AssertIndexRange(i, m()); @@ -1917,7 +1917,7 @@ template inline number &SparseMatrix::diag_element (const size_type i) { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); AssertIndexRange(i, m()); @@ -2372,8 +2372,8 @@ void SparseMatrix::print (StreamType &out, const bool across, const bool diagonal_first) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); bool hanging_diagonal = false; number diagonal = number(); diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 23aa9084b6..316c5f75b2 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -47,8 +47,8 @@ DEAL_II_NAMESPACE_OPEN template SparseMatrix::SparseMatrix () : - cols(0, "SparseMatrix"), - val(0), + cols(nullptr, "SparseMatrix"), + val(nullptr), max_len(0) {} @@ -58,11 +58,11 @@ template SparseMatrix::SparseMatrix (const SparseMatrix &m) : Subscriptor (m), - cols(0, "SparseMatrix"), - val(0), + cols(nullptr, "SparseMatrix"), + val(nullptr), max_len(0) { - Assert (m.cols==0 && m.val==0 && m.max_len==0, + Assert (m.cols==nullptr && m.val==nullptr && m.max_len==0, ExcMessage("This constructor can only be called if the provided argument " "is an empty matrix. This constructor can not be used to " "copy-construct a non-empty matrix. Use the " @@ -93,7 +93,7 @@ SparseMatrix & SparseMatrix::operator = (const SparseMatrix &m) { (void)m; - Assert (m.cols==0 && m.val==0 && m.max_len==0, + Assert (m.cols==nullptr && m.val==nullptr && m.max_len==0, ExcMessage("This operator can only be called if the provided right " "hand side is an empty matrix. This operator can not be " "used to copy a non-empty matrix. Use the " @@ -126,8 +126,8 @@ SparseMatrix::operator = (SparseMatrix &&m) template SparseMatrix::SparseMatrix (const SparsityPattern &c) : - cols(0, "SparseMatrix"), - val(0), + cols(nullptr, "SparseMatrix"), + val(nullptr), max_len(0) { reinit (c); @@ -139,8 +139,8 @@ template SparseMatrix::SparseMatrix (const SparsityPattern &c, const IdentityMatrix &id) : - cols(0, "SparseMatrix"), - val(0), + cols(nullptr, "SparseMatrix"), + val(nullptr), max_len(0) { (void)id; @@ -157,9 +157,9 @@ SparseMatrix::SparseMatrix (const SparsityPattern &c, template SparseMatrix::~SparseMatrix () { - cols = 0; + cols = nullptr; - if (val != 0) + if (val != nullptr) delete[] val; } @@ -190,7 +190,7 @@ SparseMatrix::operator = (const double d) (void)d; Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (cols->compressed || cols->empty(), SparsityPattern::ExcNotCompressed()); // do initial zeroing of elements in parallel. Try to achieve a similar @@ -246,9 +246,9 @@ SparseMatrix::reinit (const SparsityPattern &sparsity) if (cols->empty()) { - if (val != 0) + if (val != nullptr) delete[] val; - val = 0; + val = nullptr; max_len = 0; return; } @@ -256,7 +256,7 @@ SparseMatrix::reinit (const SparsityPattern &sparsity) const std::size_t N = cols->n_nonzero_elements(); if (N > max_len || max_len == 0) { - if (val != 0) + if (val != nullptr) delete[] val; val = new number[N]; max_len = N; @@ -271,9 +271,9 @@ template void SparseMatrix::clear () { - cols = 0; + cols = nullptr; if (val) delete[] val; - val = 0; + val = nullptr; max_len = 0; } @@ -283,7 +283,7 @@ template bool SparseMatrix::empty () const { - if (cols == 0) + if (cols == nullptr) return true; else return cols->empty(); @@ -295,7 +295,7 @@ template typename SparseMatrix::size_type SparseMatrix::get_row_length (const size_type row) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->row_length(row); } @@ -305,7 +305,7 @@ template std::size_t SparseMatrix::n_nonzero_elements () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return cols->n_nonzero_elements (); } @@ -315,7 +315,7 @@ template std::size_t SparseMatrix::n_actually_nonzero_elements (const double threshold) const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (threshold >= 0, ExcMessage ("Negative threshold!")); size_type nnz = 0; const std::size_t nnz_alloc = n_nonzero_elements(); @@ -331,7 +331,7 @@ template void SparseMatrix::symmetrize () { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert (cols->rows == cols->cols, ExcNotQuadratic()); const size_type n_rows = m(); @@ -371,8 +371,8 @@ template SparseMatrix & SparseMatrix::copy_from (const SparseMatrix &matrix) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (cols == matrix.cols, ExcDifferentSparsityPatterns()); std::copy (&matrix.val[0], &matrix.val[cols->n_nonzero_elements()], @@ -453,8 +453,8 @@ void SparseMatrix::add (const number factor, const SparseMatrix &matrix) { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert (cols == matrix.cols, ExcDifferentSparsityPatterns()); number *val_ptr = &val[0]; @@ -528,7 +528,7 @@ SparseMatrix::add (const size_type row, const bool elide_zero_values, const bool col_indices_are_sorted) { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); // if we have sufficiently many columns // and sorted indices it is faster to @@ -677,7 +677,7 @@ SparseMatrix::set (const size_type row, const number2 *values, const bool elide_zero_values) { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); AssertIndexRange(row, m()); // First, search all the indices to find @@ -757,8 +757,8 @@ void SparseMatrix::vmult (OutVector &dst, const InVector &src) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -785,8 +785,8 @@ void SparseMatrix::Tvmult (OutVector &dst, const InVector &src) const { - Assert (val != 0, ExcNotInitialized()); - Assert (cols != 0, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert(n() == dst.size(), ExcDimensionMismatch(n(),dst.size())); Assert(m() == src.size(), ExcDimensionMismatch(m(),src.size())); @@ -812,8 +812,8 @@ void SparseMatrix::vmult_add (OutVector &dst, const InVector &src) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); @@ -840,8 +840,8 @@ void SparseMatrix::Tvmult_add (OutVector &dst, const InVector &src) const { - Assert (val != 0, ExcNotInitialized()); - Assert (cols != 0, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); Assert(n() == dst.size(), ExcDimensionMismatch(n(),dst.size())); Assert(m() == src.size(), ExcDimensionMismatch(m(),src.size())); @@ -899,8 +899,8 @@ template somenumber SparseMatrix::matrix_norm_square (const Vector &v) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); @@ -962,8 +962,8 @@ somenumber SparseMatrix::matrix_scalar_product (const Vector &u, const Vector &v) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == u.size(), ExcDimensionMismatch(m(),u.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); @@ -991,9 +991,9 @@ SparseMatrix::mmult (SparseMatrix &C, { const bool use_vector = V.size() == n() ? true : false; Assert (n() == B.m(), ExcDimensionMismatch(n(), B.m())); - Assert (cols != 0, ExcNotInitialized()); - Assert (B.cols != 0, ExcNotInitialized()); - Assert (C.cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (B.cols != nullptr, ExcNotInitialized()); + Assert (C.cols != nullptr, ExcNotInitialized()); const SparsityPattern &sp_A = *cols; const SparsityPattern &sp_B = *B.cols; @@ -1118,9 +1118,9 @@ SparseMatrix::Tmmult (SparseMatrix &C, { const bool use_vector = V.size() == m() ? true : false; Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m())); - Assert (cols != 0, ExcNotInitialized()); - Assert (B.cols != 0, ExcNotInitialized()); - Assert (C.cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (B.cols != nullptr, ExcNotInitialized()); + Assert (C.cols != nullptr, ExcNotInitialized()); const SparsityPattern &sp_A = *cols; const SparsityPattern &sp_B = *B.cols; @@ -1241,8 +1241,8 @@ template typename SparseMatrix::real_type SparseMatrix::l1_norm () const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Vector column_sums(n()); const size_type n_rows = m(); @@ -1259,8 +1259,8 @@ template typename SparseMatrix::real_type SparseMatrix::linfty_norm () const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); const number *val_ptr = &val[cols->rowstart[0]]; @@ -1346,8 +1346,8 @@ SparseMatrix::residual (Vector &dst, const Vector &u, const Vector &b) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(m() == b.size(), ExcDimensionMismatch(m(),b.size())); Assert(n() == u.size(), ExcDimensionMismatch(n(),u.size())); @@ -1406,8 +1406,8 @@ SparseMatrix::precondition_Jacobi (Vector &dst, const Vector &src, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); @@ -1452,8 +1452,8 @@ SparseMatrix::precondition_SSOR (Vector &dst, // you may want to take a look at the CVS // archives to see the original version // which is much clearer... - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); @@ -1576,8 +1576,8 @@ SparseMatrix::precondition_SOR (Vector &dst, const Vector &src, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); dst = src; SOR(dst,om); @@ -1591,8 +1591,8 @@ SparseMatrix::precondition_TSOR (Vector &dst, const Vector &src, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); dst = src; TSOR(dst,om); @@ -1605,8 +1605,8 @@ void SparseMatrix::SOR (Vector &dst, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); AssertDimension (dst.size(), n()); @@ -1633,8 +1633,8 @@ void SparseMatrix::TSOR (Vector &dst, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); AssertDimension (dst.size(), n()); @@ -1666,8 +1666,8 @@ SparseMatrix::PSOR (Vector &dst, const std::vector &inverse_permutation, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1705,8 +1705,8 @@ SparseMatrix::TPSOR (Vector &dst, const std::vector &inverse_permutation, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1742,8 +1742,8 @@ SparseMatrix::Jacobi_step (Vector &v, const Vector &b, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); @@ -1773,8 +1773,8 @@ SparseMatrix::SOR_step (Vector &v, const Vector &b, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert (m() == b.size(), ExcDimensionMismatch(m(),b.size())); @@ -1801,8 +1801,8 @@ SparseMatrix::TSOR_step (Vector &v, const Vector &b, const number om) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert (m() == b.size(), ExcDimensionMismatch(m(),b.size())); @@ -1844,8 +1844,8 @@ SparseMatrix::SSOR (Vector &dst, //TODO: Is this called anywhere? If so, multiplication with om(2-om)D is missing Assert(false, ExcNotImplemented()); - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); AssertDimension (m(), n()); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); @@ -1893,7 +1893,7 @@ template const SparsityPattern & SparseMatrix::get_sparsity_pattern () const { - Assert (cols != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); return *cols; } @@ -1907,8 +1907,8 @@ void SparseMatrix::print_formatted (std::ostream &out, const char *zero_string, const double denominator) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); unsigned int width = width_; @@ -1951,8 +1951,8 @@ template void SparseMatrix::print_pattern (std::ostream &out, const double threshold) const { - Assert (cols != 0, ExcNotInitialized()); - Assert (val != 0, ExcNotInitialized()); + Assert (cols != nullptr, ExcNotInitialized()); + Assert (val != nullptr, ExcNotInitialized()); for (size_type i=0; i::locate (const size_type row, if (entry->column == col) return entry; if (entry->column == Entry::invalid) - return 0; + return nullptr; } - return 0; + return nullptr; } @@ -1231,7 +1231,7 @@ void SparseMatrixEZ::set (const size_type i, if (elide_zero_values && value == 0.) { Entry *entry = locate(i,j); - if (entry != 0) + if (entry != nullptr) entry->value = 0.; } else diff --git a/include/deal.II/lac/sparse_vanka.h b/include/deal.II/lac/sparse_vanka.h index 0b4319b2c7..73f813b2fb 100644 --- a/include/deal.II/lac/sparse_vanka.h +++ b/include/deal.II/lac/sparse_vanka.h @@ -282,7 +282,7 @@ protected: template void apply_preconditioner (Vector &dst, const Vector &src, - const std::vector *const dof_mask = 0) const; + const std::vector *const dof_mask = nullptr) const; /** * Determine an estimate for the memory consumption (in bytes) of this diff --git a/include/deal.II/lac/sparse_vanka.templates.h b/include/deal.II/lac/sparse_vanka.templates.h index 254b6934e2..31da7a5cc0 100644 --- a/include/deal.II/lac/sparse_vanka.templates.h +++ b/include/deal.II/lac/sparse_vanka.templates.h @@ -53,7 +53,7 @@ SparseVanka::SparseVanka(const SparseMatrix &M, conserve_mem (conserve_mem), selected (&selected_dofs), n_threads (n_threads), - inverses (M.m(), 0), + inverses (M.m(), nullptr), _m (M.m()), _n (M.n()) { @@ -72,8 +72,8 @@ SparseVanka::~SparseVanka() for (i=inverses.begin(); i!=inverses.end(); ++i) { FullMatrix *p = *i; - *i = 0; - if (p != 0) delete p; + *i = nullptr; + if (p != nullptr) delete p; } } @@ -102,8 +102,8 @@ template void SparseVanka::compute_inverses () { - Assert(matrix != 0, ExcNotInitialized()); - Assert(selected != 0, ExcNotInitialized()); + Assert(matrix != nullptr, ExcNotInitialized()); + Assert(selected != nullptr, ExcNotInitialized()); #ifndef DEAL_II_WITH_THREADS compute_inverses (0, matrix->m()); @@ -191,8 +191,8 @@ void SparseVanka::compute_inverse (const size_type row, std::vector &local_indices) { - Assert(matrix != 0, ExcNotInitialized()); - Assert(selected != 0, ExcNotInitialized()); + Assert(matrix != nullptr, ExcNotInitialized()); + Assert(selected != nullptr, ExcNotInitialized()); // first define an alias to the sparsity // pattern of the matrix, since this @@ -226,8 +226,8 @@ void SparseVanka::vmult (Vector &dst, const Vector &src) const { - Assert(matrix != 0, ExcNotInitialized()); - Assert(selected != 0, ExcNotInitialized()); + Assert(matrix != nullptr, ExcNotInitialized()); + Assert(selected != nullptr, ExcNotInitialized()); // first set output vector to zero dst = 0; @@ -261,7 +261,7 @@ SparseVanka::apply_preconditioner (Vector &dst, // blocks. this variable is used to // optimize access to vectors a // little bit. - const bool range_is_restricted = (dof_mask != 0); + const bool range_is_restricted = (dof_mask != nullptr); // space to be used for local // systems. allocate as much memory @@ -389,7 +389,7 @@ SparseVanka::apply_preconditioner (Vector &dst, // inverses, then unalias the // local matrix if (conserve_mem == true) - inverses[row] = 0; + inverses[row] = nullptr; } } diff --git a/include/deal.II/lac/sparsity_pattern.h b/include/deal.II/lac/sparsity_pattern.h index 2db0dd3009..f8d9b29aeb 100644 --- a/include/deal.II/lac/sparsity_pattern.h +++ b/include/deal.II/lac/sparsity_pattern.h @@ -1397,7 +1397,7 @@ inline std::size_t SparsityPattern::n_nonzero_elements () const { - Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); + Assert ((rowstart!=nullptr) && (colnums!=nullptr), ExcEmptyObject()); Assert (compressed, ExcNotCompressed()); return rowstart[rows]-rowstart[0]; } @@ -1430,11 +1430,11 @@ SparsityPattern::load (Archive &ar, const unsigned int) ar &max_dim &rows &cols &max_vec_len &max_row_length &compressed &store_diagonal_first_in_row; - if (rowstart != 0) + if (rowstart != nullptr) delete[] rowstart; rowstart = new std::size_t[max_dim + 1]; - if (colnums != 0) + if (colnums != nullptr) delete[] colnums; colnums = new size_type[max_vec_len]; diff --git a/include/deal.II/lac/trilinos_precondition.h b/include/deal.II/lac/trilinos_precondition.h index d6b70df82a..f3ff0283a2 100644 --- a/include/deal.II/lac/trilinos_precondition.h +++ b/include/deal.II/lac/trilinos_precondition.h @@ -1574,7 +1574,7 @@ namespace TrilinosWrappers void initialize (const ::dealii::SparseMatrix &deal_ii_sparse_matrix, const AdditionalData &additional_data = AdditionalData(), const double drop_tolerance = 1e-13, - const ::dealii::SparsityPattern *use_this_sparsity = 0); + const ::dealii::SparsityPattern *use_this_sparsity = nullptr); /** * This function can be used for a faster recalculation of the @@ -1823,7 +1823,7 @@ namespace TrilinosWrappers void initialize (const ::dealii::SparseMatrix &deal_ii_sparse_matrix, const AdditionalData &additional_data = AdditionalData(), const double drop_tolerance = 1e-13, - const ::dealii::SparsityPattern *use_this_sparsity = 0); + const ::dealii::SparsityPattern *use_this_sparsity = nullptr); /** * Destroys the preconditioner, leaving an object like just after having diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 51e9162848..15c53e6f60 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -640,7 +640,7 @@ namespace TrilinosWrappers void reinit (const ::dealii::SparseMatrix &dealii_sparse_matrix, const double drop_tolerance=1e-13, const bool copy_values=true, - const ::dealii::SparsityPattern *use_this_sparsity=0); + const ::dealii::SparsityPattern *use_this_sparsity=nullptr); /** * This reinit function takes as input a Trilinos Epetra_CrsMatrix and @@ -799,7 +799,7 @@ namespace TrilinosWrappers const ::dealii::SparseMatrix &dealii_sparse_matrix, const double drop_tolerance=1e-13, const bool copy_values=true, - const ::dealii::SparsityPattern *use_this_sparsity=0) DEAL_II_DEPRECATED; + const ::dealii::SparsityPattern *use_this_sparsity=nullptr) DEAL_II_DEPRECATED; /** * This function is similar to the other initialization function with @@ -822,7 +822,7 @@ namespace TrilinosWrappers const ::dealii::SparseMatrix &dealii_sparse_matrix, const double drop_tolerance=1e-13, const bool copy_values=true, - const ::dealii::SparsityPattern *use_this_sparsity=0) DEAL_II_DEPRECATED; + const ::dealii::SparsityPattern *use_this_sparsity=nullptr) DEAL_II_DEPRECATED; //@} /** * @name Constructors and initialization using an IndexSet description @@ -960,7 +960,7 @@ namespace TrilinosWrappers const MPI_Comm &communicator = MPI_COMM_WORLD, const double drop_tolerance=1e-13, const bool copy_values=true, - const ::dealii::SparsityPattern *use_this_sparsity=0); + const ::dealii::SparsityPattern *use_this_sparsity=nullptr); /** * This function is similar to the other initialization function with @@ -982,7 +982,7 @@ namespace TrilinosWrappers const MPI_Comm &communicator = MPI_COMM_WORLD, const double drop_tolerance=1e-13, const bool copy_values=true, - const ::dealii::SparsityPattern *use_this_sparsity=0); + const ::dealii::SparsityPattern *use_this_sparsity=nullptr); //@} /** * @name Information on the matrix @@ -3040,7 +3040,7 @@ namespace TrilinosWrappers // If the matrix structure has not been fixed (i.e., we did not have a // sparsity pattern), it does not know about the number of columns so we // must always take this from the additional column space map - Assert(column_space_map.get() != 0, ExcInternalError()); + Assert(column_space_map.get() != nullptr, ExcInternalError()); #ifndef DEAL_II_WITH_64BIT_INDICES return column_space_map->NumGlobalElements(); #else diff --git a/include/deal.II/lac/trilinos_sparsity_pattern.h b/include/deal.II/lac/trilinos_sparsity_pattern.h index 5230b2e743..f37f9b477f 100644 --- a/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -1454,7 +1454,7 @@ namespace TrilinosWrappers int ierr; if ( graph->RowMap().LID(static_cast(row)) != -1) ierr = graph->InsertGlobalIndices (row, n_cols, col_index_ptr); - else if (nonlocal_graph.get() != 0) + else if (nonlocal_graph.get() != nullptr) { // this is the case when we have explicitly set the off-processor rows // and want to create a separate matrix object for them (to retain diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index c60cec7aed..fa99de015a 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -684,7 +684,7 @@ namespace TrilinosWrappers void Vector::reinit (const Epetra_Map ¶llel_partitioner, const dealii::Vector &v) { - if (vector.get() == 0 || vector->Map().SameAs(parallel_partitioner) == false) + if (vector.get() == nullptr || vector->Map().SameAs(parallel_partitioner) == false) reinit(parallel_partitioner); const int size = parallel_partitioner.NumMyElements(); diff --git a/include/deal.II/lac/trilinos_vector_base.h b/include/deal.II/lac/trilinos_vector_base.h index d0472a32e0..082c69a93f 100644 --- a/include/deal.II/lac/trilinos_vector_base.h +++ b/include/deal.II/lac/trilinos_vector_base.h @@ -832,7 +832,7 @@ namespace TrilinosWrappers * * This function is deprecated. */ - void print (const char *format = 0) const DEAL_II_DEPRECATED; + void print (const char *format = nullptr) const DEAL_II_DEPRECATED; /** * Print to a stream. @p precision denotes the desired precision with @@ -1203,14 +1203,14 @@ namespace TrilinosWrappers VectorBase::reinit (const VectorBase &v, const bool omit_zeroing_entries) { - Assert (vector.get() != 0, + Assert (vector.get() != nullptr, ExcMessage("Vector has not been constructed properly.")); if (omit_zeroing_entries == false || vector_partitioner().SameAs(v.vector_partitioner())==false) vector.reset (new Epetra_FEVector(*v.vector)); - if (v.nonlocal_vector.get() != 0) + if (v.nonlocal_vector.get() != nullptr) nonlocal_vector.reset(new Epetra_MultiVector(v.nonlocal_vector->Map(), 1)); owned_elements = v.owned_elements; @@ -1227,7 +1227,7 @@ namespace TrilinosWrappers int ierr = vector->PutScalar(s); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); - if (nonlocal_vector.get() != 0) + if (nonlocal_vector.get() != nullptr) { ierr = nonlocal_vector->PutScalar(0.); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -1373,7 +1373,7 @@ namespace TrilinosWrappers const TrilinosWrappers::types::int_type local_row = vector->Map().LID(static_cast(row)); if (local_row != -1) (*vector)[0][local_row] += values[i]; - else if (nonlocal_vector.get() == 0) + else if (nonlocal_vector.get() == nullptr) { const int ierr = vector->SumIntoGlobalValues (1, (const TrilinosWrappers::types::int_type *)(&row), diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 6798ecc460..d5bf2b678c 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -864,7 +864,7 @@ public: * * This function is deprecated. */ - void print (const char *format = 0) const DEAL_II_DEPRECATED; + void print (const char *format = nullptr) const DEAL_II_DEPRECATED; /** * Print to a stream. @p precision denotes the desired precision with which @@ -1073,7 +1073,7 @@ Vector::Vector () : vec_size(0), max_vec_size(0), - val(0) + val(nullptr) { reinit(0); } @@ -1086,7 +1086,7 @@ Vector::Vector (const InputIterator first, const InputIterator last) : vec_size (0), max_vec_size (0), - val (0) + val (nullptr) { // allocate memory. do not initialize it, as we will copy over to it in a // second @@ -1102,7 +1102,7 @@ Vector::Vector (const size_type n) : vec_size(0), max_vec_size(0), - val(0) + val(nullptr) { reinit (n, false); } @@ -1116,7 +1116,7 @@ Vector::~Vector () if (val) { deallocate(); - val=0; + val=nullptr; } } diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index 08ec9c3a41..674404dcbf 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -48,7 +48,7 @@ Vector::Vector (const Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(0) + val(nullptr) { if (vec_size != 0) { @@ -85,7 +85,7 @@ Vector::Vector (const Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(0) + val(nullptr) { if (vec_size != 0) { @@ -104,7 +104,7 @@ Vector::Vector (const PETScWrappers::Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(0) + val(nullptr) { if (vec_size != 0) { @@ -133,7 +133,7 @@ Vector::Vector (const PETScWrappers::MPI::Vector &v) Subscriptor(), vec_size(0), max_vec_size(0), - val(0) + val(nullptr) { if (v.size() != 0) { @@ -156,7 +156,7 @@ Vector::Vector (const TrilinosWrappers::MPI::Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(0) + val(nullptr) { if (vec_size != 0) { @@ -189,7 +189,7 @@ Vector::Vector (const TrilinosWrappers::Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(0) + val(nullptr) { if (vec_size != 0) { @@ -280,7 +280,7 @@ void Vector::reinit (const size_type n, if (n==0) { if (val) deallocate(); - val = 0; + val = nullptr; max_vec_size = vec_size = 0; thread_loop_partitioner.reset(new parallel::internal::TBBPartitioner()); return; @@ -319,7 +319,7 @@ void Vector::reinit (const Vector &v, if (v.vec_size==0) { if (val) deallocate(); - val = 0; + val = nullptr; max_vec_size = vec_size = 0; return; }; @@ -1123,7 +1123,7 @@ void Vector::allocate() { // make sure that we don't create a memory leak - Assert (val == 0, ExcInternalError()); + Assert (val == nullptr, ExcInternalError()); // then allocate memory with the proper alignment requirements of 64 bytes Utilities::System::posix_memalign ((void **)&val, 64, sizeof(Number)*max_vec_size); @@ -1136,7 +1136,7 @@ void Vector::deallocate() { free(val); - val = 0; + val = nullptr; } DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/vector_memory.h b/include/deal.II/lac/vector_memory.h index 8158043b28..f899c237d9 100644 --- a/include/deal.II/lac/vector_memory.h +++ b/include/deal.II/lac/vector_memory.h @@ -368,7 +368,7 @@ template inline VectorMemory::Pointer::Pointer(VectorMemory &mem) : - pool(&mem, typeid(*this).name()), v(0) + pool(&mem, typeid(*this).name()), v(nullptr) { v = pool->alloc(); } diff --git a/include/deal.II/lac/vector_memory.templates.h b/include/deal.II/lac/vector_memory.templates.h index 85d433a132..03a2a043de 100644 --- a/include/deal.II/lac/vector_memory.templates.h +++ b/include/deal.II/lac/vector_memory.templates.h @@ -32,7 +32,7 @@ template inline GrowingVectorMemory::Pool::Pool() : - data(0) + data(nullptr) {} @@ -42,7 +42,7 @@ inline GrowingVectorMemory::Pool::~Pool() { // Nothing to do if memory was unused. - if (data == 0) return; + if (data == nullptr) return; // First, delete all remaining // vectors. Actually, there should @@ -63,7 +63,7 @@ inline void GrowingVectorMemory::Pool::initialize(const size_type size) { - if (data == 0) + if (data == nullptr) { data = new std::vector(size); @@ -170,7 +170,7 @@ GrowingVectorMemory::release_unused_memory () std::vector new_data; - if (pool.data != 0) + if (pool.data != nullptr) { const typename std::vector::const_iterator end = pool.data->end(); diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 08370b0db8..d603841a98 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -54,7 +54,7 @@ namespace internal void print (const T &t, const char *format) { - if (format != 0) + if (format != nullptr) std::printf (format, t); else std::printf (" %5.2f", double(t)); @@ -66,7 +66,7 @@ namespace internal void print (const std::complex &t, const char *format) { - if (format != 0) + if (format != nullptr) std::printf (format, t.real(), t.imag()); else std::printf (" %5.2f+%5.2fi", @@ -170,7 +170,7 @@ namespace internal if (vec_size >= 4*internal::Vector::minimum_parallel_grain_size && MultithreadInfo::n_threads() > 1) { - Assert(partitioner.get() != NULL, + Assert(partitioner.get() != nullptr, ExcInternalError("Unexpected initialization of Vector that does " "not set the TBB partitioner to a usable state.")); std::shared_ptr tbb_partitioner = @@ -1264,7 +1264,7 @@ namespace internal if (vec_size >= 4*internal::Vector::minimum_parallel_grain_size && MultithreadInfo::n_threads() > 1) { - Assert(partitioner.get() != NULL, + Assert(partitioner.get() != nullptr, ExcInternalError("Unexpected initialization of Vector that does " "not set the TBB partitioner to a usable state.")); std::shared_ptr tbb_partitioner = diff --git a/include/deal.II/lac/vector_view.h b/include/deal.II/lac/vector_view.h index 485e130fc3..4095238c78 100644 --- a/include/deal.II/lac/vector_view.h +++ b/include/deal.II/lac/vector_view.h @@ -262,7 +262,7 @@ VectorView::~VectorView() // memory it doesn't own this->vec_size = 0; this->max_vec_size = 0; - this->val = 0; + this->val = nullptr; } diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index 0ce8303d50..5ee5d962c1 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -432,7 +432,7 @@ namespace internal AssertIndexRange (row, row_starts.size()-1); const unsigned int index = row_starts[row][0]; AssertIndexRange(index, dof_indices.size()+1); - return dof_indices.empty() ? 0 : &dof_indices[0] + index; + return dof_indices.empty() ? nullptr : &dof_indices[0] + index; } @@ -444,7 +444,7 @@ namespace internal AssertIndexRange (row, row_starts.size()-1); const unsigned int index = row_starts[row+1][0]; AssertIndexRange(index, dof_indices.size()+1); - return dof_indices.empty() ? 0 : &dof_indices[0] + index; + return dof_indices.empty() ? nullptr : &dof_indices[0] + index; } @@ -466,7 +466,7 @@ namespace internal AssertIndexRange (row, row_starts.size()-1); const unsigned int index = row_starts[row][1]; AssertIndexRange (index, constraint_indicator.size()+1); - return constraint_indicator.empty() ? 0 : &constraint_indicator[0] + index; + return constraint_indicator.empty() ? nullptr : &constraint_indicator[0] + index; } @@ -478,7 +478,7 @@ namespace internal AssertIndexRange (row, row_starts.size()-1); const unsigned int index = row_starts[row+1][1]; AssertIndexRange (index, constraint_indicator.size()+1); - return constraint_indicator.empty() ? 0 : &constraint_indicator[0] + index; + return constraint_indicator.empty() ? nullptr : &constraint_indicator[0] + index; } @@ -509,7 +509,7 @@ namespace internal AssertDimension (row_starts.size(), row_starts_plain_indices.size()); const unsigned int index = row_starts_plain_indices[row]; AssertIndexRange(index, plain_dof_indices.size()+1); - return plain_dof_indices.empty() ? 0 : &plain_dof_indices[0] + index; + return plain_dof_indices.empty() ? nullptr : &plain_dof_indices[0] + index; } } diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index b1abd0d1c0..7c49f391a9 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -182,7 +182,7 @@ namespace internal ConstraintValues &constraint_values, bool &cell_at_boundary) { - Assert (vector_partitioner.get() !=0, ExcInternalError()); + Assert (vector_partitioner.get() !=nullptr, ExcInternalError()); const unsigned int n_mpi_procs = vector_partitioner->n_mpi_processes(); const types::global_dof_index first_owned = vector_partitioner->local_range().first; const types::global_dof_index last_owned = vector_partitioner->local_range().second; @@ -203,7 +203,7 @@ namespace internal constraints.get_constraint_entries(current_dof); // dof is constrained - if (entries_ptr != 0) + if (entries_ptr != nullptr) { // in case we want to access plain indices, we need to know // about the location of constrained indices as well (all the diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index b31663bdda..78a21d23b0 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -2151,14 +2151,14 @@ FEEvaluationBase data (&data_in.get_shape_info (fe_no_in, quad_no_in, active_fe_index, active_quad_index)), - cartesian_data (0), - jacobian (0), - J_value (0), + cartesian_data (nullptr), + jacobian (nullptr), + J_value (nullptr), quadrature_weights (mapping_info->mapping_data_gen[quad_no]. quadrature_weights[active_quad_index].begin()), - quadrature_points (0), - jacobian_grad (0), - jacobian_grad_upper(0), + quadrature_points (nullptr), + jacobian_grad (nullptr), + jacobian_grad_upper(nullptr), cell (numbers::invalid_unsigned_int), cell_type (internal::MatrixFreeFunctions::undefined), cell_data_number (numbers::invalid_unsigned_int), @@ -2209,18 +2209,18 @@ FEEvaluationBase n_fe_components (n_components_), active_fe_index (numbers::invalid_unsigned_int), active_quad_index (numbers::invalid_unsigned_int), - matrix_info (0), - dof_info (0), - mapping_info (0), + matrix_info (nullptr), + dof_info (nullptr), + mapping_info (nullptr), // select the correct base element from the given FE component data (new internal::MatrixFreeFunctions::ShapeInfo(quadrature, fe, fe.component_to_base_index(first_selected_component).first)), - cartesian_data (0), - jacobian (0), - J_value (0), - quadrature_weights (0), - quadrature_points (0), - jacobian_grad (0), - jacobian_grad_upper(0), + cartesian_data (nullptr), + jacobian (nullptr), + J_value (nullptr), + quadrature_weights (nullptr), + quadrature_points (nullptr), + jacobian_grad (nullptr), + jacobian_grad_upper(nullptr), cell (0), cell_type (internal::MatrixFreeFunctions::general), cell_data_number (numbers::invalid_unsigned_int), @@ -2238,8 +2238,8 @@ FEEvaluationBase fe.component_to_base_index(first_selected_component).first; set_data_pointers(); - Assert(other == 0 || other->mapped_geometry.get() != 0, ExcInternalError()); - if (other != 0 && + Assert(other == nullptr || other->mapped_geometry.get() != nullptr, ExcInternalError()); + if (other != nullptr && other->mapped_geometry->get_quadrature() == quadrature) mapped_geometry = other->mapped_geometry; else @@ -2264,7 +2264,7 @@ inline FEEvaluationBase ::FEEvaluationBase (const FEEvaluationBase &other) : - scratch_data_array (other.matrix_info == 0 ? + scratch_data_array (other.matrix_info == nullptr ? new AlignedVector >() : other.matrix_info->acquire_scratch_data()), quad_no (other.quad_no), @@ -2274,20 +2274,20 @@ FEEvaluationBase matrix_info (other.matrix_info), dof_info (other.dof_info), mapping_info (other.mapping_info), - data (other.matrix_info == 0 ? + data (other.matrix_info == nullptr ? new internal::MatrixFreeFunctions::ShapeInfo(*other.data) : other.data), - cartesian_data (0), - jacobian (0), - J_value (0), - quadrature_weights (mapping_info != 0 ? + cartesian_data (nullptr), + jacobian (nullptr), + J_value (nullptr), + quadrature_weights (mapping_info != nullptr ? mapping_info->mapping_data_gen[quad_no]. quadrature_weights[active_quad_index].begin() : - 0), - quadrature_points (0), - jacobian_grad (0), - jacobian_grad_upper(0), + nullptr), + quadrature_points (nullptr), + jacobian_grad (nullptr), + jacobian_grad_upper(nullptr), cell (numbers::invalid_unsigned_int), cell_type (internal::MatrixFreeFunctions::general), cell_data_number (numbers::invalid_unsigned_int), @@ -2302,7 +2302,7 @@ FEEvaluationBase set_data_pointers(); // Create deep copy of mapped geometry for use in parallel... - if (other.mapped_geometry.get() != 0) + if (other.mapped_geometry.get() != nullptr) { mapped_geometry.reset (new internal::MatrixFreeFunctions:: @@ -2331,7 +2331,7 @@ FEEvaluationBase AssertDimension(first_selected_component, other.first_selected_component); // release old memory - if (matrix_info == 0) + if (matrix_info == nullptr) { delete data; delete scratch_data_array; @@ -2344,7 +2344,7 @@ FEEvaluationBase matrix_info = other.matrix_info; dof_info = other.dof_info; mapping_info = other.mapping_info; - if (other.matrix_info == 0) + if (other.matrix_info == nullptr) { data = new internal::MatrixFreeFunctions::ShapeInfo(*other.data); scratch_data_array = new AlignedVector >(); @@ -2356,23 +2356,23 @@ FEEvaluationBase } set_data_pointers(); - cartesian_data = 0; - jacobian = 0; - J_value = 0; - quadrature_weights = mapping_info != 0 ? + cartesian_data = nullptr; + jacobian = nullptr; + J_value = nullptr; + quadrature_weights = mapping_info != nullptr ? mapping_info->mapping_data_gen[quad_no]. quadrature_weights[active_quad_index].begin() : - 0; - quadrature_points = 0; - jacobian_grad = 0; - jacobian_grad_upper = 0; + nullptr; + quadrature_points = nullptr; + jacobian_grad = nullptr; + jacobian_grad_upper = nullptr; cell = numbers::invalid_unsigned_int; cell_type = internal::MatrixFreeFunctions::general; cell_data_number = numbers::invalid_unsigned_int; // Create deep copy of mapped geometry for use in parallel... - if (other.mapped_geometry.get() != 0) + if (other.mapped_geometry.get() != nullptr) { mapped_geometry.reset (new internal::MatrixFreeFunctions:: @@ -2394,7 +2394,7 @@ template inline FEEvaluationBase::~FEEvaluationBase () { - if (matrix_info != 0) + if (matrix_info != nullptr) { try { @@ -2418,7 +2418,7 @@ void FEEvaluationBase ::set_data_pointers() { - Assert(scratch_data_array != NULL, ExcInternalError()); + Assert(scratch_data_array != nullptr, ExcInternalError()); const unsigned int tensor_dofs_per_cell = Utilities::fixed_power(this->data->fe_degree+1); @@ -2457,13 +2457,13 @@ inline void FEEvaluationBase::reinit (const unsigned int cell_in) { - Assert (mapped_geometry == 0, + Assert (mapped_geometry == nullptr, ExcMessage("FEEvaluation was initialized without a matrix-free object." " Integer indexing is not possible")); - if (mapped_geometry != 0) + if (mapped_geometry != nullptr) return; - Assert (dof_info != 0, ExcNotInitialized()); - Assert (mapping_info != 0, ExcNotInitialized()); + Assert (dof_info != nullptr, ExcNotInitialized()); + Assert (mapping_info != nullptr, ExcNotInitialized()); AssertIndexRange (cell_in, dof_info->row_starts.size()-1); AssertDimension (((dof_info->cell_active_fe_index.size() > 0) ? dof_info->cell_active_fe_index[cell_in] : 0), @@ -2539,12 +2539,12 @@ void FEEvaluationBase ::reinit (const TriaIterator > &cell) { - Assert(matrix_info == 0, + Assert(matrix_info == nullptr, ExcMessage("Cannot use initialization from cell iterator if " "initialized from MatrixFree object. Use variant for " "on the fly computation with arguments as for FEValues " "instead")); - Assert(mapped_geometry.get() != 0, ExcNotInitialized()); + Assert(mapped_geometry.get() != nullptr, ExcNotInitialized()); mapped_geometry->reinit(static_cast::cell_iterator>(cell)); local_dof_indices.resize(cell->get_fe().dofs_per_cell); if (level_dof_access) @@ -2600,7 +2600,7 @@ inline const internal::MatrixFreeFunctions::ShapeInfo & FEEvaluationBase::get_shape_info() const { - Assert(data != 0, ExcInternalError()); + Assert(data != nullptr, ExcInternalError()); return *data; } @@ -2613,11 +2613,11 @@ FEEvaluationBase ::fill_JxW_values(AlignedVector > &JxW_values) const { AssertDimension(JxW_values.size(), data->n_q_points); - Assert (this->J_value != 0, ExcNotInitialized()); + Assert (this->J_value != nullptr, ExcNotInitialized()); if (this->cell_type == internal::MatrixFreeFunctions::cartesian || this->cell_type == internal::MatrixFreeFunctions::affine) { - Assert (this->mapping_info != 0, ExcNotImplemented()); + Assert (this->mapping_info != nullptr, ExcNotImplemented()); VectorizedArray J = this->J_value[0]; for (unsigned int q=0; qdata->n_q_points; ++q) JxW_values[q] = J * this->quadrature_weights[q]; @@ -2634,11 +2634,11 @@ inline VectorizedArray FEEvaluationBase::JxW(const unsigned int q_point) const { - Assert (this->J_value != 0, ExcNotInitialized()); + Assert (this->J_value != nullptr, ExcNotInitialized()); if (this->cell_type == internal::MatrixFreeFunctions::cartesian || this->cell_type == internal::MatrixFreeFunctions::affine) { - Assert (this->mapping_info != 0, ExcInternalError()); + Assert (this->mapping_info != nullptr, ExcInternalError()); return this->J_value[0] * this->quadrature_weights[q_point]; } else @@ -3019,7 +3019,7 @@ FEEvaluationBase // Case 1: No MatrixFree object given, simple case because we do not need to // process constraints and need not care about vectorization - if (matrix_info == 0) + if (matrix_info == nullptr) { Assert (!local_dof_indices.empty(), ExcNotInitialized()); @@ -3037,7 +3037,7 @@ FEEvaluationBase return; } - Assert (dof_info != 0, ExcNotInitialized()); + Assert (dof_info != nullptr, ExcNotInitialized()); Assert (matrix_info->indices_initialized() == true, ExcNotInitialized()); Assert (cell != numbers::invalid_unsigned_int, ExcNotInitialized()); @@ -3448,7 +3448,7 @@ FEEvaluationBase ::read_dof_values_plain (const VectorType *src[]) { // Case without MatrixFree initialization object - if (matrix_info == 0) + if (matrix_info == nullptr) { internal::VectorReader reader; read_write_operation (reader, src); @@ -3457,7 +3457,7 @@ FEEvaluationBase // this is different from the other three operations because we do not use // constraints here, so this is a separate function. - Assert (dof_info != 0, ExcNotInitialized()); + Assert (dof_info != nullptr, ExcNotInitialized()); Assert (matrix_info->indices_initialized() == true, ExcNotInitialized()); Assert (cell != numbers::invalid_unsigned_int, ExcNotInitialized()); @@ -5114,7 +5114,7 @@ FEEvaluation : BaseClass (mapping, fe, quadrature, update_flags, first_selected_component, - static_cast*>(0)), + static_cast*>(nullptr)), dofs_per_cell (this->data->dofs_per_cell), n_q_points (this->data->n_q_points) { @@ -5134,7 +5134,7 @@ FEEvaluation : BaseClass (StaticMappingQ1::mapping, fe, quadrature, update_flags, first_selected_component, - static_cast*>(0)), + static_cast*>(nullptr)), dofs_per_cell (this->data->dofs_per_cell), n_q_points (this->data->n_q_points) { @@ -5335,7 +5335,7 @@ FEEvaluation { Assert (this->mapping_info->quadrature_points_initialized == true, ExcNotInitialized()); - Assert (this->quadrature_points != 0, ExcNotInitialized()); + Assert (this->quadrature_points != nullptr, ExcNotInitialized()); AssertIndexRange (q, n_q_points); // Cartesian mesh: not all quadrature points are stored, only the @@ -5380,7 +5380,7 @@ FEEvaluation { Assert (this->dof_values_initialized == true, internal::ExcAccessToUninitializedField()); - Assert(this->matrix_info != 0 || + Assert(this->matrix_info != nullptr || this->mapped_geometry->is_initialized(), ExcNotInitialized()); // Run time selection of algorithm matching the element type. Since some @@ -5470,7 +5470,7 @@ FEEvaluation if (integrate_gradients == true) Assert (this->gradients_quad_submitted == true, internal::ExcAccessToUninitializedField()); - Assert(this->matrix_info != 0 || + Assert(this->matrix_info != nullptr || this->mapped_geometry->is_initialized(), ExcNotInitialized()); // Run time selection of algorithm matching the element type. Since some diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 6e32bb1c46..f68c9f72fb 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -290,7 +290,7 @@ namespace internal const unsigned int fe_index = active_fe_index.size() > 0 ? active_fe_index[cell] : 0; const unsigned int n_q_points = current_data.n_q_points[fe_index]; - if (fe_values[fe_index].get() == 0) + if (fe_values[fe_index].get() == nullptr) fe_values[fe_index].reset (new dealii::FEValues (mapping, dummy_fe, current_data.quadrature[fe_index], diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 2f502a2411..65b46baa12 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -1164,7 +1164,7 @@ const Number * MatrixFree::constraint_pool_begin (const unsigned int row) const { AssertIndexRange (row, constraint_pool_row_index.size()-1); - return constraint_pool_data.empty() ? 0 : + return constraint_pool_data.empty() ? nullptr : &constraint_pool_data[0] + constraint_pool_row_index[row]; } @@ -1176,7 +1176,7 @@ const Number * MatrixFree::constraint_pool_end (const unsigned int row) const { AssertIndexRange (row, constraint_pool_row_index.size()-1); - return constraint_pool_data.empty() ? 0 : + return constraint_pool_data.empty() ? nullptr : &constraint_pool_data[0] + constraint_pool_row_index[row+1]; } @@ -1303,7 +1303,7 @@ MatrixFree::get_cell_iterator(const unsigned int macro_cell_number, AssertIndexRange (vector_number, irreg_filled); #endif - const DoFHandler *dofh = 0; + const DoFHandler *dofh = nullptr; if (dof_handlers.active_dof_handler == DoFHandlers::usual) { AssertDimension (dof_handlers.dof_handler.size(), @@ -2100,7 +2100,7 @@ namespace internal const internal::MatrixFreeFunctions::TaskInfo &task_info_in, const bool is_blocked_in) : - dummy (NULL), + dummy ((nullptr)), worker (worker_in), partition (partition_in), task_info (task_info_in), @@ -2114,7 +2114,7 @@ namespace internal worker(cell_range); if (is_blocked==true) dummy->spawn (*dummy); - return NULL; + return (nullptr); } tbb::empty_task *dummy; @@ -2137,7 +2137,7 @@ namespace internal const internal::MatrixFreeFunctions::TaskInfo &task_info_in, const bool is_blocked_in = false) : - dummy (NULL), + dummy ((nullptr)), function (function_in), partition (partition_in), task_info (task_info_in), @@ -2201,7 +2201,7 @@ namespace internal root->destroy(*root); if (is_blocked==true) dummy->spawn (*dummy); - return NULL; + return (nullptr); } tbb::empty_task *dummy; @@ -2265,7 +2265,7 @@ namespace internal const internal::MatrixFreeFunctions::TaskInfo &task_info_in, const bool is_blocked_in) : - dummy (NULL), + dummy ((nullptr)), worker (worker_in), partition (partition_in), task_info (task_info_in), @@ -2279,7 +2279,7 @@ namespace internal CellWork (worker,task_info)); if (is_blocked==true) dummy->spawn (*dummy); - return NULL; + return (nullptr); } tbb::empty_task *dummy; @@ -2306,7 +2306,7 @@ namespace internal tbb::task *execute () { internal::update_ghost_values_finish(src); - return 0; + return nullptr; } private: @@ -2327,7 +2327,7 @@ namespace internal tbb::task *execute () { internal::compress_start(dst); - return 0; + return nullptr; } private: diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index f14f38cb90..74d00de995 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -121,7 +121,7 @@ internal_reinit(const Mapping &mapping, const parallel::Triangulation *dist_tria = dynamic_cast*> (&(dof_handler[0]->get_triangulation())); - size_info.communicator = dist_tria != 0 ? + size_info.communicator = dist_tria != nullptr ? dist_tria->get_communicator() : MPI_COMM_SELF; size_info.my_pid = @@ -255,7 +255,7 @@ internal_reinit(const Mapping &mapping, const parallel::Triangulation *dist_tria = dynamic_cast*> (&(dof_handler[0]->get_triangulation())); - size_info.communicator = dist_tria != 0 ? + size_info.communicator = dist_tria != nullptr ? dist_tria->get_communicator() : MPI_COMM_SELF; size_info.my_pid = @@ -358,14 +358,14 @@ MatrixFree::is_supported(const FiniteElement &fe) return false; // then check of the base element is supported - if (dynamic_cast,dim,spacedim>*>(fe_ptr)!=0) + if (dynamic_cast,dim,spacedim>*>(fe_ptr)!=nullptr) return true; if (dynamic_cast >,dim,spacedim>*>(fe_ptr)!=0) + Polynomials::PiecewisePolynomial >,dim,spacedim>*>(fe_ptr)!=nullptr) return true; - if (dynamic_cast*>(fe_ptr)!=0) + if (dynamic_cast*>(fe_ptr)!=nullptr) return true; - if (dynamic_cast*>(fe_ptr)!=0) + if (dynamic_cast*>(fe_ptr)!=nullptr) return true; // if the base element is not in the above list it is not supported @@ -430,7 +430,7 @@ initialize_dof_handlers (const std::vector*> &dof_handler, // For serial Triangulations always take all cells const unsigned int subdomain_id = (dynamic_cast *> - (&dof_handler[0]->get_triangulation())!=0) + (&dof_handler[0]->get_triangulation())!=nullptr) ? my_pid : numbers::invalid_subdomain_id; for ( ; cell != end_cell; ++cell) internal::resolve_cell (cell, cell_level_index, subdomain_id); @@ -488,7 +488,7 @@ initialize_dof_handlers (const std::vector*> &dof_hand // For serial Triangulations always take all cells const unsigned int subdomain_id = (dynamic_cast *> - (&dof_handler[0]->get_triangulation())!=0) + (&dof_handler[0]->get_triangulation())!=nullptr) ? my_pid : numbers::invalid_subdomain_id; for ( ; cell != end_cell; ++cell) internal::resolve_cell (cell, cell_level_index, @@ -761,7 +761,7 @@ void MatrixFree::initialize_indices constraint_pool_row_index.resize(1, 0); for (unsigned int i=0; ibegin(), constraints[i]->end()); diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index c3842933c4..22ac681c59 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -882,11 +882,7 @@ namespace MatrixFreeOperators : Subscriptor(), have_interface_matrices(false) - { - // boost-1.62.0 doesn't allow initializing a shared_ptr - // with NULL. Make sure the default constructor does that. - Assert(data.get() == NULL, ExcInternalError()); - } + {} @@ -894,7 +890,7 @@ namespace MatrixFreeOperators typename Base::size_type Base::m () const { - Assert(data.get() != NULL, + Assert(data.get() != nullptr, ExcNotInitialized()); typename Base::size_type total_size = 0; for (unsigned int i=0; i::size_type Base::n () const { - Assert(data.get() != NULL, + Assert(data.get() != nullptr, ExcNotInitialized()); typename Base::size_type total_size = 0; for (unsigned int i=0; im() > 0, ExcNotInitialized()); return 1.0/(*inverse_diagonal_entries)(row,row); } @@ -946,7 +942,7 @@ namespace MatrixFreeOperators void Base::initialize_dof_vector (VectorType &vec) const { - Assert(data.get() != NULL, + Assert(data.get() != nullptr, ExcNotInitialized()); AssertDimension(n_blocks(vec), selected_rows.size()); for (unsigned int i = 0; i < n_blocks(vec); ++i) @@ -1348,7 +1344,7 @@ namespace MatrixFreeOperators std::size_t Base::memory_consumption () const { - return inverse_diagonal_entries.get() != NULL ? inverse_diagonal_entries->memory_consumption() : sizeof(*this); + return inverse_diagonal_entries.get() !=nullptr? inverse_diagonal_entries->memory_consumption() : sizeof(*this); } @@ -1366,7 +1362,7 @@ namespace MatrixFreeOperators const std::shared_ptr > & Base::get_matrix_diagonal_inverse() const { - Assert(inverse_diagonal_entries.get() != NULL && + Assert(inverse_diagonal_entries.get() !=nullptr&& inverse_diagonal_entries->m() > 0, ExcNotInitialized()); return inverse_diagonal_entries; } @@ -1403,7 +1399,7 @@ namespace MatrixFreeOperators MGInterfaceOperator::MGInterfaceOperator () : Subscriptor(), - mf_base_operator(NULL) + mf_base_operator((nullptr)) { } @@ -1413,7 +1409,7 @@ namespace MatrixFreeOperators void MGInterfaceOperator::clear () { - mf_base_operator = NULL; + mf_base_operator = (nullptr); } @@ -1439,7 +1435,7 @@ namespace MatrixFreeOperators "operator"); #endif - Assert(mf_base_operator != NULL, + Assert(mf_base_operator != nullptr, ExcNotInitialized()); mf_base_operator->vmult_interface_down(dst, src); @@ -1459,7 +1455,7 @@ namespace MatrixFreeOperators "operator"); #endif - Assert(mf_base_operator != NULL, + Assert(mf_base_operator != nullptr, ExcNotInitialized()); mf_base_operator->vmult_interface_up(dst, src); @@ -1484,7 +1480,7 @@ namespace MatrixFreeOperators compute_diagonal() { typedef typename Base::value_type Number; - Assert((Base::data.get() != NULL), ExcNotInitialized()); + Assert((Base::data.get() != nullptr), ExcNotInitialized()); this->inverse_diagonal_entries. reset(new DiagonalMatrix()); @@ -1593,7 +1589,7 @@ namespace MatrixFreeOperators compute_diagonal() { typedef typename Base::value_type Number; - Assert((Base::data.get() != NULL), ExcNotInitialized()); + Assert((Base::data.get() != nullptr), ExcNotInitialized()); unsigned int dummy = 0; this->inverse_diagonal_entries. diff --git a/include/deal.II/matrix_free/shape_info.templates.h b/include/deal.II/matrix_free/shape_info.templates.h index ea4a249c33..d29e75dd50 100644 --- a/include/deal.II/matrix_free/shape_info.templates.h +++ b/include/deal.II/matrix_free/shape_info.templates.h @@ -95,18 +95,18 @@ namespace internal const FE_Q_DG0 *fe_q_dg0 = dynamic_cast*>(fe); element_type = tensor_general; - if (fe_poly != 0) + if (fe_poly != nullptr) scalar_lexicographic = fe_poly->get_poly_space_numbering_inverse(); - else if (fe_poly_piece != 0) + else if (fe_poly_piece != nullptr) scalar_lexicographic = fe_poly_piece->get_poly_space_numbering_inverse(); - else if (fe_dgp != 0) + else if (fe_dgp != nullptr) { scalar_lexicographic.resize(fe_dgp->dofs_per_cell); for (unsigned int i=0; idofs_per_cell; ++i) scalar_lexicographic[i] = i; element_type = truncated_tensor; } - else if (fe_q_dg0 != 0) + else if (fe_q_dg0 != nullptr) { scalar_lexicographic = fe_q_dg0->get_poly_space_numbering_inverse(); element_type = tensor_symmetric_plus_dg0; diff --git a/include/deal.II/meshworker/assembler.h b/include/deal.II/meshworker/assembler.h index c9dcd39f98..bfaf7994a6 100644 --- a/include/deal.II/meshworker/assembler.h +++ b/include/deal.II/meshworker/assembler.h @@ -623,7 +623,7 @@ namespace MeshWorker const std::vector &dof1, const std::vector &dof2) { - if (constraints == 0) + if (constraints == nullptr) { for (unsigned int j=0; j::get_indices(const DHCellIterator &c) { indices.resize(c->get_fe().dofs_per_cell); - if (block_info == 0 || block_info->local().size() == 0) + if (block_info == nullptr || block_info->local().size() == 0) c->get_active_or_mg_dof_indices(indices); else { diff --git a/include/deal.II/meshworker/integration_info.h b/include/deal.II/meshworker/integration_info.h index 2ef065480b..5bbb513d2b 100644 --- a/include/deal.II/meshworker/integration_info.h +++ b/include/deal.II/meshworker/integration_info.h @@ -113,7 +113,7 @@ namespace MeshWorker const Mapping &mapping, const Quadrature &quadrature, const UpdateFlags flags, - const BlockInfo *local_block_info = 0); + const BlockInfo *local_block_info = nullptr); /** * Initialize the data vector and cache the selector. @@ -302,7 +302,7 @@ namespace MeshWorker */ void initialize(const FiniteElement &el, const Mapping &mapping, - const BlockInfo *block_info = 0); + const BlockInfo *block_info = nullptr); /** * Initialize the IntegrationInfo objects contained. @@ -316,7 +316,7 @@ namespace MeshWorker const Mapping &mapping, const AnyData &data, const VectorType &dummy, - const BlockInfo *block_info = 0); + const BlockInfo *block_info = nullptr); /** * Initialize the IntegrationInfo objects contained. * @@ -329,7 +329,7 @@ namespace MeshWorker const Mapping &mapping, const AnyData &data, const MGLevelObject &dummy, - const BlockInfo *block_info = 0); + const BlockInfo *block_info = nullptr); /** * @name FEValues setup */ @@ -582,14 +582,14 @@ namespace MeshWorker const FEFaceValues *pf = dynamic_cast*>(&p); const FESubfaceValues *ps = dynamic_cast*>(&p); - if (pc != 0) + if (pc != nullptr) fevalv[i] = std::shared_ptr > ( new FEValues (pc->get_mapping(), pc->get_fe(), pc->get_quadrature(), pc->get_update_flags())); - else if (pf != 0) + else if (pf != nullptr) fevalv[i] = std::shared_ptr > ( new FEFaceValues (pf->get_mapping(), pf->get_fe(), pf->get_quadrature(), pf->get_update_flags())); - else if (ps != 0) + else if (ps != nullptr) fevalv[i] = std::shared_ptr > ( new FESubfaceValues (ps->get_mapping(), ps->get_fe(), ps->get_quadrature(), ps->get_update_flags())); else @@ -610,7 +610,7 @@ namespace MeshWorker const BlockInfo *block_info) { fe_pointer = ⪙ - if (block_info == 0 || block_info->local().size() == 0) + if (block_info == nullptr || block_info->local().size() == 0) { fevalv.resize(1); fevalv[0] = std::shared_ptr > ( @@ -633,7 +633,7 @@ namespace MeshWorker inline const FiniteElement & IntegrationInfo::finite_element() const { - Assert (fe_pointer !=0, ExcNotInitialized()); + Assert (fe_pointer !=nullptr, ExcNotInitialized()); return *fe_pointer; } @@ -683,7 +683,7 @@ namespace MeshWorker } } - const bool split_fevalues = info.block_info != 0; + const bool split_fevalues = info.block_info != nullptr; if (!global_data->empty()) fill_local_data(info, split_fevalues); } diff --git a/include/deal.II/meshworker/loop.h b/include/deal.II/meshworker/loop.h index 1421f113c5..d062db5dd8 100644 --- a/include/deal.II/meshworker/loop.h +++ b/include/deal.II/meshworker/loop.h @@ -200,9 +200,9 @@ namespace MeshWorker dof_info.cell.reinit(cell); dof_info.cell_valid = true; - const bool integrate_cell = (cell_worker != 0); - const bool integrate_boundary = (boundary_worker != 0); - const bool integrate_interior_face = (face_worker != 0); + const bool integrate_cell = (cell_worker != nullptr); + const bool integrate_boundary = (boundary_worker != nullptr); + const bool integrate_interior_face = (face_worker != nullptr); if (integrate_cell) info.cell.reinit(dof_info.cell); diff --git a/include/deal.II/meshworker/output.h b/include/deal.II/meshworker/output.h index fd947fdc5a..06fae5fe74 100644 --- a/include/deal.II/meshworker/output.h +++ b/include/deal.II/meshworker/output.h @@ -139,7 +139,7 @@ namespace MeshWorker inline void GnuplotPatch::write(const T &d) const { - if (os == 0) + if (os == nullptr) deallog << d; else (*os) << d; @@ -149,7 +149,7 @@ namespace MeshWorker inline void GnuplotPatch::write_endl() const { - if (os == 0) + if (os == nullptr) deallog << std::endl; else (*os) << std::endl; @@ -159,7 +159,7 @@ namespace MeshWorker inline GnuplotPatch::GnuplotPatch() : - os(0) + os(nullptr) {} diff --git a/include/deal.II/meshworker/simple.h b/include/deal.II/meshworker/simple.h index 5282f4ee63..4e09dc91be 100644 --- a/include/deal.II/meshworker/simple.h +++ b/include/deal.II/meshworker/simple.h @@ -524,7 +524,7 @@ namespace MeshWorker info.indices: info.indices_by_block[i]; - if (constraints !=0) + if (constraints !=nullptr) constraints->distribute_local_to_global(info.vector(k).block(i), ldi, *v); else v->add(ldi, info.vector(k).block(i)); @@ -622,7 +622,7 @@ namespace MeshWorker AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); - if (constraints == 0) + if (constraints == nullptr) { for (unsigned int j=0; j::residuals; VectorType *v = residuals.entry(index); - if (ResidualSimple::constraints == 0) + if (ResidualSimple::constraints == nullptr) { for (unsigned int i=0; i::residuals; VectorType *v = residuals.entry(index); - if (ResidualSimple::constraints == 0) + if (ResidualSimple::constraints == nullptr) { for (unsigned int j=0; j::clear () max_level=matrices.max_level(); for (; i<=max_level; ++i) { - smoothers[i] = 0; - matrices[i] = 0; + smoothers[i] = nullptr; + matrices[i] = nullptr; } } diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 2d8c6e2605..14680ac30d 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -245,7 +245,7 @@ public: /** * Constructor, taking the coarse grid matrix. */ - MGCoarseGridHouseholder (const FullMatrix *A = 0); + MGCoarseGridHouseholder (const FullMatrix *A = nullptr); /** * Initialize for a new matrix. @@ -308,13 +308,13 @@ private: /* ------------------ Functions for MGCoarseGridApplySmoother -----------*/ template MGCoarseGridApplySmoother::MGCoarseGridApplySmoother () - : coarse_smooth(NULL) + : coarse_smooth((nullptr)) { } template MGCoarseGridApplySmoother::MGCoarseGridApplySmoother (const MGSmootherBase &coarse_smooth) - : coarse_smooth(NULL) + : coarse_smooth((nullptr)) { initialize(coarse_smooth); } @@ -397,13 +397,13 @@ void MGCoarseGridLACIteration ::clear() { - solver = 0; + solver = nullptr; if (matrix) delete matrix; - matrix = 0; + matrix = nullptr; if (precondition) delete precondition; - precondition = 0; + precondition = nullptr; } @@ -414,9 +414,9 @@ MGCoarseGridLACIteration VectorType &dst, const VectorType &src) const { - Assert(solver!=0, ExcNotInitialized()); - Assert(matrix!=0, ExcNotInitialized()); - Assert(precondition!=0, ExcNotInitialized()); + Assert(solver!=nullptr, ExcNotInitialized()); + Assert(matrix!=nullptr, ExcNotInitialized()); + Assert(precondition!=nullptr, ExcNotInitialized()); solver->solve(*matrix, dst, src, *precondition); } @@ -510,9 +510,9 @@ MGCoarseGridIterativeSolversolve(*matrix, dst, src, *preconditioner); } @@ -524,7 +524,7 @@ template MGCoarseGridHouseholder::MGCoarseGridHouseholder (const FullMatrix *A) { - if (A != 0) householder.initialize(*A); + if (A != nullptr) householder.initialize(*A); } diff --git a/include/deal.II/multigrid/mg_smoother.h b/include/deal.II/multigrid/mg_smoother.h index 64c0d954d6..b64a1bd86c 100644 --- a/include/deal.II/multigrid/mg_smoother.h +++ b/include/deal.II/multigrid/mg_smoother.h @@ -692,7 +692,7 @@ MGSmootherRelaxation::clear () unsigned int i=matrices.min_level(), max_level=matrices.max_level(); for (; i<=max_level; ++i) - matrices[i]=0; + matrices[i]=nullptr; } @@ -859,7 +859,7 @@ MGSmootherPrecondition::clear () unsigned int i=matrices.min_level(), max_level=matrices.max_level(); for (; i<=max_level; ++i) - matrices[i]=0; + matrices[i]=nullptr; } diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 8b525c4e90..68d7b87ced 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -119,7 +119,7 @@ namespace { if (v[level].size() != mg_dof.locally_owned_mg_dofs(level).size() || v[level].local_size() != mg_dof.locally_owned_mg_dofs(level).n_elements()) - v[level].reinit(mg_dof.locally_owned_mg_dofs(level), tria != 0 ? + v[level].reinit(mg_dof.locally_owned_mg_dofs(level), tria != nullptr ? tria->get_communicator() : MPI_COMM_SELF); else v[level] = 0.; @@ -142,7 +142,7 @@ namespace const dealii::parallel::distributed::Triangulation *tria = (dynamic_cast*> (&mg_dof.get_triangulation())); - AssertThrow(tria!=NULL, ExcMessage("multigrid with Trilinos vectors only works with distributed Triangulation!")); + AssertThrow(tria!=nullptr, ExcMessage("multigrid with Trilinos vectors only works with distributed Triangulation!")); #ifdef DEAL_II_WITH_P4EST for (unsigned int level=v.min_level(); diff --git a/include/deal.II/multigrid/mg_transfer_component.templates.h b/include/deal.II/multigrid/mg_transfer_component.templates.h index acadee7750..b54420debf 100644 --- a/include/deal.II/multigrid/mg_transfer_component.templates.h +++ b/include/deal.II/multigrid/mg_transfer_component.templates.h @@ -74,7 +74,7 @@ MGTransferSelect::copy_from_mg ( dst = 0; do_copy_from_mg (mg_dof_handler, dst.block(target_component[selected_component]), src); - if (constraints != 0) + if (constraints != nullptr) constraints->condense(dst); } @@ -90,7 +90,7 @@ MGTransferSelect::copy_from_mg ( { dst = 0; do_copy_from_mg (mg_dof_handler, dst, src); - if (constraints != 0) + if (constraints != nullptr) { //If we were given constraints //apply them to the dst that goes diff --git a/include/deal.II/multigrid/multigrid.h b/include/deal.II/multigrid/multigrid.h index 2d30d43813..e79f7e0b20 100644 --- a/include/deal.II/multigrid/multigrid.h +++ b/include/deal.II/multigrid/multigrid.h @@ -468,8 +468,8 @@ Multigrid::Multigrid (const DoFHandler &mg_dof_han transfer(&transfer, typeid(*this).name()), pre_smooth(&pre_smooth, typeid(*this).name()), post_smooth(&post_smooth, typeid(*this).name()), - edge_down(0, typeid(*this).name()), - edge_up(0, typeid(*this).name()), + edge_down(nullptr, typeid(*this).name()), + edge_up(nullptr, typeid(*this).name()), debug(0) { const unsigned int dof_handler_max_level @@ -500,10 +500,10 @@ Multigrid::Multigrid (const MGMatrixBase &matrix, transfer(&transfer, typeid(*this).name()), pre_smooth(&pre_smooth, typeid(*this).name()), post_smooth(&post_smooth, typeid(*this).name()), - edge_out(0, typeid(*this).name()), - edge_in(0, typeid(*this).name()), - edge_down(0, typeid(*this).name()), - edge_up(0, typeid(*this).name()), + edge_out(nullptr, typeid(*this).name()), + edge_in(nullptr, typeid(*this).name()), + edge_down(nullptr, typeid(*this).name()), + edge_up(nullptr, typeid(*this).name()), debug(0) { if (max_level == numbers::invalid_unsigned_int) @@ -597,7 +597,7 @@ PreconditionMG::get_mpi_communicator() const // so it should be a safe bet to use it to query MPI communicator: const Triangulation &tria = dof_handler->get_triangulation(); const parallel::distributed::Triangulation *ptria = dynamic_cast *>(&tria); - Assert (ptria != NULL, ExcInternalError()); + Assert (ptria != nullptr, ExcInternalError()); return ptria->get_communicator (); } diff --git a/include/deal.II/multigrid/multigrid.templates.h b/include/deal.II/multigrid/multigrid.templates.h index d5a9636668..833ab779cd 100644 --- a/include/deal.II/multigrid/multigrid.templates.h +++ b/include/deal.II/multigrid/multigrid.templates.h @@ -135,7 +135,7 @@ Multigrid::level_v_step (const unsigned int level) if (debug>1) deallog << "Residual on level " << level << std::endl; matrix->vmult(level, t[level], solution[level]); - if (edge_out != 0) + if (edge_out != nullptr) { edge_out->vmult_add(level, t[level], solution[level]); if (debug>2) @@ -149,7 +149,7 @@ Multigrid::level_v_step (const unsigned int level) // Get the defect on the next coarser level as part of the (DG) edge matrix // and then the main part by the restriction of the transfer - if (edge_down != 0) + if (edge_down != nullptr) { edge_down->vmult(level, t[level-1], solution[level]); defect[level-1] -= t[level-1]; @@ -166,12 +166,12 @@ Multigrid::level_v_step (const unsigned int level) solution[level] += t[level]; // get in contribution from edge matrices to the defect - if (edge_in != 0) + if (edge_in != nullptr) { edge_in->Tvmult(level, t[level], solution[level]); defect[level] -= t[level]; } - if (edge_up != 0) + if (edge_up != nullptr) { edge_up->Tvmult(level, t[level], solution[level-1]); defect[level] -= t[level]; @@ -251,7 +251,7 @@ Multigrid::level_step(const unsigned int level, if (debug>1) deallog << cychar << "-cycle residual level " << level << std::endl; matrix->vmult(level, t[level], solution[level]); - if (edge_out != 0) + if (edge_out != nullptr) edge_out->vmult_add(level, t[level], solution[level]); t[level].sadd(-1.0, 1.0, defect2[level]); @@ -261,7 +261,7 @@ Multigrid::level_step(const unsigned int level, // Get the defect on the next coarser level as part of the (DG) edge matrix // and then the main part by the restriction of the transfer - if (edge_down != 0) + if (edge_down != nullptr) edge_down->vmult(level, defect2[level-1], solution[level]); else defect2[level-1] = 0; @@ -293,13 +293,13 @@ Multigrid::level_step(const unsigned int level, solution[level] += t[level]; // get in contribution from edge matrices to the defect - if (edge_in != 0) + if (edge_in != nullptr) { edge_in->Tvmult(level, t[level], solution[level]); defect2[level] -= t[level]; } - if (edge_up != 0) + if (edge_up != nullptr) { edge_up->Tvmult(level, t[level], solution[level-1]); defect2[level] -= t[level]; diff --git a/include/deal.II/numerics/data_postprocessor.h b/include/deal.II/numerics/data_postprocessor.h index 230874d9ef..a9b76e8516 100644 --- a/include/deal.II/numerics/data_postprocessor.h +++ b/include/deal.II/numerics/data_postprocessor.h @@ -740,7 +740,7 @@ namespace DataPostprocessorInputs ExcMessage ("You are trying to access the cell associated with a " "DataPostprocessorInputs::Scalar object for which no cell has " "been set.")); - Assert(boost::any_cast(&cell) != 0, + Assert(boost::any_cast(&cell) != nullptr, ExcMessage ("You are trying to access the cell associated with a " "DataPostprocessorInputs::Scalar with a DoFHandler type that " "is different from the type with which it has been set. For " diff --git a/include/deal.II/numerics/dof_output_operator.templates.h b/include/deal.II/numerics/dof_output_operator.templates.h index 8d45a1fa16..79bf6bb85d 100644 --- a/include/deal.II/numerics/dof_output_operator.templates.h +++ b/include/deal.II/numerics/dof_output_operator.templates.h @@ -47,12 +47,12 @@ namespace Algorithms DoFOutputOperator::operator<<( const AnyData &data) { - Assert ((dof!=0), ExcNotInitialized()); + Assert ((dof!=nullptr), ExcNotInitialized()); out.attach_dof_handler (*dof); for (unsigned int i=0; i(i); - if (p!=0) + if (p!=nullptr) { out.add_data_vector (*p, data.name(i)); } diff --git a/include/deal.II/numerics/error_estimator.h b/include/deal.II/numerics/error_estimator.h index 83258cd4c3..ba06b911da 100644 --- a/include/deal.II/numerics/error_estimator.h +++ b/include/deal.II/numerics/error_estimator.h @@ -334,7 +334,7 @@ public: const InputVector &solution, Vector &error, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficients = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, @@ -352,7 +352,7 @@ public: const InputVector &solution, Vector &error, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficients = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, @@ -437,7 +437,7 @@ public: const InputVector &solution, Vector &error, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficients = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, @@ -476,7 +476,7 @@ public: const std::vector &solutions, std::vector*> &errors, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficients = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, @@ -580,7 +580,7 @@ public: const InputVector &solution, Vector &error, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficient = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id); @@ -597,7 +597,7 @@ public: const InputVector &solution, Vector &error, const ComponentMask &component_mask = ComponentMask(), - const Function *coefficients = 0, + const Function *coefficients = nullptr, const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id); diff --git a/include/deal.II/numerics/error_estimator.templates.h b/include/deal.II/numerics/error_estimator.templates.h index 2634d2210f..780b9c2544 100644 --- a/include/deal.II/numerics/error_estimator.templates.h +++ b/include/deal.II/numerics/error_estimator.templates.h @@ -377,7 +377,7 @@ namespace internal // if a coefficient was given: use that to scale the jump in the // gradient - if (parallel_data.coefficients != 0) + if (parallel_data.coefficients != nullptr) { // scalar coefficient if (parallel_data.coefficients->n_components == 1) @@ -1080,7 +1080,7 @@ estimate (const Mapping &mapping, #ifdef DEAL_II_WITH_P4EST if (dynamic_cast*> (&dof_handler.get_triangulation()) - != 0) + != nullptr) Assert ((subdomain_id_ == numbers::invalid_subdomain_id) || (subdomain_id_ == @@ -1093,7 +1093,7 @@ estimate (const Mapping &mapping, const types::subdomain_id subdomain_id = ((dynamic_cast*> (&dof_handler.get_triangulation()) - != 0) + != nullptr) ? dynamic_cast&> (dof_handler.get_triangulation()).locally_owned_subdomain() @@ -1125,7 +1125,7 @@ estimate (const Mapping &mapping, Assert (component_mask.n_selected_components(n_components) > 0, ExcInvalidComponentMask()); - Assert ((coefficients == 0) || + Assert ((coefficients == nullptr) || (coefficients->n_components == n_components) || (coefficients->n_components == 1), ExcInvalidCoefficient()); @@ -1150,7 +1150,7 @@ estimate (const Mapping &mapping, parallel_data (dof_handler.get_fe(), face_quadratures, mapping_collection, - (!neumann_bc.empty() || (coefficients != 0)), + (!neumann_bc.empty() || (coefficients != nullptr)), solutions.size(), subdomain_id, material_id, diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index 8a6d279789..1d85dcbe3c 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -237,11 +237,11 @@ namespace MatrixCreator const FiniteElement &fe = fe_values.get_fe(); const unsigned int n_components = fe.n_components(); - Assert(data.rhs_function == 0 || + Assert(data.rhs_function == nullptr || data.rhs_function->n_components==1 || data.rhs_function->n_components==n_components, ::dealii::MatrixCreator::ExcComponentMismatch()); - Assert(data.coefficient == 0 || + Assert(data.coefficient == nullptr || data.coefficient->n_components==1 || data.coefficient->n_components==n_components, ::dealii::MatrixCreator::ExcComponentMismatch()); @@ -252,7 +252,7 @@ namespace MatrixCreator copy_data.dof_indices.resize (dofs_per_cell); cell->get_dof_indices (copy_data.dof_indices); - const bool use_rhs_function = data.rhs_function != 0; + const bool use_rhs_function = data.rhs_function != nullptr; if (use_rhs_function) { if (data.rhs_function->n_components==1) @@ -270,7 +270,7 @@ namespace MatrixCreator } } - const bool use_coefficient = data.coefficient != 0; + const bool use_coefficient = data.coefficient != nullptr; if (use_coefficient) { if (data.coefficient->n_components==1) @@ -420,11 +420,11 @@ namespace MatrixCreator const FiniteElement &fe = fe_values.get_fe(); const unsigned int n_components = fe.n_components(); - Assert(data.rhs_function == 0 || + Assert(data.rhs_function == nullptr || data.rhs_function->n_components==1 || data.rhs_function->n_components==n_components, ::dealii::MatrixCreator::ExcComponentMismatch()); - Assert(data.coefficient == 0 || + Assert(data.coefficient == nullptr || data.coefficient->n_components==1 || data.coefficient->n_components==n_components, ::dealii::MatrixCreator::ExcComponentMismatch()); @@ -435,7 +435,7 @@ namespace MatrixCreator cell->get_dof_indices (copy_data.dof_indices); - const bool use_rhs_function = data.rhs_function != 0; + const bool use_rhs_function = data.rhs_function != nullptr; if (use_rhs_function) { if (data.rhs_function->n_components==1) @@ -453,7 +453,7 @@ namespace MatrixCreator } } - const bool use_coefficient = data.coefficient != 0; + const bool use_coefficient = data.coefficient != nullptr; if (use_coefficient) { if (data.coefficient->n_components==1) @@ -600,12 +600,12 @@ namespace MatrixCreator ExcInternalError()); Assert (data.cell_matrix.n() == dofs_per_cell, ExcInternalError()); - Assert ((right_hand_side == 0) + Assert ((right_hand_side == nullptr) || (data.cell_rhs.size() == dofs_per_cell), ExcInternalError()); - if (right_hand_side != 0) + if (right_hand_side != nullptr) data.constraints->distribute_local_to_global(data.cell_matrix, data.cell_rhs, data.dof_indices, @@ -685,8 +685,8 @@ namespace MatrixCreator MatrixCreator::internal::AssemblerData::Scratch assembler_data (fe_collection, update_values | update_JxW_values | - (coefficient != 0 ? update_quadrature_points : UpdateFlags(0)), - coefficient, /*rhs_function=*/0, + (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)), + coefficient, /*rhs_function=*/nullptr, q_collection, mapping_collection); MatrixCreator::internal::AssemblerData::CopyData copy_data; @@ -701,7 +701,7 @@ namespace MatrixCreator &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>, std::bind (&MatrixCreator::internal:: copy_local_to_global, Vector >, - std::placeholders::_1, &matrix, (Vector *)0), + std::placeholders::_1, &matrix, (Vector *)nullptr), assembler_data, copy_data); } @@ -796,8 +796,8 @@ namespace MatrixCreator MatrixCreator::internal::AssemblerData::Scratch assembler_data (dof.get_fe(), update_values | update_JxW_values | - (coefficient != 0 ? update_quadrature_points : UpdateFlags(0)), - coefficient, /*rhs_function=*/0, + (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)), + coefficient, /*rhs_function=*/nullptr, q, mapping); MatrixCreator::internal::AssemblerData::CopyData copy_data; copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(), @@ -811,7 +811,7 @@ namespace MatrixCreator &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>, std::bind (&MatrixCreator::internal:: copy_local_to_global, Vector >, - std::placeholders::_1, &matrix, (Vector *)0), + std::placeholders::_1, &matrix, (Vector *)nullptr), assembler_data, copy_data); } @@ -926,7 +926,7 @@ namespace MatrixCreator std::vector coefficient_values (fe_values.n_quadrature_points, 1.); std::vector > coefficient_vector_values (fe_values.n_quadrature_points, Vector(n_components)); - const bool coefficient_is_vector = (coefficient != 0 && coefficient->n_components != 1) + const bool coefficient_is_vector = (coefficient != nullptr && coefficient->n_components != 1) ? true : false; std::vector rhs_values_scalar (fe_values.n_quadrature_points); @@ -973,7 +973,7 @@ namespace MatrixCreator // If a scalar function is given, update the // values, if not, use the default one set in the // constructor above - if (coefficient != 0) + if (coefficient != nullptr) coefficient->value_list (fe_values.get_quadrature_points(), coefficient_values); // Copy scalar values into vector @@ -1046,7 +1046,7 @@ namespace MatrixCreator boundary_functions.find(cell->face(face)->boundary_id()) ->second->value_list (fe_values.get_quadrature_points(), rhs_values_scalar); - if (coefficient != 0) + if (coefficient != nullptr) coefficient->value_list (fe_values.get_quadrature_points(), coefficient_values); for (unsigned int point=0; pointn_components==1 || coefficient->n_components==n_components, ExcComponentMismatch()); @@ -1338,7 +1338,7 @@ namespace MatrixCreator ->second->vector_value_list (fe_values.get_quadrature_points(), rhs_values_system); - if (coefficient != 0) + if (coefficient != nullptr) { if (coefficient->n_components==1) { @@ -1424,7 +1424,7 @@ namespace MatrixCreator boundary_functions.find(cell->face(face)->boundary_id()) ->second->value_list (fe_values.get_quadrature_points(), rhs_values_scalar); - if (coefficient != 0) + if (coefficient != nullptr) { coefficient_values.resize (fe_values.n_quadrature_points); coefficient->value_list (fe_values.get_quadrature_points(), @@ -1637,7 +1637,7 @@ namespace MatrixCreator Assert (boundary_functions.size() != 0, ExcInternalError()); Assert (dof_to_boundary_mapping.size() == dof.n_dofs(), ExcInternalError()); - Assert (coefficient ==0 || + Assert (coefficient ==nullptr || coefficient->n_components==1 || coefficient->n_components==n_components, ExcComponentMismatch()); @@ -1712,8 +1712,8 @@ namespace MatrixCreator MatrixCreator::internal::AssemblerData::Scratch assembler_data (fe_collection, update_gradients | update_JxW_values | - (coefficient != 0 ? update_quadrature_points : UpdateFlags(0)), - coefficient, /*rhs_function=*/0, + (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)), + coefficient, /*rhs_function=*/nullptr, q_collection, mapping_collection); MatrixCreator::internal::AssemblerData::CopyData copy_data; copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(), @@ -1729,7 +1729,7 @@ namespace MatrixCreator copy_local_to_global, Vector >, std::placeholders::_1, &matrix, - (Vector *)NULL), + (Vector *)(nullptr)), assembler_data, copy_data); } @@ -1825,8 +1825,8 @@ namespace MatrixCreator MatrixCreator::internal::AssemblerData::Scratch assembler_data (dof.get_fe(), update_gradients | update_JxW_values | - (coefficient != 0 ? update_quadrature_points : UpdateFlags(0)), - coefficient, /*rhs_function=*/0, + (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)), + coefficient, /*rhs_function=*/nullptr, q, mapping); MatrixCreator::internal::AssemblerData::CopyData copy_data; copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(), @@ -1842,7 +1842,7 @@ namespace MatrixCreator copy_local_to_global, Vector >, std::placeholders::_1, &matrix, - (Vector *)0), + (Vector *)nullptr), assembler_data, copy_data); } diff --git a/include/deal.II/numerics/matrix_tools.h b/include/deal.II/numerics/matrix_tools.h index d0e0c19160..e89b4280ff 100644 --- a/include/deal.II/numerics/matrix_tools.h +++ b/include/deal.II/numerics/matrix_tools.h @@ -241,7 +241,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -252,7 +252,7 @@ namespace MatrixCreator void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -278,7 +278,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -302,7 +302,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -325,7 +325,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -437,7 +437,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -448,7 +448,7 @@ namespace MatrixCreator void create_laplace_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -473,7 +473,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -486,7 +486,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -498,7 +498,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -509,7 +509,7 @@ namespace MatrixCreator void create_laplace_matrix (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -523,7 +523,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -536,7 +536,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** diff --git a/include/deal.II/numerics/solution_transfer.h b/include/deal.II/numerics/solution_transfer.h index 0b7c7529d3..3ed4f297ac 100644 --- a/include/deal.II/numerics/solution_transfer.h +++ b/include/deal.II/numerics/solution_transfer.h @@ -473,16 +473,16 @@ private: */ struct Pointerstruct { - Pointerstruct() : indices_ptr(0), dof_values_ptr(0), active_fe_index(0) {}; + Pointerstruct() : indices_ptr(nullptr), dof_values_ptr(nullptr), active_fe_index(0) {}; Pointerstruct(std::vector *indices_ptr_in, const unsigned int active_fe_index_in = 0) : indices_ptr(indices_ptr_in), - dof_values_ptr (0), + dof_values_ptr (nullptr), active_fe_index(active_fe_index_in) {}; Pointerstruct(std::vector > *dof_values_ptr_in, const unsigned int active_fe_index_in = 0) : - indices_ptr (0), + indices_ptr (nullptr), dof_values_ptr(dof_values_ptr_in), active_fe_index(active_fe_index_in) {}; std::size_t memory_consumption () const; diff --git a/include/deal.II/numerics/vector_tools.h b/include/deal.II/numerics/vector_tools.h index 80f90256bb..b4c0699602 100644 --- a/include/deal.II/numerics/vector_tools.h +++ b/include/deal.II/numerics/vector_tools.h @@ -2241,7 +2241,7 @@ namespace VectorTools OutVector &difference, const Quadrature &q, const NormType &norm, - const Function *weight = 0, + const Function *weight = nullptr, const double exponent = 2.); /** @@ -2255,7 +2255,7 @@ namespace VectorTools OutVector &difference, const Quadrature &q, const NormType &norm, - const Function *weight = 0, + const Function *weight = nullptr, const double exponent = 2.); /** @@ -2269,7 +2269,7 @@ namespace VectorTools OutVector &difference, const hp::QCollection &q, const NormType &norm, - const Function *weight = 0, + const Function *weight = nullptr, const double exponent = 2.); /** @@ -2283,7 +2283,7 @@ namespace VectorTools OutVector &difference, const hp::QCollection &q, const NormType &norm, - const Function *weight = 0, + const Function *weight = nullptr, const double exponent = 2.); /** diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index e1d99f804f..dea18e79b1 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -863,7 +863,7 @@ namespace VectorTools // interpolate the boundary values and then condense the matrix and vector if (constraints_are_compatible) { - const Function *dummy = 0; + const Function *dummy = nullptr; MatrixCreator::create_mass_matrix (mapping, dof, quadrature, mass_matrix, function, tmp, dummy, constraints); @@ -1130,7 +1130,7 @@ namespace VectorTools project_to_boundary_first); else { - Assert((dynamic_cast* > (&(dof.get_triangulation()))==0), + Assert((dynamic_cast* > (&(dof.get_triangulation()))==nullptr), ExcNotImplemented()); do_project (mapping, dof, constraints, quadrature, function, vec_result, @@ -1406,15 +1406,15 @@ namespace VectorTools const DoFHandler *const dof_ptr = dynamic_cast*> (&dof); const Function *const function_ptr = dynamic_cast*> (&function); - Assert (mapping_ptr!=0, ExcInternalError()); - Assert (dof_ptr!=0, ExcInternalError()); + Assert (mapping_ptr!=nullptr, ExcInternalError()); + Assert (dof_ptr!=nullptr, ExcInternalError()); project (*mapping_ptr, *dof_ptr, constraints, quadrature, *function_ptr, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); } else { - Assert((dynamic_cast* > (&(dof.get_triangulation()))==0), + Assert((dynamic_cast* > (&(dof.get_triangulation()))==nullptr), ExcNotImplemented()); do_project (mapping, dof, constraints, quadrature, function, vec_result, @@ -1452,7 +1452,7 @@ namespace VectorTools const hp::QCollection &q_boundary, const bool project_to_boundary_first) { - Assert((dynamic_cast* > (&(dof.get_triangulation()))==0), + Assert((dynamic_cast* > (&(dof.get_triangulation()))==nullptr), ExcNotImplemented()); do_project (mapping, dof, constraints, quadrature, @@ -2894,7 +2894,7 @@ namespace VectorTools MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, mass_matrix, boundary_functions, rhs, dof_to_boundary_mapping, - (const Function *) 0, + (const Function *) nullptr, component_mapping); // For certain weird elements, @@ -3569,7 +3569,7 @@ namespace VectorTools reference_quadrature_points = fe_values.get_quadrature ().get_points (); std::pair base_indices (0, 0); - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { unsigned int fe_index = 0; unsigned int fe_index_old = 0; @@ -3636,7 +3636,7 @@ namespace VectorTools // Compute the degrees of // freedom. for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index (line * fe.degree, face) @@ -3644,7 +3644,7 @@ namespace VectorTools && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second <= fe.base_element (base_indices.first).face_to_cell_index ((line + 1) * fe.degree - 1, face))) - || ((dynamic_cast*> (&fe) != 0) && (line * fe.degree <= i) + || ((dynamic_cast*> (&fe) != nullptr) && (line * fe.degree <= i) && (i < (line + 1) * fe.degree))) { const double tangential_solution_component @@ -3715,7 +3715,7 @@ namespace VectorTools const unsigned int degree = fe.degree - 1; std::pair base_indices (0, 0); - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { unsigned int fe_index = 0; unsigned int fe_index_old = 0; @@ -3797,10 +3797,10 @@ namespace VectorTools // Compute the degrees // of freedom. for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices)) - || (dynamic_cast*> (&fe) != 0)) + || (dynamic_cast*> (&fe) != nullptr)) { dof_values[i] += fe_values.JxW (q_point) @@ -3869,13 +3869,13 @@ namespace VectorTools tmp[d] = values[q_point] (first_vector_component + d); for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index (2 * fe.degree, face) <= fe.system_to_base_index (fe.face_to_cell_index (i, face)).second) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second <= fe.base_element (base_indices.first).face_to_cell_index (4 * fe.degree - 1, face))) - || ((dynamic_cast*> (&fe) != 0) && (2 * fe.degree <= i) + || ((dynamic_cast*> (&fe) != nullptr) && (2 * fe.degree <= i) && (i < 4 * fe.degree))) tmp -= dof_values[i] * fe_values[vec].value (fe.face_to_cell_index (i, face), q_point); @@ -3914,7 +3914,7 @@ namespace VectorTools unsigned int index = 0; for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index @@ -3923,7 +3923,7 @@ namespace VectorTools && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second < fe.base_element (base_indices.first).face_to_cell_index ((degree + GeometryInfo::lines_per_face) * fe.degree, face))) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && (GeometryInfo::lines_per_face * fe.degree <= i) && (i < (degree + GeometryInfo::lines_per_face) * fe.degree))) { @@ -3953,7 +3953,7 @@ namespace VectorTools unsigned int index = 0; for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index @@ -3962,7 +3962,7 @@ namespace VectorTools && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second < fe.base_element (base_indices.first).face_to_cell_index ((degree + GeometryInfo::lines_per_face) * fe.degree, face))) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && (GeometryInfo::lines_per_face * fe.degree <= i) && (i < (degree + GeometryInfo::lines_per_face) * fe.degree))) { @@ -3983,14 +3983,14 @@ namespace VectorTools tmp[d] = values[q_point] (first_vector_component + d); for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second <= fe.base_element (base_indices.first).face_to_cell_index (2 * fe.degree - 1, face)) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).second >= fe.base_element (base_indices.first).face_to_cell_index (0, face))) - || ((dynamic_cast*> (&fe) != 0) && (i < 2 * fe.degree))) + || ((dynamic_cast*> (&fe) != nullptr) && (i < 2 * fe.degree))) tmp -= dof_values[i] * fe_values[vec].value (fe.face_to_cell_index (i, face), q_point); const double JxW @@ -4019,13 +4019,13 @@ namespace VectorTools unsigned int index = 0; for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index ((degree + GeometryInfo::lines_per_face) * fe.degree, face) <= fe.system_to_base_index (fe.face_to_cell_index (i, face)).second)) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && ((degree + GeometryInfo::lines_per_face) * fe.degree <= i))) { const Tensor<1, dim> shape_value @@ -4047,13 +4047,13 @@ namespace VectorTools unsigned int index = 0; for (unsigned int i = 0; i < fe.dofs_per_face; ++i) - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (fe.face_to_cell_index (i, face)).first == base_indices) && (fe.base_element (base_indices.first).face_to_cell_index ((degree + GeometryInfo::lines_per_face) * fe.degree, face) <= fe.system_to_base_index (fe.face_to_cell_index (i, face)).second)) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && ((degree + GeometryInfo::lines_per_face) * fe.degree <= i))) { dof_values[i] = solution (index); @@ -4131,7 +4131,7 @@ namespace VectorTools // FE_Nothing object // there is no work to // do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) return; // This is only @@ -4140,10 +4140,10 @@ namespace VectorTools // element. If the FE // is a FESystem, we // cannot check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -4215,7 +4215,7 @@ namespace VectorTools // FE_Nothing object // there is no work to // do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) return; // This is only @@ -4224,11 +4224,11 @@ namespace VectorTools // element. If the FE is // a FESystem we cannot // check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -4334,16 +4334,16 @@ namespace VectorTools if (cell->face (face)->boundary_id () == boundary_component) { // if the FE is a FE_Nothing object there is no work to do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) return; // This is only implemented, if the FE is a Nedelec // element. If the FE is a FESystem we cannot check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -4411,16 +4411,16 @@ namespace VectorTools if (cell->face (face)->boundary_id () == boundary_component) { // if the FE is a FE_Nothing object there is no work to do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) return; // This is only implemented, if the FE is a Nedelec // element. If the FE is a FESystem we cannot check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -4530,7 +4530,7 @@ namespace VectorTools // If not using FESystem then must be using FE_Nedelec, // which has one base element and one copy of it (with 3 components). std::pair base_indices (0, 0); - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { unsigned int fe_index = 0; unsigned int fe_index_old = 0; @@ -4595,11 +4595,11 @@ namespace VectorTools const unsigned int cell_idx = fe.face_to_cell_index (face_idx, face); // Check this cell_idx belongs to the correct base_element, component and line: - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (cell_idx).first == base_indices) && (lower_bound <= fe.system_to_base_index (cell_idx).second) && (fe.system_to_base_index (cell_idx).second <= upper_bound)) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && (line * (degree + 1) <= face_idx) && (face_idx <= (line + 1) * (degree + 1) - 1))) { @@ -4767,7 +4767,7 @@ namespace VectorTools // If not using FESystem then must be using FE_Nedelec, // which has one base element and one copy of it (with 3 components). std::pair base_indices (0, 0); - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { unsigned int fe_index = 0; unsigned int fe_index_old = 0; @@ -4815,9 +4815,9 @@ namespace VectorTools for (unsigned int face_idx = 0; face_idx < fe.dofs_per_face; ++face_idx) { const unsigned int cell_idx = fe.face_to_cell_index (face_idx, face); - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (cell_idx).first == base_indices)) - || (dynamic_cast*> (&fe) != 0)) + || (dynamic_cast*> (&fe) != nullptr)) { associated_edge_dof_to_face_dof[associated_edge_dof_index] = face_idx; ++associated_edge_dof_index; @@ -4930,11 +4930,11 @@ namespace VectorTools const unsigned int face_idx = line*fe.dofs_per_line + line_idx; const unsigned int cell_idx = fe.face_to_cell_index(face_idx, face); // Check this cell_idx belongs to the correct base_element, component and line: - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (cell_idx).first == base_indices) && (lower_bound <= fe.system_to_base_index (cell_idx).second) && (fe.system_to_base_index (cell_idx).second <= upper_bound)) - || ((dynamic_cast*> (&fe) != 0) + || ((dynamic_cast*> (&fe) != nullptr) && (line * (degree + 1) <= face_idx) && (face_idx <= (line + 1) * (degree + 1) - 1))) { @@ -4969,9 +4969,9 @@ namespace VectorTools face_idx < fe.dofs_per_face; ++face_idx) { const unsigned int cell_idx = fe.face_to_cell_index (face_idx, face); - if (((dynamic_cast*> (&fe) != 0) + if (((dynamic_cast*> (&fe) != nullptr) && (fe.system_to_base_index (cell_idx).first == base_indices)) - || ((dynamic_cast*> (&fe) != 0))) + || ((dynamic_cast*> (&fe) != nullptr))) { associated_face_dof_to_face_dof[associated_face_dof_index] = face_idx; ++associated_face_dof_index; @@ -5160,17 +5160,17 @@ namespace VectorTools if (cell->face (face)->boundary_id () == boundary_component) { // If the FE is an FE_Nothing object there is no work to do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { return; } // This is only implemented for FE_Nedelec elements. // If the FE is a FESystem we cannot check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -5257,18 +5257,18 @@ namespace VectorTools if (cell->face (face)->boundary_id () == boundary_component) { // If the FE is an FE_Nothing object there is no work to do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) { return; } // This is only implemented for FE_Nedelec elements. // If the FE is a FESystem we cannot check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -5620,7 +5620,7 @@ namespace VectorTools // FE_Nothing object // there is no work to // do - if (dynamic_cast*> (&cell->get_fe ()) != 0) + if (dynamic_cast*> (&cell->get_fe ()) != nullptr) return; // This is only @@ -5629,11 +5629,11 @@ namespace VectorTools // element. If the FE is // a FESystem we cannot // check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -5693,11 +5693,11 @@ namespace VectorTools // element. If the FE is // a FESystem we cannot // check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -5784,11 +5784,11 @@ namespace VectorTools // element. If the FE is // a FESystem we cannot // check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -5831,11 +5831,11 @@ namespace VectorTools // element. If the FE is // a FESystem we cannot // check this. - if (dynamic_cast*> (&cell->get_fe ()) == 0) + if (dynamic_cast*> (&cell->get_fe ()) == nullptr) { typedef FiniteElement FEL; - AssertThrow (dynamic_cast*> (&cell->get_fe ()) != 0, + AssertThrow (dynamic_cast*> (&cell->get_fe ()) != nullptr, typename FEL::ExcInterpolationNotImplemented ()); } @@ -6650,7 +6650,7 @@ namespace VectorTools const std::vector > *constrained = no_normal_flux_constraints.get_constraint_entries((*it)[constrained_index]); // find components to which this index is constrained to - Assert(constrained != 0, ExcInternalError()); + Assert(constrained != nullptr, ExcInternalError()); Assert(constrained->size() < dim, ExcInternalError()); for (unsigned int c=0; csize(); ++c) { @@ -6801,7 +6801,7 @@ namespace VectorTools const dealii::FEValues &fe_values = data.x_fe_values.get_present_fe_values (); const unsigned int n_q_points = fe_values.n_quadrature_points; - if (weight!=0) + if (weight!=nullptr) { if (weight->n_components>1) weight->vector_value_list (fe_values.get_quadrature_points(), @@ -7067,7 +7067,7 @@ namespace VectorTools const unsigned int n_components = dof.get_fe().n_components(); - if (weight!=0) + if (weight!=nullptr) { Assert ((weight->n_components==1) || (weight->n_components==n_components), ExcDimensionMismatch(weight->n_components, n_components)); diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index aa6acad5dc..456962a9d0 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -74,13 +74,13 @@ ExceptionBase::ExceptionBase () function(""), cond(""), exc(""), - stacktrace (NULL), + stacktrace (nullptr), n_stacktrace_frames (0), what_str("") { #ifdef DEAL_II_HAVE_GLIBC_STACKTRACE for (unsigned int i=0; i uniform_distribution(0,1); - static boost::random::mt19937 rng(static_cast(std::time(0))); + static boost::random::mt19937 rng(static_cast(std::time(nullptr))); return uniform_distribution(rng); } diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 7e74c4964f..8c348ad8f8 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -586,7 +586,7 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, ? reinterpret_cast(&indices[0]) : - 0), + nullptr), 0, #ifdef DEAL_II_WITH_MPI Epetra_MpiComm(communicator) diff --git a/source/base/job_identifier.cc b/source/base/job_identifier.cc index 87f8c7559f..13df1dd755 100644 --- a/source/base/job_identifier.cc +++ b/source/base/job_identifier.cc @@ -28,7 +28,7 @@ JobIdentifier dealjobid; JobIdentifier::JobIdentifier() { - time_t t = std::time(0); + time_t t = std::time(nullptr); id = std::string("JobId "); #if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_GETHOSTNAME) diff --git a/source/base/logstream.cc b/source/base/logstream.cc index 77543746b3..e96f48ce09 100644 --- a/source/base/logstream.cc +++ b/source/base/logstream.cc @@ -48,7 +48,7 @@ LogStream deallog; LogStream::LogStream() : std_out(&std::cerr), - file(0), + file(nullptr), std_depth(0), file_depth(10000), print_utime(false), @@ -58,7 +58,7 @@ LogStream::LogStream() float_threshold(0.), offset(0), print_thread_id(false), - old_cerr(0), + old_cerr(nullptr), at_newline(true) { get_prefixes().push("DEAL:"); @@ -235,21 +235,21 @@ LogStream::attach(std::ostream &o, void LogStream::detach () { Threads::Mutex::ScopedLock lock(log_lock); - file = 0; + file = nullptr; } void LogStream::log_cerr () { Threads::Mutex::ScopedLock lock(log_lock); - if (old_cerr == 0) + if (old_cerr == nullptr) { old_cerr = std::cerr.rdbuf(file->rdbuf()); } else { std::cerr.rdbuf(old_cerr); - old_cerr = 0; + old_cerr = nullptr; } } @@ -274,7 +274,7 @@ LogStream::get_file_stream() bool LogStream::has_file() const { - return (file != 0); + return (file != nullptr); } diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 0c2a6d7597..2291631db9 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -351,8 +351,8 @@ namespace Utilities #ifdef DEAL_II_WITH_P4EST //Initialize p4est and libsc components - sc_init(MPI_COMM_WORLD, 0, 0, NULL, SC_LP_SILENT); - p4est_init (0, SC_LP_SILENT); + sc_init(MPI_COMM_WORLD, 0, 0, nullptr, SC_LP_SILENT); + p4est_init (nullptr, SC_LP_SILENT); #endif constructor_has_already_run = true; diff --git a/source/base/multithread_info.cc b/source/base/multithread_info.cc index 6e5d146c0f..60026df181 100644 --- a/source/base/multithread_info.cc +++ b/source/base/multithread_info.cc @@ -112,7 +112,7 @@ void MultithreadInfo::set_thread_limit(const unsigned int max_threads) // then also see if something was given in the environment { const char *penv = getenv ("DEAL_II_NUM_THREADS"); - if (penv!=NULL) + if (penv!=nullptr) { unsigned int max_threads_env = numbers::invalid_unsigned_int; try diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index e1c6bfd40e..a197206a23 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -79,44 +79,44 @@ namespace Patterns PatternBase *p; p = Integer::create(description); - if (p != 0) + if (p != nullptr) return p; p = Double::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = Selection::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = List::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = MultipleSelection::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = Bool::create(description); - if (p!=0 ) + if (p!=nullptr ) return p; p = Anything::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = FileName::create(description); - if (p !=0 ) + if (p !=nullptr ) return p; p = DirectoryName::create(description); - if (p!=0 ) + if (p!=nullptr ) return p; Assert(false, ExcNotImplemented()); - return 0; + return nullptr; } @@ -128,13 +128,13 @@ namespace Patterns std::size_t PatternBase::memory_consumption () const { - if (dynamic_cast(this) != 0) + if (dynamic_cast(this) != nullptr) return sizeof(Integer); - else if (dynamic_cast(this) != 0) + else if (dynamic_cast(this) != nullptr) return sizeof(Double); - else if (dynamic_cast(this) != 0) + else if (dynamic_cast(this) != nullptr) return sizeof(Bool); - else if (dynamic_cast(this) != 0) + else if (dynamic_cast(this) != nullptr) return sizeof(Anything); else return sizeof(*this) + 32; @@ -276,7 +276,7 @@ namespace Patterns return new Integer(); } else - return 0; + return nullptr; } @@ -416,9 +416,9 @@ namespace Patterns { const std::string description_init_str = description_init; if (description.compare(0, description_init_str.size(), description_init_str) != 0) - return NULL; + return nullptr; if (*description.rbegin() != ']') - return NULL; + return nullptr; std::string temp = description.substr(description_init_str.size()); if (temp == "]") @@ -437,7 +437,7 @@ namespace Patterns { // parse lower bound and give up if not a double if (!(is >> lower_bound)) - return NULL; + return nullptr; } // ignore failure here and assume we got MAX_DOUBLE as upper bound: @@ -558,7 +558,7 @@ namespace Patterns return new Selection(sequence); } else - return 0; + return nullptr; } @@ -590,7 +590,7 @@ namespace Patterns List::~List () { delete pattern; - pattern = 0; + pattern = nullptr; } @@ -733,7 +733,7 @@ namespace Patterns return new List(*base_pattern, min_elements, max_elements, separator); } else - return 0; + return nullptr; } @@ -770,10 +770,10 @@ namespace Patterns Map::~Map () { delete key_pattern; - key_pattern = 0; + key_pattern = nullptr; delete value_pattern; - value_pattern = 0; + value_pattern = nullptr; } @@ -955,7 +955,7 @@ namespace Patterns separator); } else - return 0; + return nullptr; } @@ -1103,7 +1103,7 @@ namespace Patterns return new MultipleSelection(sequence); } else - return 0; + return nullptr; } @@ -1159,7 +1159,7 @@ namespace Patterns if (description.compare(0, std::strlen(description_init), description_init) == 0) return new Bool(); else - return 0; + return nullptr; } @@ -1220,7 +1220,7 @@ namespace Patterns if (description.compare(0, std::strlen(description_init), description_init) == 0) return new Anything(); else - return 0; + return nullptr; } @@ -1304,7 +1304,7 @@ namespace Patterns return new FileName(type); } else - return 0; + return nullptr; } @@ -1364,7 +1364,7 @@ namespace Patterns if (description.compare(0, std::strlen(description_init), description_init) == 0) return new DirectoryName(); else - return 0; + return nullptr; } } // end namespace Patterns diff --git a/source/base/path_search.cc b/source/base/path_search.cc index ed006f1a5e..5ad6712830 100644 --- a/source/base/path_search.cc +++ b/source/base/path_search.cc @@ -135,7 +135,7 @@ PathSearch::find (const std::string &filename, deallog << "PathSearch[" << cls << "] trying " << real_name << std::endl; FILE *fp = fopen(real_name.c_str(), open_mode); - if (fp != 0) + if (fp != nullptr) { if (debug > 0) deallog << "PathSearch[" << cls << "] opened " @@ -154,7 +154,7 @@ PathSearch::find (const std::string &filename, deallog << "PathSearch[" << cls << "] trying " << real_name << std::endl; FILE *fp = fopen(real_name.c_str(), open_mode); - if (fp != 0) + if (fp != nullptr) { if (debug > 0) deallog << "PathSearch[" << cls << "] opened " diff --git a/source/base/polynomial.cc b/source/base/polynomial.cc index 2ec390e1db..91285c50aa 100644 --- a/source/base/polynomial.cc +++ b/source/base/polynomial.cc @@ -371,7 +371,7 @@ namespace Polynomials // well if necessary. copy the polynomial to // do this std::shared_ptr > q_data; - const Polynomial *q = 0; + const Polynomial *q = nullptr; if (p.in_lagrange_product_form == true) { q_data.reset (new Polynomial(p)); @@ -415,7 +415,7 @@ namespace Polynomials // well if necessary. copy the polynomial to // do this std::shared_ptr > q_data; - const Polynomial *q = 0; + const Polynomial *q = nullptr; if (p.in_lagrange_product_form == true) { q_data.reset (new Polynomial(p)); @@ -451,7 +451,7 @@ namespace Polynomials // well if necessary. copy the polynomial to // do this std::shared_ptr > q_data; - const Polynomial *q = 0; + const Polynomial *q = nullptr; if (p.in_lagrange_product_form == true) { q_data.reset (new Polynomial(p)); @@ -598,7 +598,7 @@ namespace Polynomials return Monomial(0, 0.); std::shared_ptr > q_data; - const Polynomial *q = 0; + const Polynomial *q = nullptr; if (in_lagrange_product_form == true) { q_data.reset (new Polynomial(*this)); @@ -624,7 +624,7 @@ namespace Polynomials // no simple form possible for Lagrange // polynomial on product form std::shared_ptr > q_data; - const Polynomial *q = 0; + const Polynomial *q = nullptr; if (in_lagrange_product_form == true) { q_data.reset (new Polynomial(*this)); @@ -753,7 +753,7 @@ namespace Polynomials unsigned int n_functions=n+1; Assert(support_point= k+1) && - (recursive_coefficients[k].get() == 0)) ) + (recursive_coefficients[k].get() == nullptr)) ) // no, then generate the // respective coefficients { diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index e0ed16198e..e249163e80 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -47,7 +47,7 @@ static const char *unknown_subscriber = "unknown subscriber"; Subscriptor::Subscriptor () : counter (0), - object_info (0) + object_info (nullptr) { // this has to go somewhere to avoid an extra warning. (void)unknown_subscriber; @@ -58,7 +58,7 @@ Subscriptor::Subscriptor () Subscriptor::Subscriptor (const Subscriptor &) : counter (0), - object_info (0) + object_info (nullptr) {} @@ -165,7 +165,7 @@ void Subscriptor::subscribe(const char *id) const { #ifdef DEBUG - if (object_info == 0) + if (object_info == nullptr) object_info = &typeid(*this); Threads::Mutex::ScopedLock lock (subscription_lock); ++counter; @@ -192,7 +192,7 @@ void Subscriptor::unsubscribe(const char *id) const { #ifdef DEBUG - const char *name = (id != 0) ? id : unknown_subscriber; + const char *name = (id != nullptr) ? id : unknown_subscriber; AssertNothrow (counter>0, ExcNoSubscriber(object_info->name(), name)); // This is for the case that we do // not abort after the exception diff --git a/source/base/thread_management.cc b/source/base/thread_management.cc index c2c0aad9ac..f60db61786 100644 --- a/source/base/thread_management.cc +++ b/source/base/thread_management.cc @@ -167,7 +167,7 @@ namespace Threads const char *, void *) { - pthread_barrier_init (&barrier, 0, count); + pthread_barrier_init (&barrier, nullptr, count); } #else diff --git a/source/base/timer.cc b/source/base/timer.cc index eab168a149..6f877448d6 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -141,7 +141,7 @@ void Timer::start () //TODO: Break this out into a function like the functions in //namespace windows above struct timeval wall_timer; - gettimeofday(&wall_timer, NULL); + gettimeofday(&wall_timer, nullptr); start_wall_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec; rusage usage; @@ -184,7 +184,7 @@ double Timer::stop () cumulative_time += dtime_children - start_time_children; struct timeval wall_timer; - gettimeofday(&wall_timer, NULL); + gettimeofday(&wall_timer, nullptr); last_lap_time = wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec - start_wall_time; #elif defined(DEAL_II_MSVC) @@ -263,7 +263,7 @@ double Timer::wall_time () const { #if defined(DEAL_II_HAVE_SYS_TIME_H) && defined(DEAL_II_HAVE_SYS_RESOURCE_H) struct timeval wall_timer; - gettimeofday(&wall_timer, NULL); + gettimeofday(&wall_timer, nullptr); return (wall_timer.tv_sec + 1.e-6 * wall_timer.tv_usec - start_wall_time diff --git a/source/base/utilities.cc b/source/base/utilities.cc index df61f53b8e..301ec99aba 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -659,7 +659,7 @@ namespace Utilities std::string get_time () { - std::time_t time1= std::time (0); + std::time_t time1= std::time (nullptr); std::tm *time = std::localtime(&time1); std::ostringstream o; @@ -674,7 +674,7 @@ namespace Utilities std::string get_date () { - std::time_t time1= std::time (0); + std::time_t time1= std::time (nullptr); std::tm *time = std::localtime(&time1); std::ostringstream o; @@ -693,7 +693,7 @@ namespace Utilities const int ierr = ::posix_memalign (memptr, alignment, size); AssertThrow (ierr == 0, ExcOutOfMemory()); - AssertThrow (*memptr != 0, ExcOutOfMemory()); + AssertThrow (*memptr != nullptr, ExcOutOfMemory()); #else // Windows does not appear to have posix_memalign. just use the // regular malloc in that case @@ -758,7 +758,7 @@ namespace Utilities // return a duplicate of it const Epetra_MpiComm *mpi_comm = dynamic_cast(&communicator); - if (mpi_comm != 0) + if (mpi_comm != nullptr) return new Epetra_MpiComm(Utilities::MPI:: duplicate_communicator(mpi_comm->GetMpiComm())); #endif @@ -768,7 +768,7 @@ namespace Utilities // not an MPI communicator, return a // copy of the same object again Assert (dynamic_cast(&communicator) - != 0, + != nullptr, ExcInternalError()); return new Epetra_SerialComm(dynamic_cast(communicator)); } @@ -782,7 +782,7 @@ namespace Utilities #ifdef DEAL_II_WITH_MPI Epetra_MpiComm *mpi_comm = dynamic_cast(&communicator); - if (mpi_comm != 0) + if (mpi_comm != nullptr) { MPI_Comm comm = mpi_comm->GetMpiComm(); *mpi_comm = Epetra_MpiComm(MPI_COMM_SELF); diff --git a/source/distributed/p4est_wrappers.cc b/source/distributed/p4est_wrappers.cc index 94518a9095..a0cef5fe5d 100644 --- a/source/distributed/p4est_wrappers.cc +++ b/source/distributed/p4est_wrappers.cc @@ -442,7 +442,7 @@ namespace internal void *user_data) { p4est_iterate (parallel_forest, parallel_ghost, user_data, - NULL, + nullptr, find_ghosts_face<2,spacedim>, find_ghosts_corner<2,spacedim>); } @@ -644,7 +644,7 @@ namespace internal void *user_data) { p8est_iterate (parallel_forest, parallel_ghost, user_data, - NULL, + nullptr, find_ghosts_face<3,spacedim>, find_ghosts_edge<3,spacedim>, find_ghosts_corner<3,spacedim>); diff --git a/source/distributed/shared_tria.cc b/source/distributed/shared_tria.cc index 190c0204f2..bef870a3a0 100644 --- a/source/distributed/shared_tria.cc +++ b/source/distributed/shared_tria.cc @@ -272,7 +272,7 @@ namespace parallel Triangulation:: copy_triangulation (const dealii::Triangulation &other_tria) { - Assert ((dynamic_cast *>(&other_tria) == NULL), + Assert ((dynamic_cast *>(&other_tria) == nullptr), ExcMessage("Cannot use this function on parallel::distributed::Triangulation.")); dealii::parallel::Triangulation::copy_triangulation (other_tria); diff --git a/source/distributed/solution_transfer.cc b/source/distributed/solution_transfer.cc index 99b9628a0f..d5a1acbbaf 100644 --- a/source/distributed/solution_transfer.cc +++ b/source/distributed/solution_transfer.cc @@ -50,7 +50,7 @@ namespace parallel offset (numbers::invalid_unsigned_int) { Assert (dynamic_cast*> - (&dof_handler->get_triangulation()) != 0, + (&dof_handler->get_triangulation()) != nullptr, ExcMessage("parallel::distributed::SolutionTransfer requires a parallel::distributed::Triangulation object.")); } @@ -84,7 +84,7 @@ namespace parallel = (dynamic_cast*> (const_cast*> (&dof_handler->get_triangulation()))); - Assert (tria != 0, ExcInternalError()); + Assert (tria != nullptr, ExcInternalError()); offset = tria->register_data_attach(size, @@ -165,7 +165,7 @@ namespace parallel = (dynamic_cast*> (const_cast*> (&dof_handler->get_triangulation()))); - Assert (tria != 0, ExcInternalError()); + Assert (tria != nullptr, ExcInternalError()); tria->notify_ready_to_unpack(offset, std::bind(&SolutionTransfer::ghost_destroy (parallel_ghost); - parallel_ghost = 0; + parallel_ghost = nullptr; } - if (parallel_forest != 0) + if (parallel_forest != nullptr) { dealii::internal::p4est::functions::destroy (parallel_forest); - parallel_forest = 0; + parallel_forest = nullptr; } - if (connectivity != 0) + if (connectivity != nullptr) { dealii::internal::p4est::functions::connectivity_destroy (connectivity); - connectivity = 0; + connectivity = nullptr; } coarse_cell_to_p4est_tree_permutation.resize (0); @@ -1753,10 +1753,10 @@ namespace parallel void Triangulation::write_mesh_vtk (const char *file_basename) const { - Assert (parallel_forest != 0, + Assert (parallel_forest != nullptr, ExcMessage ("Can't produce output when no forest is created yet.")); dealii::internal::p4est::functions:: - vtk_write_file (parallel_forest, 0, file_basename); + vtk_write_file (parallel_forest, nullptr, file_basename); } @@ -1803,7 +1803,7 @@ namespace parallel // and release the data void *userptr = parallel_forest->user_pointer; - dealii::internal::p4est::functions::reset_data (parallel_forest, 0, NULL, NULL); + dealii::internal::p4est::functions::reset_data (parallel_forest, 0, nullptr, nullptr); parallel_forest->user_pointer = userptr; } @@ -1818,15 +1818,15 @@ namespace parallel Assert(this->n_levels()==1, ExcMessage("Triangulation may only contain coarse cells when calling load().")); - if (parallel_ghost != 0) + if (parallel_ghost != nullptr) { dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); - parallel_ghost = 0; + parallel_ghost = nullptr; } dealii::internal::p4est::functions::destroy (parallel_forest); - parallel_forest = 0; + parallel_forest = nullptr; dealii::internal::p4est::functions::connectivity_destroy (connectivity); - connectivity = 0; + connectivity = nullptr; unsigned int version, numcpus, attached_size, attached_count, n_coarse_cells; { @@ -1897,7 +1897,7 @@ namespace parallel unsigned int Triangulation::get_checksum () const { - Assert (parallel_forest != 0, + Assert (parallel_forest != nullptr, ExcMessage ("Can't produce a check sum when no forest is created yet.")); return dealii::internal::p4est::functions::checksum (parallel_forest); } @@ -2059,7 +2059,7 @@ namespace parallel /* minimum level of upfront refinement */ 0, /* use uniform upfront refinement */ 1, /* user_data_size = */ 0, - /* user_data_constructor = */ NULL, + /* user_data_constructor = */ nullptr, /* user_pointer */ this); } @@ -2130,7 +2130,7 @@ namespace parallel /* minimum level of upfront refinement */ 0, /* use uniform upfront refinement */ 1, /* user_data_size = */ 0, - /* user_data_constructor = */ NULL, + /* user_data_constructor = */ nullptr, /* user_pointer */ this); } @@ -2282,7 +2282,7 @@ namespace parallel /* minimum level of upfront refinement */ 0, /* use uniform upfront refinement */ 1, /* user_data_size = */ 0, - /* user_data_constructor = */ NULL, + /* user_data_constructor = */ nullptr, /* user_pointer */ this); } @@ -2576,10 +2576,10 @@ namespace parallel // query p4est for the ghost cells - if (parallel_ghost != 0) + if (parallel_ghost != nullptr) { dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); - parallel_ghost = 0; + parallel_ghost = nullptr; } parallel_ghost = dealii::internal::p4est::functions::ghost_new (parallel_forest, (dim == 2 @@ -2897,19 +2897,19 @@ namespace parallel ExcInternalError()); parallel_forest->user_pointer = &refine_and_coarsen_list; - if (parallel_ghost != 0) + if (parallel_ghost != nullptr) { dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); - parallel_ghost = 0; + parallel_ghost = nullptr; } dealii::internal::p4est::functions:: refine (parallel_forest, /* refine_recursive */ false, &RefineAndCoarsenList::refine_callback, - /*init_callback=*/NULL); + /*init_callback=*/nullptr); dealii::internal::p4est::functions:: coarsen (parallel_forest, /* coarsen_recursive */ false, &RefineAndCoarsenList::coarsen_callback, - /*init_callback=*/NULL); + /*init_callback=*/nullptr); // make sure all cells in the lists have been consumed Assert (refine_and_coarsen_list.pointers_are_at_end(), @@ -2929,7 +2929,7 @@ namespace parallel : typename dealii::internal::p4est::types:: balance_type(P8EST_CONNECT_FULL)), - /*init_callback=*/NULL); + /*init_callback=*/nullptr); // before repartitioning the mesh let others attach mesh related info // (such as SolutionTransfer data) to the p4est @@ -2943,7 +2943,7 @@ namespace parallel dealii::internal::p4est::functions:: partition (parallel_forest, /* prepare coarsening */ 1, - /* weight_callback */ NULL); + /* weight_callback */ nullptr); else { // get cell weights for a weighted repartitioning. @@ -3070,7 +3070,7 @@ namespace parallel dealii::internal::p4est::functions:: partition (parallel_forest, /* prepare coarsening */ 1, - /* weight_callback */ NULL); + /* weight_callback */ nullptr); } else { @@ -3357,7 +3357,7 @@ namespace parallel // and release the data void *userptr = parallel_forest->user_pointer; - dealii::internal::p4est::functions::reset_data (parallel_forest, 0, NULL, NULL); + dealii::internal::p4est::functions::reset_data (parallel_forest, 0, nullptr, nullptr); parallel_forest->user_pointer = userptr; } } @@ -3645,7 +3645,7 @@ namespace parallel /* minimum level of upfront refinement */ 0, /* use uniform upfront refinement */ 1, /* user_data_size = */ 0, - /* user_data_constructor = */ NULL, + /* user_data_constructor = */ nullptr, /* user_pointer */ this); @@ -3782,7 +3782,7 @@ namespace parallel void *userptr = parallel_forest->user_pointer; dealii::internal::p4est::functions::reset_data (parallel_forest, attached_data_size+sizeof(CellStatus), - NULL, NULL); + nullptr, nullptr); parallel_forest->user_pointer = userptr; diff --git a/source/dofs/dof_accessor.cc b/source/dofs/dof_accessor.cc index 6cbbe59968..369208cc59 100644 --- a/source/dofs/dof_accessor.cc +++ b/source/dofs/dof_accessor.cc @@ -48,7 +48,7 @@ DoFCellAccessor::update_cell_dof_indices_cache () const Assert (static_cast(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); + Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); internal::DoFCellAccessor::Implementation:: update_cell_dof_indices_cache (*this); @@ -63,7 +63,7 @@ DoFCellAccessor::set_dof_indices (const std::vector(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); + Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); internal::DoFCellAccessor::Implementation:: set_dof_indices (*this, local_dof_indices); diff --git a/source/dofs/dof_accessor_get.cc b/source/dofs/dof_accessor_get.cc index e1d339e1ad..6015c62374 100644 --- a/source/dofs/dof_accessor_get.cc +++ b/source/dofs/dof_accessor_get.cc @@ -53,7 +53,7 @@ get_interpolated_dof_values (const InputVector &values, { if ((dynamic_cast*> (this->dof_handler) - != 0) + != nullptr) || // for hp-DoFHandlers, we need to require that on // active cells, you either don't specify an fe_index, @@ -89,7 +89,7 @@ get_interpolated_dof_values (const InputVector &values, // fe_index is given Assert ((dynamic_cast*> (this->dof_handler) - != 0) + != nullptr) || (fe_index != DoFHandlerType::default_fe_index), ExcMessage ("You cannot call this function on non-active cells " @@ -102,7 +102,7 @@ get_interpolated_dof_values (const InputVector &values, const FiniteElement &fe = this->get_dof_handler().get_fe()[fe_index]; const unsigned int dofs_per_cell = fe.dofs_per_cell; - Assert (this->dof_handler != 0, + Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); Assert (interpolated_values.size() == dofs_per_cell, typename BaseClass::ExcVectorDoesNotMatch()); diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index 9a5109af3a..33e885e5c5 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -50,7 +50,7 @@ set_dof_values_by_interpolation (const Vector &local_values, { if ((dynamic_cast*> (this->dof_handler) - != 0) + != nullptr) || // for hp-DoFHandlers, we need to require that on // active cells, you either don't specify an fe_index, @@ -86,7 +86,7 @@ set_dof_values_by_interpolation (const Vector &local_values, { Assert ((dynamic_cast*> (this->dof_handler) - != 0) + != nullptr) || (fe_index != DoFHandlerType::default_fe_index), ExcMessage ("You cannot call this function on non-active cells " @@ -99,7 +99,7 @@ set_dof_values_by_interpolation (const Vector &local_values, const FiniteElement &fe = this->get_dof_handler().get_fe()[fe_index]; const unsigned int dofs_per_cell = fe.dofs_per_cell; - Assert (this->dof_handler != 0, + Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject()); Assert (local_values.size() == dofs_per_cell, typename BaseClass::ExcVectorDoesNotMatch()); diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 2031a70fec..ae731e3ce2 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -654,20 +654,20 @@ template DoFHandler::DoFHandler (const Triangulation &tria) : tria(&tria, typeid(*this).name()), - selected_fe(0, typeid(*this).name()), - faces(NULL), - mg_faces (NULL) + selected_fe(nullptr, typeid(*this).name()), + faces(nullptr), + mg_faces (nullptr) { // decide whether we need a // sequential or a parallel // distributed policy if (dynamic_cast*> (&tria) - != 0) + != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelShared()); else if (dynamic_cast*> (&tria) - == 0) + == nullptr) policy.reset (new internal::DoFHandler::Policy::Sequential()); else policy.reset (new internal::DoFHandler::Policy::ParallelDistributed()); @@ -677,10 +677,10 @@ DoFHandler::DoFHandler (const Triangulation &tria) template DoFHandler::DoFHandler () : - tria(0, typeid(*this).name()), - selected_fe(0, typeid(*this).name()), - faces(NULL), - mg_faces (NULL) + tria(nullptr, typeid(*this).name()), + selected_fe(nullptr, typeid(*this).name()), + faces(nullptr), + mg_faces (nullptr) {} @@ -699,7 +699,7 @@ DoFHandler::initialize( const FiniteElement &fe) { tria = &t; - faces = 0; + faces = nullptr; number_cache.n_global_dofs = 0; // decide whether we need a @@ -707,11 +707,11 @@ DoFHandler::initialize( // distributed policy if (dynamic_cast*> (&t) - != 0) + != nullptr) policy.reset (new internal::DoFHandler::Policy::ParallelShared()); else if (dynamic_cast*> (&t) - == 0) + == nullptr) policy.reset (new internal::DoFHandler::Policy::Sequential()); else policy.reset (new internal::DoFHandler::Policy::ParallelDistributed()); @@ -1064,7 +1064,7 @@ DoFHandler::memory_consumption () const for (unsigned int level = 0; level < mg_levels.size (); ++level) mem += mg_levels[level]->memory_consumption (); - if (mg_faces != 0) + if (mg_faces != nullptr) mem += MemoryConsumption::memory_consumption (*mg_faces); for (unsigned int i = 0; i < mg_vertex_dofs.size (); ++i) @@ -1106,7 +1106,7 @@ void DoFHandler::distribute_dofs (const FiniteElement*>(&*tria) == 0) + if (dynamic_cast*>(&*tria) == nullptr) block_info_object.initialize(*this, false, true); } @@ -1140,7 +1140,7 @@ void DoFHandler::distribute_mg_dofs (const FiniteElement*>(&*tria) == 0) + if (dynamic_cast*>(&*tria) == nullptr) block_info_object.initialize (*this, true, false); } @@ -1158,7 +1158,7 @@ void DoFHandler::clear_mg_space () mg_levels.clear (); delete mg_faces; - mg_faces = NULL; + mg_faces = nullptr; std::vector tmp; @@ -1180,7 +1180,7 @@ template void DoFHandler::clear () { // release lock to old fe - selected_fe = 0; + selected_fe = nullptr; // release memory clear_space (); @@ -1482,7 +1482,7 @@ void DoFHandler::clear_space () levels.resize (0); delete faces; - faces = 0; + faces = nullptr; std::vector tmp; std::swap (vertex_dofs, tmp); @@ -1514,7 +1514,7 @@ void DoFHandler::set_dof_index (const unsigned int obj_level, con template -DoFHandler::MGVertexDoFs::MGVertexDoFs (): coarsest_level (numbers::invalid_unsigned_int), finest_level (0), indices (0), indices_offset (0) +DoFHandler::MGVertexDoFs::MGVertexDoFs (): coarsest_level (numbers::invalid_unsigned_int), finest_level (0), indices (nullptr), indices_offset (nullptr) { } @@ -1529,16 +1529,16 @@ DoFHandler::MGVertexDoFs::~MGVertexDoFs () template void DoFHandler::MGVertexDoFs::init (const unsigned int cl, const unsigned int fl, const unsigned int dofs_per_vertex) { - if (indices != 0) + if (indices != nullptr) { delete[] indices; - indices = 0; + indices = nullptr; } - if (indices_offset != 0) + if (indices_offset != nullptr) { delete[] indices_offset; - indices_offset = 0; + indices_offset = nullptr; } coarsest_level = cl; @@ -1551,13 +1551,13 @@ void DoFHandler::MGVertexDoFs::init (const unsigned int cl, const const unsigned int n_indices = n_levels * dofs_per_vertex; indices = new types::global_dof_index[n_indices]; - Assert (indices != 0, ExcNoMemory ()); + Assert (indices != nullptr, ExcNoMemory ()); for (unsigned int i = 0; i < n_indices; ++i) indices[i] = DoFHandler::invalid_dof_index; indices_offset = new types::global_dof_index[n_levels]; - Assert (indices != 0, ExcNoMemory ()); + Assert (indices != nullptr, ExcNoMemory ()); for (unsigned int i = 0; i < n_levels; ++i) indices_offset[i] = i * dofs_per_vertex; diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index c9ad02a385..2070b4e5bb 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1050,7 +1050,7 @@ namespace internal // and then turn artificial cells on at the end of this function. const parallel::shared::Triangulation *tr = (dynamic_cast*> (&dof_handler.get_triangulation())); - Assert(tr != 0, ExcInternalError()); + Assert(tr != nullptr, ExcInternalError()); typename parallel::shared::Triangulation::active_cell_iterator cell = dof_handler.get_triangulation().begin_active(), endc = dof_handler.get_triangulation().end(); @@ -1116,7 +1116,7 @@ namespace internal // case artificial cells are present. const parallel::shared::Triangulation *tr = (dynamic_cast*> (&dof_handler.get_triangulation())); - Assert(tr != 0, ExcInternalError()); + Assert(tr != nullptr, ExcInternalError()); typename parallel::shared::Triangulation::active_cell_iterator cell = dof_handler.get_triangulation().begin_active(), endc = dof_handler.get_triangulation().end(); @@ -1872,7 +1872,7 @@ namespace internal const parallel::distributed::Triangulation< dim, spacedim > *tr = (dynamic_cast*> (&dof_handler.get_triangulation())); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); // now collect cells and their // dof_indices for the @@ -2096,7 +2096,7 @@ namespace internal = (dynamic_cast*> (const_cast*> (&dof_handler.get_triangulation()))); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); const unsigned int n_cpus = Utilities::MPI::n_mpi_processes (tr->get_communicator()); @@ -2319,7 +2319,7 @@ namespace internal = (dynamic_cast*> (const_cast*> (&dof_handler.get_triangulation()))); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); AssertThrow( (tr->settings & parallel::distributed::Triangulation< dim, spacedim >::construct_multigrid_hierarchy), @@ -2699,7 +2699,7 @@ namespace internal = (dynamic_cast*> (const_cast*> (&dof_handler.get_triangulation()))); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); std::vector user_flags; tr->save_user_flags(user_flags); diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 19314c16c1..4d7c9b9d01 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -559,7 +559,7 @@ namespace DoFTools { Assert ((dynamic_cast*> (&dof_handler.get_triangulation()) - == 0), + == nullptr), ExcMessage ("This function can not be used with distributed triangulations." "See the documentation for more information.")); @@ -1172,7 +1172,7 @@ namespace DoFTools // ask is for its locally owned subdomain Assert ((dynamic_cast *> - (&dof_handler.get_triangulation()) == 0), + (&dof_handler.get_triangulation()) == nullptr), ExcMessage ("For parallel::distributed::Triangulation objects and " "associated DoF handler objects, asking for any information " "related to a subdomain other than the locally owned one does " @@ -1189,7 +1189,7 @@ namespace DoFTools // is non-empty (n_dofs()>0). const unsigned int n_subdomains = (dynamic_cast *> - (&dof_handler.get_triangulation()) == 0 + (&dof_handler.get_triangulation()) == nullptr ? (1+*std::max_element (subdomain_association.begin (), subdomain_association.end ())) @@ -1249,7 +1249,7 @@ namespace DoFTools // ask is for its locally owned subdomain Assert ((dynamic_cast *> - (&dof_handler.get_triangulation()) == 0), + (&dof_handler.get_triangulation()) == nullptr), ExcMessage ("For parallel::distributed::Triangulation objects and " "associated DoF handler objects, asking for any information " "related to a subdomain other than the locally owned one does " @@ -1313,7 +1313,7 @@ namespace DoFTools // ask is for its locally owned subdomain Assert ((dynamic_cast *> - (&dof_handler.get_triangulation()) == 0), + (&dof_handler.get_triangulation()) == nullptr), ExcMessage ("For parallel::distributed::Triangulation objects and " "associated DoF handler objects, asking for any subdomain other " "than the locally owned one does not make sense.")); @@ -1965,7 +1965,7 @@ namespace DoFTools Assert ((dynamic_cast*> (&dof_handler.get_triangulation()) == - 0), + nullptr), ExcMessage ("This function can not be used with distributed triangulations." "See the documentation for more information.")); @@ -1989,7 +1989,7 @@ namespace DoFTools Assert ((dynamic_cast*> (&dof_handler.get_triangulation()) == - 0), + nullptr), ExcMessage ("This function can not be used with distributed triangulations." "See the documentation for more information.")); diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 2960525c8c..1726815266 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -1040,7 +1040,7 @@ namespace DoFTools get_fe_collection (const dealii::DoFHandler &) { Assert(false, ExcInternalError()); - return NULL; + return nullptr; } } diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 0ed9628156..38012593ce 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -310,8 +310,8 @@ namespace DoFTools // there are only 2 boundary indicators in 1d, so it is no // performance problem to call the other function std::map*> boundary_ids; - boundary_ids[0] = 0; - boundary_ids[1] = 0; + boundary_ids[0] = nullptr; + boundary_ids[1] = nullptr; make_boundary_sparsity_pattern (dof, boundary_ids, diff --git a/source/fe/fe_bernstein.cc b/source/fe/fe_bernstein.cc index dd04142a5a..68cbe82bff 100644 --- a/source/fe/fe_bernstein.cc +++ b/source/fe/fe_bernstein.cc @@ -181,7 +181,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe Assert (std::fabs(sum-1) < eps, ExcInternalError()); } } - else if (dynamic_cast *>(&x_source_fe) != 0) + else if (dynamic_cast *>(&x_source_fe) != nullptr) { // nothing to do here, the FE_Nothing has no degrees of freedom anyway } @@ -208,13 +208,13 @@ FE_Bernstein::hp_vertex_dof_identities (const FiniteElement*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) { return std::vector > (1, std::make_pair (0U, 0U)); } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no degrees of freedom, so there are no // equivalencies to be recorded diff --git a/source/fe/fe_dgp.cc b/source/fe/fe_dgp.cc index f7ac1517f0..657e93511a 100644 --- a/source/fe/fe_dgp.cc +++ b/source/fe/fe_dgp.cc @@ -107,7 +107,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, typedef FE_DGP FEDGP; AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) || - (dynamic_cast(&x_source_fe) != 0), + (dynamic_cast(&x_source_fe) != nullptr), typename FE:: ExcInterpolationNotImplemented()); @@ -137,7 +137,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe typedef FE_DGP FEDGP; AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) || - (dynamic_cast(&x_source_fe) != 0), + (dynamic_cast(&x_source_fe) != nullptr), typename FE:: ExcInterpolationNotImplemented()); @@ -166,7 +166,7 @@ FE_DGP:: hp_vertex_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGP elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -184,7 +184,7 @@ FE_DGP:: hp_line_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGP elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -202,7 +202,7 @@ FE_DGP:: hp_quad_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGP elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -220,7 +220,7 @@ FE_DGP::compare_for_face_domination (const FiniteElement*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return FiniteElementDomination::no_requirements; Assert (false, ExcNotImplemented()); diff --git a/source/fe/fe_dgp_monomial.cc b/source/fe/fe_dgp_monomial.cc index ecf3b95ea6..2cbdf9d49d 100644 --- a/source/fe/fe_dgp_monomial.cc +++ b/source/fe/fe_dgp_monomial.cc @@ -260,7 +260,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, (void)interpolation_matrix; AssertThrow ((x_source_fe.get_name().find ("FE_DGPMonomial<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FiniteElement:: ExcInterpolationNotImplemented()); @@ -290,7 +290,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, (void)interpolation_matrix; AssertThrow ((x_source_fe.get_name().find ("FE_DGPMonomial<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FiniteElement:: ExcInterpolationNotImplemented()); @@ -320,7 +320,7 @@ hp_vertex_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGPMonomial // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -339,7 +339,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGPMonomial // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -358,7 +358,7 @@ hp_quad_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGPMonomial // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -379,7 +379,7 @@ compare_for_face_domination (const FiniteElement &fe_other) const // elements, see // the description of // FiniteElementDomination::Domination - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return FiniteElementDomination::no_requirements; Assert (false, ExcNotImplemented()); diff --git a/source/fe/fe_dgp_nonparametric.cc b/source/fe/fe_dgp_nonparametric.cc index 9bb2c12e2b..6caa4839cd 100644 --- a/source/fe/fe_dgp_nonparametric.cc +++ b/source/fe/fe_dgp_nonparametric.cc @@ -432,7 +432,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, typedef FiniteElement FEE; AssertThrow ((x_source_fe.get_name().find ("FE_DGPNonparametric<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FEE:: ExcInterpolationNotImplemented()); @@ -463,7 +463,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe typedef FiniteElement FEE; AssertThrow ((x_source_fe.get_name().find ("FE_DGPNonparametric<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FEE:: ExcInterpolationNotImplemented()); @@ -493,7 +493,7 @@ hp_vertex_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGPNonparametric // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -512,7 +512,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const { // there are no such constraints for DGPNonparametric // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -531,7 +531,7 @@ hp_quad_dof_identities (const FiniteElement &fe_other) cons { // there are no such constraints for DGPNonparametric // elements at all - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return std::vector > (); else @@ -551,7 +551,7 @@ compare_for_face_domination (const FiniteElement &fe_other) const // check whether both are discontinuous // elements, see the description of // FiniteElementDomination::Domination - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) return FiniteElementDomination::no_requirements; Assert (false, ExcNotImplemented()); diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index bc9159982d..495cc48a92 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -239,7 +239,7 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, // source FE is also a // DGQ element typedef FiniteElement FE; - AssertThrow ((dynamic_cast*>(&x_source_fe) != 0), + AssertThrow ((dynamic_cast*>(&x_source_fe) != nullptr), typename FE::ExcInterpolationNotImplemented() ); // ok, source is a Q element, so @@ -326,7 +326,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, // much we need to do here. (void)interpolation_matrix; typedef FiniteElement FE; - AssertThrow ((dynamic_cast*>(&x_source_fe) != 0), + AssertThrow ((dynamic_cast*>(&x_source_fe) != nullptr), typename FE::ExcInterpolationNotImplemented()); Assert (interpolation_matrix.m() == 0, @@ -354,7 +354,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_f // much we need to do here. (void)interpolation_matrix; typedef FiniteElement FE; - AssertThrow ((dynamic_cast*>(&x_source_fe) != 0), + AssertThrow ((dynamic_cast*>(&x_source_fe) != nullptr), typename FE::ExcInterpolationNotImplemented()); Assert (interpolation_matrix.m() == 0, diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index 1fa511a26c..2fea36bcab 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -104,7 +104,7 @@ namespace { // start from fe=1 as 0th is always non-enriched FE. for (unsigned int fe=1; fe < fes.size(); fe++) - if (dynamic_cast*>(fes[fe]) == 0) + if (dynamic_cast*>(fes[fe]) == nullptr) // this is not FE_Nothing => there will be enrichment return true; @@ -118,7 +118,7 @@ FE_Enriched::FE_Enriched (const FiniteElement &fe_ba : FE_Enriched(fe_base, FE_Nothing(fe_base.n_components(),true), - NULL) + nullptr) { } @@ -285,7 +285,7 @@ FE_Enriched::setup_data (std::unique_ptr &quadrature) const { - Assert ((dynamic_cast::InternalData *> (fes_data.get()) != NULL), + Assert ((dynamic_cast::InternalData *> (fes_data.get()) != nullptr), ExcInternalError()); typename FESystem::InternalData *data_fesystem = static_cast::InternalData *> (fes_data.get()); @@ -461,7 +461,7 @@ FE_Enriched::fill_fe_values (const typename Triangulation< dim, sp internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data ) const { - Assert (dynamic_cast (&fe_internal) != NULL, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); @@ -497,7 +497,7 @@ FE_Enriched::fill_fe_face_values internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data ) const { - Assert (dynamic_cast (&fe_internal) != NULL, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); @@ -534,7 +534,7 @@ FE_Enriched::fill_fe_subface_values internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data ) const { - Assert (dynamic_cast (&fe_internal) != NULL, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); @@ -656,7 +656,7 @@ FE_Enriched::multiply_by_enrichment fe_data.enrichment[base_no].size())); for (unsigned int m=0; m < base_no_mult_local_enriched_dofs[base_no].size(); m++) { - Assert (enrichments[base_no-1][m](cell) !=NULL, + Assert (enrichments[base_no-1][m](cell) !=nullptr, ExcMessage("The pointer to the enrichment function is NULL")); Assert (enrichments[base_no-1][m](cell)->n_components == 1, diff --git a/source/fe/fe_face.cc b/source/fe/fe_face.cc index b77a6ff842..8dde09d0c4 100644 --- a/source/fe/fe_face.cc +++ b/source/fe/fe_face.cc @@ -217,7 +217,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe Assert (std::fabs(sum-1) < eps, ExcInternalError()); } } - else if (dynamic_cast *>(&x_source_fe) != 0) + else if (dynamic_cast *>(&x_source_fe) != nullptr) { // nothing to do here, the FE_Nothing has no degrees of freedom anyway } @@ -727,7 +727,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe } } } - else if (dynamic_cast *>(&x_source_fe) != 0) + else if (dynamic_cast *>(&x_source_fe) != nullptr) { // nothing to do here, the FE_Nothing has no degrees of freedom anyway } diff --git a/source/fe/fe_nedelec.cc b/source/fe/fe_nedelec.cc index e4aedd7233..27eed34989 100644 --- a/source/fe/fe_nedelec.cc +++ b/source/fe/fe_nedelec.cc @@ -2387,7 +2387,7 @@ const return identities; } - else if (dynamic_cast*> (&fe_other) != 0) + else if (dynamic_cast*> (&fe_other) != nullptr) { // the FE_Nothing has no // degrees of freedom, so there @@ -2436,7 +2436,7 @@ const return identities; } - else if (dynamic_cast*> (&fe_other) != 0) + else if (dynamic_cast*> (&fe_other) != nullptr) { // the FE_Nothing has no // degrees of freedom, so there @@ -2472,7 +2472,7 @@ const typedef FiniteElement FEL; AssertThrow ((source.get_name ().find ("FE_Nedelec<") == 0) || - (dynamic_cast (&source) != 0), + (dynamic_cast (&source) != nullptr), typename FEL::ExcInterpolationNotImplemented()); Assert (interpolation_matrix.m () == source.dofs_per_face, ExcDimensionMismatch (interpolation_matrix.m (), @@ -2580,7 +2580,7 @@ FE_Nedelec::get_subface_interpolation_matrix( typedef FiniteElement FEL; AssertThrow ((source.get_name ().find ("FE_Nedelec<") == 0) || - (dynamic_cast (&source) != 0), + (dynamic_cast (&source) != nullptr), typename FEL::ExcInterpolationNotImplemented ()); Assert (interpolation_matrix.m () == source.dofs_per_face, ExcDimensionMismatch (interpolation_matrix.m (), diff --git a/source/fe/fe_nothing.cc b/source/fe/fe_nothing.cc index 9a4fb88165..7095354607 100644 --- a/source/fe/fe_nothing.cc +++ b/source/fe/fe_nothing.cc @@ -179,7 +179,7 @@ compare_for_face_domination (const FiniteElement &fe) const return FiniteElementDomination::no_requirements; } // if it does and the other is FE_Nothing, either can dominate - else if (dynamic_cast*>(&fe) != 0) + else if (dynamic_cast*>(&fe) != nullptr) { return FiniteElementDomination::either_element_can_dominate; } diff --git a/source/fe/fe_poly.cc b/source/fe/fe_poly.cc index 54dbb5b82d..296b2fe8e8 100644 --- a/source/fe/fe_poly.cc +++ b/source/fe/fe_poly.cc @@ -44,7 +44,7 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // transform gradients and higher derivatives. there is nothing to do @@ -103,7 +103,7 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, // assert that the following dynamics // cast is really well-defined. - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // transform gradients and higher derivatives. there is nothing to do @@ -163,7 +163,7 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // transform gradients and higher derivatives. there is nothing to do @@ -218,7 +218,7 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, const FiniteElement<2,3>::InternalDataBase &fe_internal, dealii::internal::FEValues::FiniteElementRelatedData<2,3> &output_data) const { - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // transform gradients and higher derivatives. there is nothing to do diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index 7e3378a06a..4ff9e3295e 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -316,7 +316,7 @@ fill_fe_values // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); @@ -790,7 +790,7 @@ fill_fe_face_values // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); @@ -1265,7 +1265,7 @@ fill_fe_subface_values // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 097a6e5c23..260052b286 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -657,7 +657,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe Assert (std::fabs(sum-1) < eps, ExcInternalError()); } } - else if (dynamic_cast *>(&x_source_fe) != 0) + else if (dynamic_cast *>(&x_source_fe) != nullptr) { // nothing to do here, the FE_Nothing has no degrees of freedom anyway } @@ -687,13 +687,13 @@ hp_vertex_dof_identities (const FiniteElement &fe_other) const // if the other one is an FE_Nothing. in the first case, there should be // exactly one single DoF of each FE at a vertex, and they should have // identical value - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) { return std::vector > (1, std::make_pair (0U, 0U)); } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no degrees of freedom, so there are no // equivalencies to be recorded @@ -756,7 +756,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const return identities; } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no degrees of freedom, so there are no // equivalencies to be recorded @@ -823,7 +823,7 @@ hp_quad_dof_identities (const FiniteElement &fe_other) cons return identities; } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no degrees of freedom, so there are no // equivalencies to be recorded @@ -878,9 +878,9 @@ compare_for_face_domination (const FiniteElement &fe_other) const return FiniteElementDomination::no_requirements; } } - else if ((dynamic_cast*>(&fe_other) != 0) + else if ((dynamic_cast*>(&fe_other) != nullptr) || - (dynamic_cast*>(&fe_other) != 0)) + (dynamic_cast*>(&fe_other) != nullptr)) { // there are no requirements between continuous and // discontinuous elements diff --git a/source/fe/fe_q_bubbles.cc b/source/fe/fe_q_bubbles.cc index eccf22f2ff..117244270f 100644 --- a/source/fe/fe_q_bubbles.cc +++ b/source/fe/fe_q_bubbles.cc @@ -77,7 +77,7 @@ namespace FE_Q_Bubbles_Helper Assert(false, ExcInternalError()); } - Assert(q_fine.get() != NULL, ExcInternalError()); + Assert(q_fine.get() != nullptr, ExcInternalError()); const unsigned int nq = q_fine->size(); // loop over all possible refinement cases @@ -370,7 +370,7 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, AssertThrow ((x_source_fe.get_name().find ("FE_Q_Bubbles<") == 0) || - (dynamic_cast(&x_source_fe) != 0) + (dynamic_cast(&x_source_fe) != nullptr) , typename FEL:: ExcInterpolationNotImplemented()); diff --git a/source/fe/fe_q_dg0.cc b/source/fe/fe_q_dg0.cc index 2866943612..f8c61fe8ef 100644 --- a/source/fe/fe_q_dg0.cc +++ b/source/fe/fe_q_dg0.cc @@ -288,7 +288,7 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, AssertThrow ((x_source_fe.get_name().find ("FE_Q_DG0<") == 0) || - (dynamic_cast(&x_source_fe) != 0), + (dynamic_cast(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); diff --git a/source/fe/fe_q_hierarchical.cc b/source/fe/fe_q_hierarchical.cc index 0e4e9b9088..905a0cea26 100644 --- a/source/fe/fe_q_hierarchical.cc +++ b/source/fe/fe_q_hierarchical.cc @@ -217,13 +217,13 @@ hp_vertex_dof_identities (const FiniteElement &fe_other) const // single DoF of each FE at a // vertex, and they should have // identical value - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) { return std::vector > (1, std::make_pair (0U, 0U)); } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no // degrees of freedom, so there @@ -247,7 +247,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const // these identities if both FEs are // FE_Q_Hierarchicals or if the other // one is an FE_Nothing. - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) { const unsigned int &this_dpl = this->dofs_per_line; const unsigned int &other_dpl = fe_other.dofs_per_line; @@ -262,7 +262,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const return res; } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no // degrees of freedom, so there @@ -286,7 +286,7 @@ hp_quad_dof_identities (const FiniteElement &fe_other) const // these identities if both FEs are // FE_Q_Hierarchicals or if the other // one is an FE_Nothing. - if (dynamic_cast*>(&fe_other) != 0) + if (dynamic_cast*>(&fe_other) != nullptr) { const unsigned int &this_dpq = this->dofs_per_quad; const unsigned int &other_dpq = fe_other.dofs_per_quad; @@ -301,7 +301,7 @@ hp_quad_dof_identities (const FiniteElement &fe_other) const return res; } - else if (dynamic_cast*>(&fe_other) != 0) + else if (dynamic_cast*>(&fe_other) != nullptr) { // the FE_Nothing has no // degrees of freedom, so there @@ -824,7 +824,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, typedef FiniteElement FEL; AssertThrow ((x_source_fe.get_name().find ("FE_Q_Hierarchical<") == 0) || - (dynamic_cast(&x_source_fe) != 0), + (dynamic_cast(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); @@ -912,7 +912,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, typedef FiniteElement FEL; AssertThrow ((x_source_fe.get_name().find ("FE_Q_Hierarchical<") == 0) || - (dynamic_cast(&x_source_fe) != 0), + (dynamic_cast(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); diff --git a/source/fe/fe_raviart_thomas_nodal.cc b/source/fe/fe_raviart_thomas_nodal.cc index b5d7f269e8..fea085808e 100644 --- a/source/fe/fe_raviart_thomas_nodal.cc +++ b/source/fe/fe_raviart_thomas_nodal.cc @@ -349,7 +349,7 @@ FE_RaviartThomasNodal::hp_vertex_dof_identities ( // FE_RaviartThomasNodals. in that case, no // dofs are assigned on the vertex, so we // shouldn't be getting here at all. - if (dynamic_cast*>(&fe_other)!=0) + if (dynamic_cast*>(&fe_other)!=nullptr) return std::vector > (); else { @@ -512,7 +512,7 @@ FE_RaviartThomasNodal::get_face_interpolation_matrix ( // RaviartThomasNodal element AssertThrow ((x_source_fe.get_name().find ("FE_RaviartThomasNodal<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FiniteElement:: ExcInterpolationNotImplemented()); @@ -619,7 +619,7 @@ FE_RaviartThomasNodal::get_subface_interpolation_matrix ( // RaviartThomasNodal element AssertThrow ((x_source_fe.get_name().find ("FE_RaviartThomasNodal<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FiniteElement:: ExcInterpolationNotImplemented()); diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index 2731f91899..adcc12048a 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -62,7 +62,7 @@ FESystem::InternalData::~InternalData() if (base_fe_datas[i]) { delete base_fe_datas[i]; - base_fe_datas[i] = 0; + base_fe_datas[i] = nullptr; } } @@ -596,7 +596,7 @@ FESystem::get_interpolation_matrix ( typedef FiniteElement FEL; AssertThrow ((x_source_fe.get_name().find ("FESystem<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); @@ -1108,7 +1108,7 @@ compute_fill (const Mapping &mapping, // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); + Assert (dynamic_cast (&fe_internal) != nullptr, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); // Either dim_1==dim @@ -1141,8 +1141,8 @@ compute_fill (const Mapping &mapping, // fill_fe_face_values needs argument Quadrature for both cases // dim_1==dim-1 and dim_1=dim. Hence the following workaround - const Quadrature *cell_quadrature = 0; - const Quadrature *face_quadrature = 0; + const Quadrature *cell_quadrature = nullptr; + const Quadrature *face_quadrature = nullptr; const unsigned int n_q_points = quadrature.size(); // static cast to the common base class of quadrature being either @@ -1152,7 +1152,7 @@ compute_fill (const Mapping &mapping, if (face_no==invalid_face_number) { Assert(dim_1==dim, ExcDimensionMismatch(dim_1,dim)); - Assert (dynamic_cast *>(quadrature_base_pointer) != 0, + Assert (dynamic_cast *>(quadrature_base_pointer) != nullptr, ExcInternalError()); cell_quadrature @@ -1161,7 +1161,7 @@ compute_fill (const Mapping &mapping, else { Assert(dim_1==dim-1, ExcDimensionMismatch(dim_1,dim-1)); - Assert (dynamic_cast *>(quadrature_base_pointer) != 0, + Assert (dynamic_cast *>(quadrature_base_pointer) != nullptr, ExcInternalError()); face_quadrature @@ -1681,7 +1681,7 @@ get_face_interpolation_matrix (const FiniteElement &x_source_fe, typedef FiniteElement FEL; AssertThrow ((x_source_fe.get_name().find ("FE_System<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); @@ -1792,7 +1792,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe typedef FiniteElement FEL; AssertThrow ((x_source_fe.get_name().find ("FE_System<") == 0) || - (dynamic_cast*>(&x_source_fe) != 0), + (dynamic_cast*>(&x_source_fe) != nullptr), typename FEL:: ExcInterpolationNotImplemented()); diff --git a/source/fe/fe_tools.cc b/source/fe/fe_tools.cc index c9344e3fd3..5915432825 100644 --- a/source/fe/fe_tools.cc +++ b/source/fe/fe_tools.cc @@ -938,7 +938,7 @@ namespace FETools FEFactory::get (const Quadrature<1> &) const { Assert(false, ExcNotImplemented()); - return 0; + return nullptr; } // Specializations for FE_Q. @@ -2421,7 +2421,7 @@ namespace FETools // everything went ok. so // generate the composed // element - FiniteElement *system_element = 0; + FiniteElement *system_element = nullptr; // uses new FESystem constructor // which is independent of @@ -2560,7 +2560,7 @@ namespace FETools // make some compilers happy that // do not realize that we can't get // here after throwing - return 0; + return nullptr; } @@ -2668,7 +2668,7 @@ namespace FETools AssertThrow(false, ExcInvalidFEName(parameter_name + std::string(" at ") + errline)); - return 0; + return nullptr; } } diff --git a/source/fe/fe_tools_extrapolate.cc b/source/fe/fe_tools_extrapolate.cc index 0456936f35..5c8d76ba01 100644 --- a/source/fe/fe_tools_extrapolate.cc +++ b/source/fe/fe_tools_extrapolate.cc @@ -724,7 +724,7 @@ namespace FETools = (dynamic_cast*> (&dof2.get_tria())); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); typename DoFHandler::cell_iterator cell=dof2.begin(0), @@ -915,7 +915,7 @@ namespace FETools = (dynamic_cast*> (&dof2.get_tria())); - Assert (tr != 0, ExcInternalError()); + Assert (tr != nullptr, ExcInternalError()); // collect in a set all trees this // process has to compute cells on @@ -1292,7 +1292,7 @@ namespace FETools = (dynamic_cast*> (&dof2.get_tria())); - Assert (tr != 0, + Assert (tr != nullptr, ExcMessage ("Extrapolate in parallel only works for parallel distributed triangulations!")); communicator = tr->get_communicator (); @@ -1411,7 +1411,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert (parallel_tria !=0, ExcNotImplemented()); + Assert (parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); vector.reinit(locally_owned_dofs, parallel_tria->get_communicator()); @@ -1425,7 +1425,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert (parallel_tria !=0, ExcNotImplemented()); + Assert (parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); vector.reinit(locally_owned_dofs, parallel_tria->get_communicator()); @@ -1438,7 +1438,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert (parallel_tria !=0, ExcNotImplemented()); + Assert (parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); vector.reinit(locally_owned_dofs, parallel_tria->get_communicator()); @@ -1460,7 +1460,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert(parallel_tria !=0, ExcNotImplemented()); + Assert(parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); IndexSet locally_relevant_dofs; DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs); @@ -1476,7 +1476,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert (parallel_tria !=0, ExcNotImplemented()); + Assert (parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); IndexSet locally_relevant_dofs; DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs); @@ -1491,7 +1491,7 @@ namespace FETools { const parallel::distributed::Triangulation *parallel_tria = dynamic_cast*>(&dh.get_tria()); - Assert (parallel_tria !=0, ExcNotImplemented()); + Assert (parallel_tria !=nullptr, ExcNotImplemented()); const IndexSet locally_owned_dofs = dh.locally_owned_dofs(); IndexSet locally_relevant_dofs; DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs); @@ -1585,7 +1585,7 @@ namespace FETools OutVector u3; internal::reinit_distributed(dof2, u3); - if (dynamic_cast*>(&dof2.get_tria()) != 0) + if (dynamic_cast*>(&dof2.get_tria()) != nullptr) { interpolate(dof1, u1, dof2, constraints, u3); diff --git a/source/fe/fe_tools_interpolate.cc b/source/fe/fe_tools_interpolate.cc index 7f5f1fd6dc..8ea418fa52 100644 --- a/source/fe/fe_tools_interpolate.cc +++ b/source/fe/fe_tools_interpolate.cc @@ -172,7 +172,7 @@ namespace FETools // matrix for this particular // pair of elements is already // there - if (interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()].get() == 0) + if (interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()].get() == nullptr) { std::shared_ptr > interpolation_matrix (new FullMatrix (dofs_per_cell2, @@ -305,7 +305,7 @@ namespace FETools // make sure back_interpolation // matrix is available - if (interpolation_matrices[&cell->get_fe()] == 0) + if (interpolation_matrices[&cell->get_fe()] == nullptr) { interpolation_matrices[&cell->get_fe()] = std::shared_ptr > diff --git a/source/fe/fe_trace.cc b/source/fe/fe_trace.cc index 070e83afc6..16cbb03776 100644 --- a/source/fe/fe_trace.cc +++ b/source/fe/fe_trace.cc @@ -217,7 +217,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe { fe_q.get_subface_interpolation_matrix (source_fe->fe_q, subface, interpolation_matrix); } - else if (dynamic_cast *>(&x_source_fe) != 0) + else if (dynamic_cast *>(&x_source_fe) != nullptr) { // nothing to do here, the FE_Nothing has no degrees of freedom anyway } diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 6255057241..af64a397cb 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -138,7 +138,7 @@ namespace FEValuesViews template Scalar::Scalar () : - fe_values (NULL), + fe_values (nullptr), component (numbers::invalid_unsigned_int) {} @@ -232,7 +232,7 @@ namespace FEValuesViews template Vector::Vector () : - fe_values (NULL), + fe_values (nullptr), first_vector_component (numbers::invalid_unsigned_int) {} @@ -331,7 +331,7 @@ namespace FEValuesViews template SymmetricTensor<2, dim, spacedim>::SymmetricTensor() : - fe_values(NULL), + fe_values(nullptr), first_tensor_component(numbers::invalid_unsigned_int) {} @@ -430,7 +430,7 @@ namespace FEValuesViews template Tensor<2, dim, spacedim>::Tensor() : - fe_values(NULL), + fe_values(nullptr), first_tensor_component(numbers::invalid_unsigned_int) {} @@ -1271,7 +1271,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_values, (typename FEValuesBase::ExcAccessToUninitializedField("update_values"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1294,7 +1294,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1317,7 +1317,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_hessians, (typename FEValuesBase::ExcAccessToUninitializedField("update_hessians"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1340,7 +1340,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_hessians, (typename FEValuesBase::ExcAccessToUninitializedField("update_hessians"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1363,7 +1363,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_3rd_derivatives, (typename FEValuesBase::ExcAccessToUninitializedField("update_3rd_derivatives"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1386,7 +1386,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_values, (typename FEValuesBase::ExcAccessToUninitializedField("update_values"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1410,7 +1410,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1433,7 +1433,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1457,7 +1457,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1479,7 +1479,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert (fe_values->present_cell.get () != 0, + Assert (fe_values->present_cell.get () != nullptr, ExcMessage ("FEValues object is not reinited to any cell")); AssertDimension (fe_function.size (), fe_values->present_cell->n_dofs_for_dof_handler ()); @@ -1501,7 +1501,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_hessians, (typename FEValuesBase::ExcAccessToUninitializedField("update_hessians"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1526,7 +1526,7 @@ namespace FEValuesViews (typename FEValuesBase::ExcAccessToUninitializedField("update_hessians"))); Assert (laplacians.size() == fe_values->n_quadrature_points, ExcDimensionMismatch(laplacians.size(), fe_values->n_quadrature_points)); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == fe_values->present_cell->n_dofs_for_dof_handler(), ExcDimensionMismatch(fe_function.size(), @@ -1549,7 +1549,7 @@ namespace FEValuesViews { Assert (fe_values->update_flags & update_3rd_derivatives, (typename FEValuesBase::ExcAccessToUninitializedField("update_3rd_derivatives"))); - Assert (fe_values->present_cell.get() != 0, + Assert (fe_values->present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1572,7 +1572,7 @@ namespace FEValuesViews { Assert(fe_values->update_flags & update_values, (typename FEValuesBase::ExcAccessToUninitializedField("update_values"))); - Assert(fe_values->present_cell.get() != 0, + Assert(fe_values->present_cell.get() != nullptr, ExcMessage("FEValues object is not reinit'ed to any cell")); AssertDimension(fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1595,7 +1595,7 @@ namespace FEValuesViews { Assert(fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert(fe_values->present_cell.get() != 0, + Assert(fe_values->present_cell.get() != nullptr, ExcMessage("FEValues object is not reinit'ed to any cell")); AssertDimension(fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1617,7 +1617,7 @@ namespace FEValuesViews { Assert(fe_values->update_flags & update_values, (typename FEValuesBase::ExcAccessToUninitializedField("update_values"))); - Assert(fe_values->present_cell.get() != 0, + Assert(fe_values->present_cell.get() != nullptr, ExcMessage("FEValues object is not reinit'ed to any cell")); AssertDimension(fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -1640,7 +1640,7 @@ namespace FEValuesViews { Assert(fe_values->update_flags & update_gradients, (typename FEValuesBase::ExcAccessToUninitializedField("update_gradients"))); - Assert(fe_values->present_cell.get() != 0, + Assert(fe_values->present_cell.get() != nullptr, ExcMessage("FEValues object is not reinit'ed to any cell")); AssertDimension(fe_function.size(), fe_values->present_cell->n_dofs_for_dof_handler()); @@ -2694,7 +2694,7 @@ void FEValuesBase::get_function_values ( Assert (this->update_flags & update_values, ExcAccessToUninitializedField("update_values")); AssertDimension (fe->n_components(), 1); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -2748,7 +2748,7 @@ void FEValuesBase::get_function_values ( std::vector > &values) const { typedef typename InputVector::value_type Number; - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (this->update_flags & update_values, @@ -2855,7 +2855,7 @@ FEValuesBase::get_function_gradients ( Assert (this->update_flags & update_gradients, ExcAccessToUninitializedField("update_gradients")); AssertDimension (fe->n_components(), 1); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -2911,7 +2911,7 @@ FEValuesBase::get_function_gradients ( typedef typename InputVector::value_type Number; Assert (this->update_flags & update_gradients, ExcAccessToUninitializedField("update_gradients")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -2977,7 +2977,7 @@ get_function_hessians (const InputVector &fe_function, AssertDimension (fe->n_components(), 1); Assert (this->update_flags & update_hessians, ExcAccessToUninitializedField("update_hessians")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -3034,7 +3034,7 @@ get_function_hessians (const InputVector &fe_function, typedef typename InputVector::value_type Number; Assert (this->update_flags & update_hessians, ExcAccessToUninitializedField("update_hessians")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -3096,7 +3096,7 @@ void FEValuesBase::get_function_laplacians ( Assert (this->update_flags & update_hessians, ExcAccessToUninitializedField("update_hessians")); AssertDimension (fe->n_components(), 1); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -3148,7 +3148,7 @@ void FEValuesBase::get_function_laplacians ( std::vector > &laplacians) const { typedef typename InputVector::value_type Number; - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (this->update_flags & update_hessians, ExcAccessToUninitializedField("update_hessians")); @@ -3250,7 +3250,7 @@ get_function_third_derivatives (const InputVector &fe_function, AssertDimension (fe->n_components(), 1); Assert (this->update_flags & update_3rd_derivatives, ExcAccessToUninitializedField("update_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -3307,7 +3307,7 @@ get_function_third_derivatives (const InputVector &fe_fu typedef typename InputVector::value_type Number; Assert (this->update_flags & update_3rd_derivatives, ExcAccessToUninitializedField("update_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); AssertDimension (fe_function.size(), present_cell->n_dofs_for_dof_handler()); @@ -3454,7 +3454,7 @@ FEValuesBase< dim, spacedim >::invalidate_present_cell () { // if there is no present cell, then we shouldn't be // connected via a signal to a triangulation - Assert (present_cell.get() != 0, ExcInternalError()); + Assert (present_cell.get() != nullptr, ExcInternalError()); // so delete the present cell and // disconnect from the signal we have with @@ -3470,7 +3470,7 @@ void FEValuesBase< dim, spacedim >:: maybe_invalidate_previous_present_cell (const typename Triangulation::cell_iterator &cell) { - if (present_cell.get() != 0) + if (present_cell.get() != nullptr) { if (&cell->get_triangulation() != &present_cell->operator typename Triangulation::cell_iterator() @@ -3537,7 +3537,7 @@ FEValuesBase::check_cell_similarity } // case that there has not been any cell before - if (this->present_cell.get() == 0) + if (this->present_cell.get() == nullptr) cell_similarity = CellSimilarity::none; else // in MappingQ, data can have been modified during the last call. Then, we diff --git a/source/fe/mapping_cartesian.cc b/source/fe/mapping_cartesian.cc index 0951bd7bbd..09f7ade5c3 100644 --- a/source/fe/mapping_cartesian.cc +++ b/source/fe/mapping_cartesian.cc @@ -344,7 +344,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, { // convert data object to internal data for this class. fails with // an exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, ExcInternalError()); + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); std::vector > dummy; @@ -440,7 +440,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & // data for this class. fails with // an exception if that is not // possible - Assert (dynamic_cast (&internal_data) != 0, + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); @@ -528,7 +528,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato { // convert data object to internal data for this class. fails with // an exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, ExcInternalError()); + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); compute_fill (cell, face_no, subface_no, CellSimilarity::none, @@ -622,7 +622,7 @@ transform (const ArrayView > &input, const ArrayView > &output) const { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (mapping_data); @@ -677,7 +677,7 @@ transform (const ArrayView > &input, const ArrayView > &output) const { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -779,7 +779,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -880,7 +880,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -918,7 +918,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 6c9ab38875..88432c17b7 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -1305,7 +1305,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, ExcInternalError()); + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); const unsigned int n_q_points=quadrature.size(); @@ -1485,7 +1485,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); @@ -1519,7 +1519,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); @@ -1552,7 +1552,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingFEField::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -1616,7 +1616,7 @@ namespace { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingFEField::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -1699,7 +1699,7 @@ transform (const ArrayView > &input, const ArrayView > &output) const { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -1978,7 +1978,7 @@ MappingFEField::update_internal_dofs (const typename Triangulation::cell_iterator &cell, const typename MappingFEField::InternalData &data) const { - Assert(euler_dof_handler != 0, ExcMessage("euler_dof_handler is empty")); + Assert(euler_dof_handler != nullptr, ExcMessage("euler_dof_handler is empty")); typename DoFHandlerType::cell_iterator dof_cell(*cell, euler_dof_handler); Assert (dof_cell->active() == true, ExcInactiveCell()); diff --git a/source/fe/mapping_manifold.cc b/source/fe/mapping_manifold.cc index 436562070d..39d0b99c49 100644 --- a/source/fe/mapping_manifold.cc +++ b/source/fe/mapping_manifold.cc @@ -511,7 +511,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following static_cast is really correct: - Assert (dynamic_cast(&internal_data) != 0, + Assert (dynamic_cast(&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -850,7 +850,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following cast is really correct: - Assert ((dynamic_cast(&internal_data) != 0), + Assert ((dynamic_cast(&internal_data) != nullptr), ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -880,7 +880,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following cast is really correct: - Assert ((dynamic_cast(&internal_data) != 0), + Assert ((dynamic_cast(&internal_data) != nullptr), ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -910,7 +910,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingManifold::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -973,7 +973,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingManifold::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -1054,7 +1054,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingManifold::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -1196,7 +1196,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingManifold::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -1283,7 +1283,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); diff --git a/source/fe/mapping_q.cc b/source/fe/mapping_q.cc index a567704aad..a3d0b17dea 100644 --- a/source/fe/mapping_q.cc +++ b/source/fe/mapping_q.cc @@ -216,7 +216,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, ExcInternalError()); + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); // check whether this cell needs the full mapping or can be treated by a @@ -271,7 +271,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); @@ -313,7 +313,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato { // convert data object to internal data for this class. fails with an // exception if that is not possible - Assert (dynamic_cast (&internal_data) != 0, + Assert (dynamic_cast (&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast (internal_data); @@ -356,7 +356,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) - != 0), + != nullptr), ExcInternalError()); const InternalData *data = dynamic_cast(&mapping_data); @@ -380,7 +380,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) - != 0), + != nullptr), ExcInternalError()); const InternalData *data = dynamic_cast(&mapping_data); @@ -404,7 +404,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) - != 0), + != nullptr), ExcInternalError()); const InternalData *data = dynamic_cast(&mapping_data); @@ -428,7 +428,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) - != 0), + != nullptr), ExcInternalError()); const InternalData *data = dynamic_cast(&mapping_data); @@ -451,7 +451,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) - != 0), + != nullptr), ExcInternalError()); const InternalData *data = dynamic_cast(&mapping_data); diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index 0b55214b5c..2eb5cf2f6d 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -1253,7 +1253,7 @@ MappingQGeneric::MappingQGeneric (const unsigned int p) : polynomial_degree(p), line_support_points(this->polynomial_degree+1), - fe_q(dim == 3 ? new FE_Q(this->polynomial_degree) : 0), + fe_q(dim == 3 ? new FE_Q(this->polynomial_degree) : nullptr), support_point_weights_perimeter_to_interior (compute_support_point_weights_perimeter_to_interior(this->polynomial_degree, dim)), support_point_weights_cell (compute_support_point_weights_cell(this->polynomial_degree)) { @@ -1268,7 +1268,7 @@ MappingQGeneric::MappingQGeneric (const MappingQGeneric(*mapping.fe_q) : 0), + fe_q(dim == 3 ? new FE_Q(*mapping.fe_q) : nullptr), support_point_weights_perimeter_to_interior (mapping.support_point_weights_perimeter_to_interior), support_point_weights_cell (mapping.support_point_weights_cell) {} @@ -2618,7 +2618,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following static_cast is really correct: - Assert (dynamic_cast(&internal_data) != 0, + Assert (dynamic_cast(&internal_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -3026,7 +3026,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following cast is really correct: - Assert ((dynamic_cast(&internal_data) != 0), + Assert ((dynamic_cast(&internal_data) != nullptr), ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -3071,7 +3071,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato internal::FEValues::MappingRelatedData &output_data) const { // ensure that the following cast is really correct: - Assert ((dynamic_cast(&internal_data) != 0), + Assert ((dynamic_cast(&internal_data) != nullptr), ExcInternalError()); const InternalData &data = static_cast(internal_data); @@ -3116,7 +3116,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingQGeneric::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -3179,7 +3179,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingQGeneric::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -3260,7 +3260,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingQGeneric::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -3402,7 +3402,7 @@ namespace const ArrayView > &output) { AssertDimension (input.size(), output.size()); - Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), + Assert ((dynamic_cast::InternalData *>(&mapping_data) != nullptr), ExcInternalError()); const typename MappingQGeneric::InternalData &data = static_cast::InternalData &>(mapping_data); @@ -3489,7 +3489,7 @@ transform (const ArrayView > &input, { AssertDimension (input.size(), output.size()); - Assert (dynamic_cast(&mapping_data) != 0, + Assert (dynamic_cast(&mapping_data) != nullptr, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -3695,7 +3695,7 @@ add_quad_support_points(const Triangulation<3,3>::cell_iterator &cell, // the triangulation if no manifold is assigned). const Boundary<3,3> *boundary = dynamic_cast *>(&face->get_manifold()); - if (boundary != NULL && + if (boundary != nullptr && std::string(typeid(*boundary).name()).find("StraightBoundary") == std::string::npos) { diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 7edb5fb1c0..7989aa5e97 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -3934,9 +3934,9 @@ namespace GridGenerator Assert (GridTools::have_same_coarse_mesh (triangulation_1, triangulation_2), ExcMessage ("The two input triangulations are not derived from " "the same coarse mesh as required.")); - Assert ((dynamic_cast*>(&triangulation_1) == 0) + Assert ((dynamic_cast*>(&triangulation_1) == nullptr) && - (dynamic_cast*>(&triangulation_2) == 0), + (dynamic_cast*>(&triangulation_2) == nullptr), ExcMessage ("The source triangulations for this function must both " "be available entirely locally, and not be distributed " "triangulations.")); @@ -4380,7 +4380,7 @@ namespace GridGenerator dynamic_cast *>(&in_tria); (void)pt; - Assert (pt == NULL, + Assert (pt == nullptr, ExcMessage("Cannot use this function on parallel::distributed::Triangulation.")); std::vector > v; @@ -4470,7 +4470,7 @@ namespace GridGenerator { Assert ((dynamic_cast*> (&volume_mesh.get_triangulation()) - == 0), + == nullptr), ExcNotImplemented()); // This function works using the following assumption: diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 09cfe62289..fca781871e 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -82,7 +82,7 @@ namespace template GridIn::GridIn () : - tria(0, typeid(*this).name()), default_format(ucd) + tria(nullptr, typeid(*this).name()), default_format(ucd) {} @@ -384,7 +384,7 @@ void GridIn::read_vtk(std::istream &in) template void GridIn::read_unv(std::istream &in) { - Assert(tria != 0, ExcNoTriangulationSelected()); + Assert(tria != nullptr, ExcNoTriangulationSelected()); Assert((dim == 2)||(dim == 3), ExcNotImplemented()); AssertThrow(in, ExcIO()); @@ -621,7 +621,7 @@ template void GridIn::read_ucd (std::istream &in, const bool apply_all_indicators_to_manifolds) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); AssertThrow (in, ExcIO()); // skip comments at start of file @@ -855,7 +855,7 @@ template void GridIn::read_abaqus (std::istream &in, const bool apply_all_indicators_to_manifolds) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); Assert (dim==2 || dim==3, ExcNotImplemented()); AssertThrow (in, ExcIO()); @@ -899,7 +899,7 @@ void GridIn::read_abaqus (std::istream template void GridIn::read_dbmesh (std::istream &in) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); Assert (dim==2, ExcNotImplemented()); AssertThrow (in, ExcIO()); @@ -1073,7 +1073,7 @@ void GridIn::read_xda (std::istream &) template <> void GridIn<2>::read_xda (std::istream &in) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); AssertThrow (in, ExcIO()); std::string line; @@ -1144,7 +1144,7 @@ void GridIn<2>::read_xda (std::istream &in) template <> void GridIn<3>::read_xda (std::istream &in) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); AssertThrow (in, ExcIO()); static const unsigned int xda_to_dealII_map[] = {0,1,5,4,3,2,6,7}; @@ -1223,7 +1223,7 @@ void GridIn<3>::read_xda (std::istream &in) template void GridIn::read_msh (std::istream &in) { - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); AssertThrow (in, ExcIO()); unsigned int n_vertices; @@ -2304,7 +2304,7 @@ void GridIn<2>::read_tecplot (std::istream &in) { const unsigned int dim=2; const unsigned int spacedim=2; - Assert (tria != 0, ExcNoTriangulationSelected()); + Assert (tria != nullptr, ExcNoTriangulationSelected()); AssertThrow (in, ExcIO()); // skip comments at start of file diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index e533a2145a..40b9707ac7 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -1110,7 +1110,7 @@ void GridOut::write_ucd (const Triangulation &tria, // block this to have local // variables destroyed after // use - std::time_t time1= std::time (0); + std::time_t time1= std::time (nullptr); std::tm *time = std::localtime(&time1); out << "# This file was generated by the deal.II library." << '\n' << "# Date = " @@ -2301,7 +2301,7 @@ void GridOut::write_mathgl (const Triangulation &tria, if (true) { // block this to have local variables destroyed after use - const std::time_t time1 = std::time (0); + const std::time_t time1 = std::time (nullptr); const std::tm *time = std::localtime (&time1); out << "\n#" @@ -3166,9 +3166,9 @@ namespace internal // quadrature formula which will be // used to probe boundary points at // curved faces - Quadrature *q_projector=0; + Quadrature *q_projector=nullptr; std::vector > boundary_points; - if (mapping!=0) + if (mapping!=nullptr) { boundary_points.resize(n_points); boundary_points[0][0]=0; @@ -3187,7 +3187,7 @@ namespace internal if (gnuplot_flags.write_cell_numbers) out << "# cell " << cell << '\n'; - if (mapping==0 || + if (mapping==nullptr || (!cell->at_boundary() && !gnuplot_flags.curved_inner_cells)) { // write out the four sides @@ -3259,7 +3259,7 @@ namespace internal } } - if (q_projector != 0) + if (q_projector != nullptr) delete q_projector; // make sure everything now gets to @@ -3295,9 +3295,9 @@ namespace internal // quadrature formula which will be // used to probe boundary points at // curved faces - Quadrature *q_projector=0; + Quadrature *q_projector=nullptr; std::vector > boundary_points; - if (mapping!=0) + if (mapping!=nullptr) { boundary_points.resize(n_points); boundary_points[0][0]=0; @@ -3319,7 +3319,7 @@ namespace internal if (gnuplot_flags.write_cell_numbers) out << "# cell " << cell << '\n'; - if (mapping==0 || n_points==2 || + if (mapping==nullptr || n_points==2 || (!cell->has_boundary_lines() && !gnuplot_flags.curved_inner_cells)) { // front face @@ -3470,7 +3470,7 @@ namespace internal } } - if (q_projector != 0) + if (q_projector != nullptr) delete q_projector; @@ -3622,7 +3622,7 @@ namespace internal // treat all other // lines if (!line->has_children() && - (mapping==0 || !line->at_boundary())) + (mapping==nullptr || !line->at_boundary())) // one would expect // make_pair(line->vertex(0), // line->vertex(1)) @@ -3656,7 +3656,7 @@ namespace internal // to the list consisting of // pieces of the boundary // lines - if (mapping!=0) + if (mapping!=nullptr) { // to do so, first // generate a sequence of @@ -3723,7 +3723,7 @@ namespace internal { // curved boundary output // presently not supported - Assert (mapping == 0, ExcNotImplemented()); + Assert (mapping == nullptr, ExcNotImplemented()); typename dealii::Triangulation::active_cell_iterator cell=tria.begin_active(), @@ -3839,7 +3839,7 @@ namespace internal // block this to have local // variables destroyed after // use - std::time_t time1= std::time (0); + std::time_t time1= std::time (nullptr); std::tm *time = std::localtime(&time1); out << "%!PS-Adobe-2.0 EPSF-1.2" << '\n' << "%%Title: deal.II Output" << '\n' diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index a24ff402e0..62785b5506 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -123,7 +123,7 @@ namespace GridTools { // get the degree of the mapping if possible. if not, just assume 1 const unsigned int mapping_degree - = (dynamic_cast*>(&mapping) != 0 ? + = (dynamic_cast*>(&mapping) != nullptr ? dynamic_cast*>(&mapping)->get_degree() : 1); @@ -2124,7 +2124,7 @@ next_cell: { Assert ((dynamic_cast*> (&triangulation) - == 0), + == nullptr), ExcMessage ("Objects of type parallel::distributed::Triangulation " "are already partitioned implicitly and can not be " "partitioned again explicitly.")); @@ -2164,7 +2164,7 @@ next_cell: { Assert ((dynamic_cast*> (&triangulation) - == 0), + == nullptr), ExcMessage ("Objects of type parallel::distributed::Triangulation " "are already partitioned implicitly and can not be " "partitioned again explicitly.")); @@ -2238,7 +2238,7 @@ next_cell: { Assert ((dynamic_cast*> (&triangulation) - == 0), + == nullptr), ExcMessage ("Objects of type parallel::distributed::Triangulation " "are already partitioned implicitly and can not be " "partitioned again explicitly.")); @@ -2810,7 +2810,7 @@ next_cell: Iterator::AccessorType::space_dimension> *manifold = (respect_manifold ? &object->get_boundary() : - 0); + nullptr); const unsigned int structdim = Iterator::AccessorType::structure_dimension; const unsigned int spacedim = Iterator::AccessorType::space_dimension; diff --git a/source/grid/intergrid_map.cc b/source/grid/intergrid_map.cc index bd86dfd62b..bcbb590d48 100644 --- a/source/grid/intergrid_map.cc +++ b/source/grid/intergrid_map.cc @@ -32,8 +32,8 @@ DEAL_II_NAMESPACE_OPEN template InterGridMap::InterGridMap () : - source_grid(0, typeid(*this).name()), - destination_grid(0, typeid(*this).name()) + source_grid(nullptr, typeid(*this).name()), + destination_grid(nullptr, typeid(*this).name()) {} @@ -173,8 +173,8 @@ template void InterGridMap::clear () { mapping.clear (); - source_grid = 0; - destination_grid = 0; + source_grid = nullptr; + destination_grid = nullptr; } diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 57acfd6890..b95593149a 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -425,11 +425,11 @@ FunctionManifold::~FunctionManifold() if (owns_pointers == true) { const Function *pf = push_forward_function; - push_forward_function = 0; + push_forward_function = nullptr; delete pf; const Function *pb = pull_back_function; - pull_back_function = 0; + pull_back_function = nullptr; delete pb; } } diff --git a/source/grid/tria.cc b/source/grid/tria.cc index ab252e8a10..b1d2b525b1 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -6291,10 +6291,10 @@ namespace internal case RefinementCase::cut_x: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -6494,10 +6494,10 @@ namespace internal case RefinementCase::cut_y: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -6701,10 +6701,10 @@ namespace internal case RefinementCase::cut_z: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -6910,10 +6910,10 @@ namespace internal case RefinementCase::cut_xy: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -7259,10 +7259,10 @@ namespace internal case RefinementCase::cut_xz: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -7618,10 +7618,10 @@ namespace internal case RefinementCase::cut_yz: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -7964,11 +7964,11 @@ namespace internal case RefinementCase::cut_xyz: { const typename Triangulation::raw_line_iterator - *lines = NULL; - const unsigned int *vertex_indices = NULL; - const unsigned int *line_indices = NULL; - const bool *line_orientation = NULL; - const int *quad_indices = NULL; + *lines = nullptr; + const unsigned int *vertex_indices = nullptr; + const unsigned int *line_indices = nullptr; + const bool *line_orientation = nullptr; + const int *quad_indices = nullptr; ////////////////////////////// // @@ -9048,7 +9048,7 @@ Triangulation::~Triangulation () if (levels[i]) { delete levels[i]; - levels[i] = 0; + levels[i] = nullptr; } levels.clear (); @@ -9058,14 +9058,14 @@ Triangulation::~Triangulation () // this object makes sense Assert ((dim == 1) || - (vertex_to_boundary_id_map_1d == 0), + (vertex_to_boundary_id_map_1d == nullptr), ExcInternalError()); // the vertex_to_manifold_id_map_1d field should be also unused // except in 1d. check this as well Assert ((dim == 1) || - (vertex_to_manifold_id_map_1d == 0), + (vertex_to_manifold_id_map_1d == nullptr), ExcInternalError()); } @@ -9219,7 +9219,7 @@ Triangulation::get_boundary (const types::manifold_id m_number) c { const Boundary *man = dynamic_cast *>(&get_manifold(m_number)); - Assert(man != NULL, + Assert(man != nullptr, ExcMessage("You tried to get a Boundary, but I only have a Manifold.")); return *man; @@ -9311,11 +9311,11 @@ copy_triangulation (const Triangulation &other_tria) { Assert ((vertices.size() == 0) && (levels.size () == 0) && - (faces == NULL), + (faces == nullptr), ExcTriangulationNotEmpty(vertices.size(), levels.size())); Assert ((other_tria.levels.size() != 0) && (other_tria.vertices.size() != 0) && - (dim == 1 || other_tria.faces != NULL), + (dim == 1 || other_tria.faces != nullptr), ExcMessage("When calling Triangulation::copy_triangulation(), " "the target triangulation must be empty but the source " "triangulation (the argument to this function) must contain " @@ -9399,7 +9399,7 @@ create_triangulation (const std::vector > &v, { Assert ((vertices.size() == 0) && (levels.size () == 0) && - (faces == NULL), + (faces == nullptr), ExcTriangulationNotEmpty(vertices.size(), levels.size())); // check that no forbidden arrays // are used @@ -10433,7 +10433,7 @@ namespace void *get_user_pointer (const TriaIterator > &) { Assert (false, ExcInternalError()); - return 0; + return nullptr; } @@ -10524,7 +10524,7 @@ void Triangulation::load_user_pointers (const std::vector template void Triangulation::save_user_pointers_line (std::vector &v) const { - v.resize (n_lines(), 0); + v.resize (n_lines(), nullptr); std::vector::iterator i = v.begin(); line_iterator line = begin_line(), endl = end_line(); @@ -10551,7 +10551,7 @@ void Triangulation::load_user_pointers_line (const std::vector void Triangulation::save_user_pointers_quad (std::vector &v) const { - v.resize (n_quads(), 0); + v.resize (n_quads(), nullptr); if (dim >= 2) { @@ -10584,7 +10584,7 @@ void Triangulation::load_user_pointers_quad (const std::vector void Triangulation::save_user_pointers_hex (std::vector &v) const { - v.resize (n_hexs(), 0); + v.resize (n_hexs(), nullptr); if (dim >= 3) { diff --git a/source/grid/tria_boundary.cc b/source/grid/tria_boundary.cc index c583bb5f06..5daf316f90 100644 --- a/source/grid/tria_boundary.cc +++ b/source/grid/tria_boundary.cc @@ -163,14 +163,14 @@ Boundary:: get_line_support_points (const unsigned int n_intermediate_points) const { if (points.size() <= n_intermediate_points || - points[n_intermediate_points].get() == 0) + points[n_intermediate_points].get() == nullptr) { Threads::Mutex::ScopedLock lock(mutex); if (points.size() <= n_intermediate_points) points.resize(n_intermediate_points+1); // another thread might have created points in the meantime - if (points[n_intermediate_points].get() == 0) + if (points[n_intermediate_points].get() == nullptr) { std::shared_ptr > quadrature (new QGaussLobatto<1>(n_intermediate_points+2)); diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 0f1815a2eb..7bdb99eb37 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -86,7 +86,7 @@ namespace internal // see if we need to fill this // entry, or whether it already // exists - if (identities.get() == 0) + if (identities.get() == nullptr) { switch (structdim) { @@ -543,7 +543,7 @@ namespace internal typedef DoFHandler BaseClass; - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, typename BaseClass::ExcNoFESelected()); Assert (dof_handler.finite_elements->size() > 0, typename BaseClass::ExcNoFESelected()); @@ -672,7 +672,7 @@ namespace internal typedef DoFHandler BaseClass; - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, typename BaseClass::ExcNoFESelected()); Assert (dof_handler.finite_elements->size() > 0, typename BaseClass::ExcNoFESelected()); @@ -1049,7 +1049,7 @@ namespace internal typedef DoFHandler BaseClass; - Assert (dof_handler.finite_elements != 0, + Assert (dof_handler.finite_elements != nullptr, typename BaseClass::ExcNoFESelected()); Assert (dof_handler.finite_elements->size() > 0, typename BaseClass::ExcNoFESelected()); @@ -1663,11 +1663,11 @@ namespace hp DoFHandler::DoFHandler (const Triangulation &tria) : tria(&tria, typeid(*this).name()), - faces (NULL) + faces (nullptr) { Assert ((dynamic_cast*> (&tria) - == 0), + == nullptr), ExcMessage ("The given triangulation is parallel distributed but " "this class does not currently support this.")); @@ -1812,7 +1812,7 @@ namespace hp template <> types::global_dof_index DoFHandler<1>::n_boundary_dofs () const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); DoFHandler<1,1>::cell_iterator cell; types::global_dof_index n = 0; @@ -1838,7 +1838,7 @@ namespace hp template types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::map*> &boundary_ids) const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); // check that only boundary // indicators 0 and 1 are allowed @@ -1877,7 +1877,7 @@ namespace hp template <> types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::set &boundary_ids) const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); // check that only boundary // indicators 0 and 1 are allowed @@ -1962,7 +1962,7 @@ namespace hp template types::global_dof_index DoFHandler::n_boundary_dofs () const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); std::set boundary_dofs; std::vector dofs_on_face; @@ -2001,7 +2001,7 @@ namespace hp types::global_dof_index DoFHandler::n_boundary_dofs (const std::set &boundary_ids) const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); Assert (boundary_ids.find (numbers::internal_face_boundary_id) == boundary_ids.end(), ExcInvalidBoundaryIndicator()); @@ -2687,7 +2687,7 @@ namespace hp if (dynamic_cast*> (&this->get_triangulation()) - == 0) + == nullptr) { number_cache.locally_owned_dofs = IndexSet (number_cache.n_global_dofs); @@ -2735,7 +2735,7 @@ namespace hp void DoFHandler::clear () { // release lock to old fe - finite_elements = 0; + finite_elements = nullptr; // release memory clear_space (); @@ -3097,7 +3097,7 @@ namespace hp unsigned int DoFHandler::max_couplings_between_dofs () const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); return dealii::internal::hp::DoFHandler::Implementation::max_couplings_between_dofs (*this); } @@ -3107,7 +3107,7 @@ namespace hp unsigned int DoFHandler::max_couplings_between_boundary_dofs () const { - Assert (finite_elements != 0, ExcNoFESelected()); + Assert (finite_elements != nullptr, ExcNoFESelected()); switch (dim) { @@ -3267,7 +3267,7 @@ namespace hp // (besides, we would trip over // an assertion in // set_active_fe_index) - if (finite_elements != 0) + if (finite_elements != nullptr) { cell_iterator cell = begin(), endc = end (); @@ -3348,7 +3348,7 @@ namespace hp delete levels[i]; levels.resize (0); delete faces; - faces = NULL; + faces = nullptr; { std::vector tmp; diff --git a/source/hp/fe_values.cc b/source/hp/fe_values.cc index c212cccaf8..67762f159f 100644 --- a/source/hp/fe_values.cc +++ b/source/hp/fe_values.cc @@ -91,7 +91,7 @@ namespace internal // already have an object for // this particular combination // of indices - if (fe_values_table(present_fe_values_index).get() == 0) + if (fe_values_table(present_fe_values_index).get() == nullptr) fe_values_table(present_fe_values_index) = std::shared_ptr diff --git a/source/lac/block_matrix_array.cc b/source/lac/block_matrix_array.cc index 621b39bf67..476221eaad 100644 --- a/source/lac/block_matrix_array.cc +++ b/source/lac/block_matrix_array.cc @@ -36,7 +36,7 @@ BlockMatrixArray::Entry::Entry (const Entry &e) matrix(e.matrix) { Entry &e2 = const_cast(e); - e2.matrix = 0; + e2.matrix = nullptr; } diff --git a/source/lac/block_sparsity_pattern.cc b/source/lac/block_sparsity_pattern.cc index 6512ae4ea8..d51e74e5a5 100644 --- a/source/lac/block_sparsity_pattern.cc +++ b/source/lac/block_sparsity_pattern.cc @@ -87,7 +87,7 @@ reinit (const size_type n_block_rows, for (size_type j=0; jentries[i].first); - Assert (other_line != 0, + Assert (other_line != nullptr, ExcInternalError()); const double weight = line->entries[i].second; @@ -1234,7 +1234,7 @@ ConstraintMatrix::resolve_indices (std::vector &indices line_ptr = get_constraint_entries(indices[i]); // if the index is constraint, the constraints indices are added to the // indices vector - if (line_ptr!=NULL) + if (line_ptr!=nullptr) { const unsigned int line_size = line_ptr->size(); for (unsigned int j=0; j::initialize(const LAPACKFullMatrix &M) { matrix = &M; - mem = 0; + mem = nullptr; } @@ -1071,7 +1071,7 @@ void PreconditionLU::vmult(BlockVector &dst, const BlockVector &src) const { - Assert(mem != 0, ExcNotInitialized()); + Assert(mem != nullptr, ExcNotInitialized()); Vector *aux = mem->alloc(); *aux = src; matrix->apply_lu_factorization(*aux, false); @@ -1084,7 +1084,7 @@ void PreconditionLU::Tvmult(BlockVector &dst, const BlockVector &src) const { - Assert(mem != 0, ExcNotInitialized()); + Assert(mem != nullptr, ExcNotInitialized()); Vector *aux = mem->alloc(); *aux = src; matrix->apply_lu_factorization(*aux, true); diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index 3c45574bb1..4b0b53e89f 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -75,7 +75,7 @@ namespace PETScWrappers MatrixBase::MatrixBase () : - matrix (NULL), + matrix (nullptr), last_action (VectorOperation::unknown) {} @@ -102,7 +102,7 @@ namespace PETScWrappers const int m=0, n=0, n_nonzero_per_row=0; const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row, - 0, &matrix); + nullptr, &matrix); AssertThrow (ierr == 0, ExcPETScError(ierr)); } diff --git a/source/lac/petsc_matrix_free.cc b/source/lac/petsc_matrix_free.cc index fdb77fbbbc..fba3879f56 100644 --- a/source/lac/petsc_matrix_free.cc +++ b/source/lac/petsc_matrix_free.cc @@ -182,8 +182,8 @@ namespace PETScWrappers // a given PETSc Vec* object without allocating new memory // and without taking ownership of the Vec* - VectorBase *x = 0; - VectorBase *y = 0; + VectorBase *x = nullptr; + VectorBase *y = nullptr; // because we do not know, // if dst and src are sequential // or distributed vectors, diff --git a/source/lac/petsc_parallel_sparse_matrix.cc b/source/lac/petsc_parallel_sparse_matrix.cc index 4480f251bf..c2478f7146 100644 --- a/source/lac/petsc_parallel_sparse_matrix.cc +++ b/source/lac/petsc_parallel_sparse_matrix.cc @@ -39,7 +39,7 @@ namespace PETScWrappers const int m=0, n=0, n_nonzero_per_row=0; const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row, - 0, &matrix); + nullptr, &matrix); AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -250,8 +250,8 @@ namespace PETScWrappers (communicator, local_rows, local_columns, m, n, - n_nonzero_per_row, 0, - n_offdiag_nonzero_per_row, 0, + n_nonzero_per_row, nullptr, + n_offdiag_nonzero_per_row, nullptr, &matrix); set_matrix_option (matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE); #endif @@ -319,7 +319,7 @@ namespace PETScWrappers m, n, 0, &int_row_lengths[0], 0, - offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : 0, + offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : nullptr, &matrix); //TODO: Sometimes the actual number of nonzero entries allocated is greater than the number of nonzero entries, which petsc will complain about unless explicitly disabled with MatSetOption. There is probably a way to prevent a different number nonzero elements being allocated in the first place. (See also previous TODO). @@ -451,7 +451,7 @@ namespace PETScWrappers ierr = MatMPIAIJSetPreallocationCSR (matrix, &rowstart_in_window[0], &colnums_in_window[0], - 0); + nullptr); AssertThrow (ierr == 0, ExcPETScError(ierr)); } else @@ -460,7 +460,7 @@ namespace PETScWrappers ierr = MatMPIAIJSetPreallocationCSR (matrix, &i, &i, - 0); + nullptr); AssertThrow (ierr == 0, ExcPETScError(ierr)); } compress (dealii::VectorOperation::insert); @@ -628,7 +628,7 @@ namespace PETScWrappers ierr = MatMPIAIJSetPreallocationCSR (matrix, &rowstart_in_window[0], &colnums_in_window[0], - 0); + nullptr); AssertThrow (ierr == 0, ExcPETScError(ierr)); #if DEAL_II_PETSC_VERSION_LT(2,3,3) diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index be0af823c2..80d4d1096f 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -306,7 +306,7 @@ namespace PETScWrappers ? (const PetscInt *)(&(ghostindices[0])) : - 0); + nullptr); PetscErrorCode ierr = VecCreateGhost(communicator, local_size, diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 267e43b721..77f3dda669 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -32,7 +32,7 @@ namespace PETScWrappers { PreconditionerBase::PreconditionerBase () : - pc(NULL), matrix(NULL) + pc(nullptr), matrix(nullptr) {} PreconditionerBase::~PreconditionerBase () @@ -48,16 +48,16 @@ namespace PETScWrappers void PreconditionerBase::clear () { - matrix = NULL; + matrix = nullptr; - if (pc!=NULL) + if (pc!=nullptr) { #if DEAL_II_PETSC_VERSION_LT(3,2,0) PetscErrorCode ierr = PCDestroy(pc); #else PetscErrorCode ierr = PCDestroy(&pc); #endif - pc = NULL; + pc = nullptr; AssertThrow (ierr == 0, ExcPETScError(ierr)); } } @@ -67,7 +67,7 @@ namespace PETScWrappers PreconditionerBase::vmult (VectorBase &dst, const VectorBase &src) const { - AssertThrow (pc != NULL, StandardExceptions::ExcInvalidState ()); + AssertThrow (pc != nullptr, StandardExceptions::ExcInvalidState ()); const PetscErrorCode ierr = PCApply(pc, src, dst); AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -79,7 +79,7 @@ namespace PETScWrappers { // only allow the creation of the // preconditioner once - AssertThrow (pc == NULL, StandardExceptions::ExcInvalidState ()); + AssertThrow (pc == nullptr, StandardExceptions::ExcInvalidState ()); MPI_Comm comm; // this ugly cast is necessary because the @@ -140,7 +140,7 @@ namespace PETScWrappers void PreconditionJacobi::initialize() { - AssertThrow (pc != NULL, StandardExceptions::ExcInvalidState ()); + AssertThrow (pc != nullptr, StandardExceptions::ExcInvalidState ()); PetscErrorCode ierr = PCSetType (pc, const_cast(PCJACOBI)); AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/source/lac/petsc_solver.cc b/source/lac/petsc_solver.cc index d2e9554ff8..1654a29d3d 100644 --- a/source/lac/petsc_solver.cc +++ b/source/lac/petsc_solver.cc @@ -69,7 +69,7 @@ namespace PETScWrappers // first create a solver object if this // is necessary - if (solver_data.get() == 0) + if (solver_data.get() == nullptr) { solver_data.reset (new SolverData()); @@ -87,7 +87,7 @@ namespace PETScWrappers // make sure the preconditioner has an associated matrix set const Mat B = preconditioner; - AssertThrow (B != NULL, + AssertThrow (B != nullptr, ExcMessage("PETSc preconditioner should have an" "associated matrix set to be used in solver.")); diff --git a/source/lac/petsc_sparse_matrix.cc b/source/lac/petsc_sparse_matrix.cc index fc9addf236..913490b7e8 100644 --- a/source/lac/petsc_sparse_matrix.cc +++ b/source/lac/petsc_sparse_matrix.cc @@ -32,7 +32,7 @@ namespace PETScWrappers { const int m=0, n=0, n_nonzero_per_row=0; const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, - n_nonzero_per_row, 0, &matrix); + n_nonzero_per_row, nullptr, &matrix); AssertThrow (ierr == 0, ExcPETScError(ierr)); } @@ -147,7 +147,7 @@ namespace PETScWrappers // for all rows globally const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, n_nonzero_per_row, - 0, &matrix); + nullptr, &matrix); AssertThrow (ierr == 0, ExcPETScError(ierr)); // set symmetric flag, if so requested diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 4f07b8012b..42400bfbef 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -39,7 +39,7 @@ namespace PETScWrappers // if the vector is local, then // simply access the element we // are interested in - if (dynamic_cast(&vector) != 0) + if (dynamic_cast(&vector) != nullptr) { PetscInt idx = index; PetscScalar value; @@ -49,7 +49,7 @@ namespace PETScWrappers } // else see if we are dealing // with a parallel vector - else if (dynamic_cast(&vector) != 0) + else if (dynamic_cast(&vector) != nullptr) { // there is the possibility // that the vector has @@ -149,7 +149,7 @@ namespace PETScWrappers VectorBase::VectorBase () : - vector (NULL), + vector (nullptr), ghosted(false), last_action (::dealii::VectorOperation::unknown), attained_ownership(true) @@ -472,7 +472,7 @@ namespace PETScWrappers { // We can only use our more efficient // routine in the serial case. - if (dynamic_cast(this) != 0) + if (dynamic_cast(this) != nullptr) { PetscScalar sum; const PetscErrorCode ierr = VecSum(vector, &sum); diff --git a/source/lac/slepc_solver.cc b/source/lac/slepc_solver.cc index bd7d6ef50a..24481fb38a 100644 --- a/source/lac/slepc_solver.cc +++ b/source/lac/slepc_solver.cc @@ -59,7 +59,7 @@ namespace SLEPcWrappers SolverBase::~SolverBase () { - if (eps != NULL) + if (eps != nullptr) { // Destroy the solver object. #if DEAL_II_PETSC_VERSION_LT(3,2,0) diff --git a/source/lac/slepc_spectral_transformation.cc b/source/lac/slepc_spectral_transformation.cc index ef6bbcf2cd..a5e10174fc 100644 --- a/source/lac/slepc_spectral_transformation.cc +++ b/source/lac/slepc_spectral_transformation.cc @@ -39,7 +39,7 @@ namespace SLEPcWrappers TransformationBase::~TransformationBase () { - if (st!=NULL) + if (st!=nullptr) { const PetscErrorCode ierr = STDestroy(&st); AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr)); diff --git a/source/lac/sparse_direct.cc b/source/lac/sparse_direct.cc index 9c42688840..b7c51851ad 100644 --- a/source/lac/sparse_direct.cc +++ b/source/lac/sparse_direct.cc @@ -55,8 +55,8 @@ SparseDirectUMFPACK::SparseDirectUMFPACK () : _m (0), _n (0), - symbolic_decomposition (0), - numeric_decomposition (0), + symbolic_decomposition (nullptr), + numeric_decomposition (nullptr), control (UMFPACK_CONTROL) { umfpack_dl_defaults (&control[0]); @@ -68,16 +68,16 @@ void SparseDirectUMFPACK::clear () { // delete objects that haven't been deleted yet - if (symbolic_decomposition != 0) + if (symbolic_decomposition != nullptr) { umfpack_dl_free_symbolic (&symbolic_decomposition); - symbolic_decomposition = 0; + symbolic_decomposition = nullptr; } - if (numeric_decomposition != 0) + if (numeric_decomposition != nullptr) { umfpack_dl_free_numeric (&numeric_decomposition); - numeric_decomposition = 0; + numeric_decomposition = nullptr; } { @@ -281,14 +281,14 @@ factorize (const Matrix &matrix) status = umfpack_dl_symbolic (N, N, &Ap[0], &Ai[0], &Ax[0], &symbolic_decomposition, - &control[0], 0); + &control[0], nullptr); AssertThrow (status == UMFPACK_OK, ExcUMFPACKError("umfpack_dl_symbolic", status)); status = umfpack_dl_numeric (&Ap[0], &Ai[0], &Ax[0], symbolic_decomposition, &numeric_decomposition, - &control[0], 0); + &control[0], nullptr); AssertThrow (status == UMFPACK_OK, ExcUMFPACKError("umfpack_dl_numeric", status)); @@ -320,7 +320,7 @@ SparseDirectUMFPACK::solve (Vector &rhs_and_solution, &Ap[0], &Ai[0], &Ax[0], rhs_and_solution.begin(), rhs.begin(), numeric_decomposition, - &control[0], 0); + &control[0], nullptr); AssertThrow (status == UMFPACK_OK, ExcUMFPACKError("umfpack_dl_solve", status)); } diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index 32e6523f02..6cb9e252db 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -41,8 +41,8 @@ SparsityPattern::SparsityPattern () : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0), + rowstart(nullptr), + colnums(nullptr), compressed(false), store_diagonal_first_in_row(false) { @@ -56,8 +56,8 @@ SparsityPattern::SparsityPattern (const SparsityPattern &s) Subscriptor(), max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0), + rowstart(nullptr), + colnums(nullptr), compressed(false), store_diagonal_first_in_row(false) { @@ -78,8 +78,8 @@ SparsityPattern::SparsityPattern (const size_type m, : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0), + rowstart(nullptr), + colnums(nullptr), compressed(false), store_diagonal_first_in_row(m == n) { @@ -94,8 +94,8 @@ SparsityPattern::SparsityPattern (const size_type m, : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0), + rowstart(nullptr), + colnums(nullptr), store_diagonal_first_in_row(m == n) { reinit (m, n, row_lengths); @@ -108,8 +108,8 @@ SparsityPattern::SparsityPattern (const size_type m, : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0) + rowstart(nullptr), + colnums(nullptr) { reinit (m, m, max_per_row); } @@ -121,8 +121,8 @@ SparsityPattern::SparsityPattern (const size_type m, : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0) + rowstart(nullptr), + colnums(nullptr) { reinit (m, m, row_lengths); } @@ -135,8 +135,8 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, : max_dim(0), max_vec_len(0), - rowstart(0), - colnums(0) + rowstart(nullptr), + colnums(nullptr) { Assert (original.rows==original.cols, ExcNotQuadratic()); Assert (original.is_compressed(), ExcNotCompressed()); @@ -216,8 +216,8 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, SparsityPattern::~SparsityPattern () { - if (rowstart != 0) delete[] rowstart; - if (colnums != 0) delete[] colnums; + if (rowstart != nullptr) delete[] rowstart; + if (colnums != nullptr) delete[] colnums; } @@ -267,8 +267,8 @@ SparsityPattern::reinit (const size_type m, { if (rowstart) delete[] rowstart; if (colnums) delete[] colnums; - rowstart = 0; - colnums = 0; + rowstart = nullptr; + colnums = nullptr; max_vec_len = max_dim = rows = cols = 0; // if dimension is zero: ignore max_per_row max_row_length = 0; @@ -304,7 +304,7 @@ SparsityPattern::reinit (const size_type m, if (colnums) { delete[] colnums; - colnums = 0; + colnums = nullptr; } max_vec_len = vec_len; @@ -331,7 +331,7 @@ SparsityPattern::reinit (const size_type m, if (rowstart) { delete[] rowstart; - rowstart = 0; + rowstart = nullptr; } max_dim = rows; @@ -344,7 +344,7 @@ SparsityPattern::reinit (const size_type m, if (colnums) { delete[] colnums; - colnums = 0; + colnums = nullptr; } max_vec_len = vec_len; @@ -381,7 +381,7 @@ SparsityPattern::reinit (const size_type m, void SparsityPattern::compress () { - Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); + Assert ((rowstart!=nullptr) && (colnums!=nullptr), ExcEmptyObject()); // do nothing if already compressed if (compressed) @@ -616,12 +616,12 @@ SparsityPattern::empty () const // and freeing memory was not present in the original implementation and I // don't know at how many places I missed something in adding it, so I try // to be cautious. wb) - if ((rowstart==0) || (rows==0) || (cols==0)) + if ((rowstart==nullptr) || (rows==0) || (cols==0)) { - Assert (rowstart==0, ExcInternalError()); + Assert (rowstart==nullptr, ExcInternalError()); Assert (rows==0, ExcInternalError()); Assert (cols==0, ExcInternalError()); - Assert (colnums==0, ExcInternalError()); + Assert (colnums==nullptr, ExcInternalError()); Assert (max_vec_len==0, ExcInternalError()); return true; @@ -654,7 +654,7 @@ SparsityPattern::size_type SparsityPattern::operator () (const size_type i, const size_type j) const { - Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); + Assert ((rowstart!=nullptr) && (colnums!=nullptr), ExcEmptyObject()); Assert (i::compute_eigenvalues() const int nn = n(); int info; - stev (&N, &nn, &*diagonal.begin(), &*right.begin(), 0, &one, 0, &info); + stev (&N, &nn, &*diagonal.begin(), &*right.begin(), nullptr, &one, nullptr, &info); Assert(info == 0, ExcInternalError()); state = eigenvalues; diff --git a/source/lac/trilinos_block_sparse_matrix.cc b/source/lac/trilinos_block_sparse_matrix.cc index 083d87d0e6..f2cbadf0ca 100644 --- a/source/lac/trilinos_block_sparse_matrix.cc +++ b/source/lac/trilinos_block_sparse_matrix.cc @@ -76,7 +76,7 @@ namespace TrilinosWrappers { BlockType *p = new BlockType(); - Assert (this->sub_objects[r][c] == 0, + Assert (this->sub_objects[r][c] == nullptr, ExcInternalError()); this->sub_objects[r][c] = p; } diff --git a/source/lac/trilinos_epetra_vector.cc b/source/lac/trilinos_epetra_vector.cc index 28a331fe21..078c36acf3 100644 --- a/source/lac/trilinos_epetra_vector.cc +++ b/source/lac/trilinos_epetra_vector.cc @@ -106,7 +106,7 @@ namespace LinearAlgebra { // If no communication pattern is given, create one. Otherwsie, use the // one given. - if (communication_pattern == NULL) + if (communication_pattern == nullptr) { // The first time import is called, a communication pattern is created. // Check if the communication pattern already exists and if it can be @@ -123,7 +123,7 @@ namespace LinearAlgebra { epetra_comm_pattern = std::dynamic_pointer_cast (communication_pattern); - AssertThrow(epetra_comm_pattern != NULL, + AssertThrow(epetra_comm_pattern != nullptr, ExcMessage(std::string("The communication pattern is not of type ") + "LinearAlgebra::EpetraWrappers::CommunicationPattern.")); } @@ -167,7 +167,7 @@ namespace LinearAlgebra Vector &Vector::operator+= (const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, ExcVectorTypeNotCompatible()); + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. const Vector &down_V = dynamic_cast(V); @@ -222,7 +222,7 @@ namespace LinearAlgebra double Vector::operator* (const VectorSpaceVector &V) const { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -255,7 +255,7 @@ namespace LinearAlgebra void Vector::add(const double a, const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -275,10 +275,10 @@ namespace LinearAlgebra const double b, const VectorSpaceVector &W) { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Check that casting will work. - Assert(dynamic_cast(&W)!=NULL, + Assert(dynamic_cast(&W)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -304,7 +304,7 @@ namespace LinearAlgebra const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); *this *= s; @@ -320,7 +320,7 @@ namespace LinearAlgebra void Vector::scale(const VectorSpaceVector &scaling_factors) { // Check that casting will work. - Assert(dynamic_cast(&scaling_factors)!=NULL, + Assert(dynamic_cast(&scaling_factors)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast scaling_factors. If fails, throws an exception. @@ -340,7 +340,7 @@ namespace LinearAlgebra void Vector::equ(const double a, const VectorSpaceVector &V) { // Check that casting will work. - Assert(dynamic_cast(&V)!=NULL, + Assert(dynamic_cast(&V)!=nullptr, ExcVectorTypeNotCompatible()); // Downcast V. If fails, throws an exception. @@ -434,7 +434,7 @@ namespace LinearAlgebra { const Epetra_MpiComm *epetra_comm = dynamic_cast(&(vector->Comm())); - Assert (epetra_comm != 0, ExcInternalError()); + Assert (epetra_comm != nullptr, ExcInternalError()); return epetra_comm->GetMpiComm(); } diff --git a/source/lac/trilinos_precondition.cc b/source/lac/trilinos_precondition.cc index 674321ec6d..28564d6b87 100644 --- a/source/lac/trilinos_precondition.cc +++ b/source/lac/trilinos_precondition.cc @@ -129,8 +129,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -181,8 +181,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -234,8 +234,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -290,8 +290,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -350,8 +350,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -411,8 +411,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -468,8 +468,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -519,8 +519,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -572,8 +572,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -618,8 +618,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -667,8 +667,8 @@ namespace TrilinosWrappers Ifpack_Chebyshev *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; @@ -727,8 +727,8 @@ namespace TrilinosWrappers Ifpack_Preconditioner *ifpack = static_cast (preconditioner.get()); - Assert (ifpack != 0, ExcMessage ("Trilinos could not create this " - "preconditioner")); + Assert (ifpack != nullptr, ExcMessage ("Trilinos could not create this " + "preconditioner")); int ierr; diff --git a/source/lac/trilinos_precondition_ml.cc b/source/lac/trilinos_precondition_ml.cc index e245aec4b2..cba0f83216 100644 --- a/source/lac/trilinos_precondition_ml.cc +++ b/source/lac/trilinos_precondition_ml.cc @@ -235,7 +235,7 @@ namespace TrilinosWrappers { ML_Epetra::MultiLevelPreconditioner *multilevel_operator = dynamic_cast (preconditioner.get()); - Assert (multilevel_operator != 0, + Assert (multilevel_operator != nullptr, ExcMessage ("Preconditioner setup failed.")); multilevel_operator->PrintUnused(0); } @@ -281,7 +281,7 @@ namespace TrilinosWrappers vector_distributor.reset (new Epetra_Map(static_cast(n_rows), 0, communicator)); - if (trilinos_matrix.get() == 0) + if (trilinos_matrix.get() == nullptr) trilinos_matrix.reset (new SparseMatrix()); trilinos_matrix->reinit (*vector_distributor, *vector_distributor, @@ -317,7 +317,7 @@ namespace TrilinosWrappers // todo: find a way to read out ML's data // sizes - if (trilinos_matrix.get() != 0) + if (trilinos_matrix.get() != nullptr) memory += trilinos_matrix->memory_consumption(); return memory; } diff --git a/source/lac/trilinos_precondition_muelu.cc b/source/lac/trilinos_precondition_muelu.cc index c69fc1adcb..7589c908d7 100644 --- a/source/lac/trilinos_precondition_muelu.cc +++ b/source/lac/trilinos_precondition_muelu.cc @@ -290,7 +290,7 @@ namespace TrilinosWrappers vector_distributor.reset (new Epetra_Map(static_cast(n_rows), 0, communicator)); - if (trilinos_matrix.get() == 0) + if (trilinos_matrix.get() == nullptr) trilinos_matrix.reset (new SparseMatrix()); trilinos_matrix->reinit (*vector_distributor, *vector_distributor, @@ -317,7 +317,7 @@ namespace TrilinosWrappers // todo: find a way to read out ML's data // sizes - if (trilinos_matrix.get() != 0) + if (trilinos_matrix.get() != nullptr) memory += trilinos_matrix->memory_consumption(); return memory; } diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index a6d704af78..e0622ba46a 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -138,7 +138,7 @@ namespace TrilinosWrappers // get a representation of the present row int ncols; TrilinosWrappers::types::int_type colnums = matrix->n(); - if (value_cache.get() == 0) + if (value_cache.get() == nullptr) { value_cache.reset (new std::vector (matrix->n())); colnum_cache.reset (new std::vector (matrix->n())); @@ -447,7 +447,7 @@ namespace TrilinosWrappers matrix->FillComplete(*column_space_map, matrix->RowMap()); } - if (rhs.nonlocal_matrix.get() != 0) + if (rhs.nonlocal_matrix.get() != nullptr) nonlocal_matrix.reset(new Epetra_CrsMatrix(Copy, rhs.nonlocal_matrix->Graph())); } @@ -636,7 +636,7 @@ namespace TrilinosWrappers relevant_rows.fill_index_vector(indices); Epetra_Map relevant_map (TrilinosWrappers::types::int_type(-1), TrilinosWrappers::types::int_type(relevant_rows.n_elements()), - (indices.empty() ? 0 : + (indices.empty() ? nullptr : reinterpret_cast(&indices[0])), 0, input_row_map.Comm()); if (relevant_map.SameAs(input_row_map)) @@ -663,7 +663,7 @@ namespace TrilinosWrappers } Epetra_Map off_processor_map(-1, ghost_rows.size(), - (ghost_rows.size()>0)?(&ghost_rows[0]):NULL, + (ghost_rows.size()>0)?(&ghost_rows[0]):nullptr, 0, input_row_map.Comm()); std::shared_ptr graph; @@ -671,7 +671,7 @@ namespace TrilinosWrappers if (input_row_map.Comm().NumProc() > 1) { graph.reset (new Epetra_CrsGraph (Copy, input_row_map, - (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):NULL, + (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):nullptr, exchange_data ? false : true)); if (have_ghost_rows == true) nonlocal_graph.reset (new Epetra_CrsGraphMod (off_processor_map, @@ -679,7 +679,7 @@ namespace TrilinosWrappers } else graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map, - (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):NULL, + (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):nullptr, true)); // now insert the indices, select between the right matrix @@ -701,14 +701,14 @@ namespace TrilinosWrappers graph->InsertGlobalIndices (global_row, row_length, &row_indices[0]); else { - Assert(nonlocal_graph.get() != 0, ExcInternalError()); + Assert(nonlocal_graph.get() != nullptr, ExcInternalError()); nonlocal_graph->InsertGlobalIndices (global_row, row_length, &row_indices[0]); } } // finalize nonlocal graph and create nonlocal matrix - if (nonlocal_graph.get() != 0) + if (nonlocal_graph.get() != nullptr) { // must make sure the IndicesAreGlobal flag is set on all processors // because some processors might not call InsertGlobalIndices (and @@ -834,7 +834,7 @@ namespace TrilinosWrappers matrix.reset (new Epetra_FECrsMatrix (Copy, sparsity_pattern.trilinos_sparsity_pattern(), false)); - if (sparsity_pattern.nonlocal_graph.get() != 0) + if (sparsity_pattern.nonlocal_graph.get() != nullptr) nonlocal_matrix.reset (new Epetra_CrsMatrix(Copy, *sparsity_pattern.nonlocal_graph)); else nonlocal_matrix.reset (); @@ -857,7 +857,7 @@ namespace TrilinosWrappers matrix.reset (new Epetra_FECrsMatrix (Copy, sparse_matrix.trilinos_sparsity_pattern(), false)); - if (sparse_matrix.nonlocal_matrix != 0) + if (sparse_matrix.nonlocal_matrix != nullptr) nonlocal_matrix.reset (new Epetra_CrsMatrix (Copy, sparse_matrix.nonlocal_matrix->Graph())); else @@ -883,7 +883,7 @@ namespace TrilinosWrappers { // in case we do not copy values, just // call the other function. - if (use_this_sparsity == 0) + if (use_this_sparsity == nullptr) reinit (row_parallel_partitioning, col_parallel_partitioning, dealii_sparse_matrix.get_sparsity_pattern(), communicator, false); @@ -899,10 +899,10 @@ namespace TrilinosWrappers AssertDimension (col_parallel_partitioning.size(), dealii_sparse_matrix.n()); const ::dealii::SparsityPattern &sparsity_pattern = - (use_this_sparsity!=0)? *use_this_sparsity : + (use_this_sparsity!=nullptr)? *use_this_sparsity : dealii_sparse_matrix.get_sparsity_pattern(); - if (matrix.get() == 0 || + if (matrix.get() == nullptr || m() != n_rows || n_nonzero_elements() != sparsity_pattern.n_nonzero_elements()) { @@ -1073,12 +1073,12 @@ namespace TrilinosWrappers // flush buffers int ierr; - if (nonlocal_matrix.get() != 0 && mode == Add) + if (nonlocal_matrix.get() != nullptr && mode == Add) { // do only export in case of an add() operation, otherwise the owning // processor must have set the correct entry nonlocal_matrix->FillComplete(*column_space_map, matrix->RowMap()); - if (nonlocal_matrix_exporter.get() == 0) + if (nonlocal_matrix_exporter.get() == nullptr) nonlocal_matrix_exporter.reset (new Epetra_Export(nonlocal_matrix->RowMap(), matrix->RowMap())); ierr = matrix->Export(*nonlocal_matrix, *nonlocal_matrix_exporter, mode); @@ -1674,7 +1674,7 @@ namespace TrilinosWrappers col_value_ptr, col_index_ptr); } - else if (nonlocal_matrix.get() != 0) + else if (nonlocal_matrix.get() != nullptr) { compressed = false; // this is the case when we have explicitly set the off-processor rows @@ -1721,7 +1721,7 @@ namespace TrilinosWrappers << " has the following indices:" << std::endl; std::vector indices; const Epetra_CrsGraph *graph = - (nonlocal_matrix.get() != 0 && + (nonlocal_matrix.get() != nullptr && matrix->RowMap().MyGID(static_cast(row)) == false) ? &nonlocal_matrix->Graph() : &matrix->Graph(); @@ -1751,7 +1751,7 @@ namespace TrilinosWrappers const int ierr = matrix->PutScalar(d); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); - if (nonlocal_matrix.get() != 0) + if (nonlocal_matrix.get() != nullptr) nonlocal_matrix->PutScalar(d); return *this; @@ -2250,7 +2250,7 @@ namespace TrilinosWrappers int max_per_proc; TrilinosWrappers::types::int_type N_input_vector = B_->invec_leng; getrow_comm = B_->getrow->pre_comm; - if ( getrow_comm != NULL) + if ( getrow_comm != nullptr) for (TrilinosWrappers::types::int_type i = 0; i < getrow_comm->N_neighbors; i++) for (TrilinosWrappers::types::int_type j = 0; j < getrow_comm->neighbors[i].N_send; j++) AssertThrow (getrow_comm->neighbors[i].send_list[j] < N_input_vector, @@ -2259,7 +2259,7 @@ namespace TrilinosWrappers ML_create_unique_col_id(N_input_vector, &(B_->getrow->loc_glob_map), getrow_comm, &max_per_proc, B_->comm); B_->getrow->use_loc_glob_map = ML_YES; - if (A_->getrow->pre_comm != NULL) + if (A_->getrow->pre_comm != nullptr) ML_exchange_rows( B_, &Btmp, A_->getrow->pre_comm); else Btmp = B_; @@ -2269,20 +2269,20 @@ namespace TrilinosWrappers // release temporary structures we needed // for multiplication ML_free(B_->getrow->loc_glob_map); - B_->getrow->loc_glob_map = NULL; + B_->getrow->loc_glob_map = nullptr; B_->getrow->use_loc_glob_map = ML_NO; - if (A_->getrow->pre_comm != NULL) + if (A_->getrow->pre_comm != nullptr) { tptr = Btmp; - while ( (tptr!= NULL) && (tptr->sub_matrix != B_)) + while ( (tptr!= nullptr) && (tptr->sub_matrix != B_)) tptr = tptr->sub_matrix; - if (tptr != NULL) tptr->sub_matrix = NULL; + if (tptr != nullptr) tptr->sub_matrix = nullptr; ML_RECUR_CSR_MSRdata_Destroy(Btmp); ML_Operator_Destroy(&Btmp); } // make correct data structures - if (A_->getrow->post_comm != NULL) + if (A_->getrow->post_comm != nullptr) ML_exchange_rows(Ctmp, &Ctmp2, A_->getrow->post_comm); else Ctmp2 = Ctmp; @@ -2292,7 +2292,7 @@ namespace TrilinosWrappers ML_RECUR_CSR_MSRdata_Destroy (Ctmp); ML_Operator_Destroy (&Ctmp); - if (A_->getrow->post_comm != NULL) + if (A_->getrow->post_comm != nullptr) { ML_RECUR_CSR_MSRdata_Destroy(Ctmp2); ML_Operator_Destroy (&Ctmp2); @@ -2433,7 +2433,7 @@ namespace TrilinosWrappers const Epetra_MpiComm *mpi_comm = dynamic_cast(&matrix->RangeMap().Comm()); - Assert(mpi_comm != 0, ExcInternalError()); + Assert(mpi_comm != nullptr, ExcInternalError()); return mpi_comm->Comm(); #else diff --git a/source/lac/trilinos_sparsity_pattern.cc b/source/lac/trilinos_sparsity_pattern.cc index 55fa3b1929..d75f8aa715 100644 --- a/source/lac/trilinos_sparsity_pattern.cc +++ b/source/lac/trilinos_sparsity_pattern.cc @@ -767,8 +767,8 @@ namespace TrilinosWrappers SparsityPattern::compress () { int ierr; - Assert (column_space_map.get() != 0, ExcInternalError()); - if (nonlocal_graph.get() != 0) + Assert (column_space_map.get() != nullptr, ExcInternalError()); + if (nonlocal_graph.get() != nullptr) { if (nonlocal_graph->IndicesAreGlobal() == false && nonlocal_graph->RowMap().NumMyElements() > 0) @@ -1051,7 +1051,7 @@ namespace TrilinosWrappers const Epetra_MpiComm *mpi_comm = dynamic_cast(&graph->RangeMap().Comm()); - Assert (mpi_comm != 0, ExcInternalError()); + Assert (mpi_comm != nullptr, ExcInternalError()); return mpi_comm->Comm(); #else diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index 9fb3d4ef91..9858a5d9f8 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -240,7 +240,7 @@ namespace TrilinosWrappers #if defined(DEBUG) && defined(DEAL_II_WITH_MPI) const Epetra_MpiComm *comm_ptr = dynamic_cast(&(vector->Comm())); - Assert (comm_ptr != 0, ExcInternalError()); + Assert (comm_ptr != nullptr, ExcInternalError()); const size_type n_elements_global = Utilities::MPI::sum (owned_elements.n_elements(), comm_ptr->Comm()); @@ -309,7 +309,7 @@ namespace TrilinosWrappers #ifdef DEAL_II_WITH_MPI const Epetra_MpiComm *my_comm = dynamic_cast(&vector->Comm()); const Epetra_MpiComm *v_comm = dynamic_cast(&v.vector->Comm()); - const bool same_communicators = my_comm != NULL && v_comm != NULL && + const bool same_communicators = my_comm != nullptr && v_comm != nullptr && my_comm->DataPtr() == v_comm->DataPtr(); #else const bool same_communicators = true; @@ -361,7 +361,7 @@ namespace TrilinosWrappers #if defined(DEBUG) && defined(DEAL_II_WITH_MPI) const Epetra_MpiComm *comm_ptr = dynamic_cast(&(v.vector->Comm())); - Assert (comm_ptr != 0, ExcInternalError()); + Assert (comm_ptr != nullptr, ExcInternalError()); const size_type n_elements_global = Utilities::MPI::sum (owned_elements.n_elements(), comm_ptr->Comm()); @@ -440,7 +440,7 @@ namespace TrilinosWrappers #if defined(DEBUG) && defined(DEAL_II_WITH_MPI) const Epetra_MpiComm *comm_ptr = dynamic_cast(&(vector->Comm())); - Assert (comm_ptr != 0, ExcInternalError()); + Assert (comm_ptr != nullptr, ExcInternalError()); const size_type n_elements_global = Utilities::MPI::sum (owned_elements.n_elements(), comm_ptr->Comm()); @@ -503,7 +503,7 @@ namespace TrilinosWrappers #ifdef DEAL_II_WITH_MPI const Epetra_MpiComm *my_comm = dynamic_cast(&vector->Comm()); const Epetra_MpiComm *v_comm = dynamic_cast(&v.vector->Comm()); - const bool same_communicators = my_comm != NULL && v_comm != NULL && + const bool same_communicators = my_comm != nullptr && v_comm != nullptr && my_comm->DataPtr() == v_comm->DataPtr(); // Need to ask MPI whether the communicators are the same. We would like // to use the following checks but currently we cannot make sure the @@ -535,7 +535,7 @@ namespace TrilinosWrappers if (same_communicators && v.vector->Map().SameAs(vector->Map())) { *vector = *v.vector; - if (v.nonlocal_vector.get() != 0) + if (v.nonlocal_vector.get() != nullptr) nonlocal_vector.reset(new Epetra_MultiVector(v.nonlocal_vector->Map(), 1)); last_action = Zero; } @@ -558,7 +558,7 @@ namespace TrilinosWrappers owned_elements = v.owned_elements; } - if (v.nonlocal_vector.get() != 0) + if (v.nonlocal_vector.get() != nullptr) nonlocal_vector.reset(new Epetra_MultiVector(v.nonlocal_vector->Map(), 1)); return *this; @@ -744,7 +744,7 @@ namespace TrilinosWrappers #ifdef DEAL_II_WITH_MPI const Epetra_MpiComm *my_comm = dynamic_cast(&vector->Comm()); const Epetra_MpiComm *v_comm = dynamic_cast(&v.vector->Comm()); - const bool same_communicators = my_comm != NULL && v_comm != NULL && + const bool same_communicators = my_comm != nullptr && v_comm != nullptr && my_comm->DataPtr() == v_comm->DataPtr(); #else const bool same_communicators = true; diff --git a/source/lac/trilinos_vector_base.cc b/source/lac/trilinos_vector_base.cc index 528b2fe524..ed7689b8f8 100644 --- a/source/lac/trilinos_vector_base.cc +++ b/source/lac/trilinos_vector_base.cc @@ -134,7 +134,7 @@ namespace TrilinosWrappers VectorBase & VectorBase::operator = (const VectorBase &v) { - Assert (vector.get() != 0, + Assert (vector.get() != nullptr, ExcMessage("Vector is not constructed properly.")); if (local_range() != v.local_range()) @@ -214,7 +214,7 @@ namespace TrilinosWrappers double double_mode = mode; const Epetra_MpiComm *comm_ptr = dynamic_cast(&(vector_partitioner().Comm())); - Assert (comm_ptr != 0, ExcInternalError()); + Assert (comm_ptr != nullptr, ExcInternalError()); Utilities::MPI::MinMaxAvg result = Utilities::MPI::min_max_avg (double_mode, comm_ptr->GetMpiComm()); Assert(result.max-result.min<1e-5, @@ -227,7 +227,7 @@ namespace TrilinosWrappers // Now pass over the information about what we did last to the vector. int ierr = 0; - if (nonlocal_vector.get() == 0 || mode != Add) + if (nonlocal_vector.get() == nullptr || mode != Add) ierr = vector->GlobalAssemble(mode); else { @@ -372,7 +372,7 @@ namespace TrilinosWrappers // is zero on _all_ processors. const Epetra_MpiComm *mpi_comm = dynamic_cast(&vector->Map().Comm()); - Assert(mpi_comm != 0, ExcInternalError()); + Assert(mpi_comm != nullptr, ExcInternalError()); unsigned int num_nonzero = Utilities::MPI::sum(flag, mpi_comm->Comm()); return num_nonzero == 0; #else @@ -475,7 +475,7 @@ namespace TrilinosWrappers { double t = (*vector)[0][j]; - if (format != 0) + if (format != nullptr) std::printf (format, t); else std::printf (" %5.2f", double(t)); diff --git a/source/multigrid/mg_level_global_transfer.cc b/source/multigrid/mg_level_global_transfer.cc index e68c796566..033a7ca73d 100644 --- a/source/multigrid/mg_level_global_transfer.cc +++ b/source/multigrid/mg_level_global_transfer.cc @@ -76,7 +76,7 @@ MGLevelGlobalTransfer::fill_and_communicate_copy_indices const parallel::Triangulation *ptria = dynamic_cast *> (&mg_dof.get_tria()); - const MPI_Comm mpi_communicator = ptria != 0 ? ptria->get_communicator() : + const MPI_Comm mpi_communicator = ptria != nullptr ? ptria->get_communicator() : MPI_COMM_SELF; perform_plain_copy = Utilities::MPI::min(static_cast(perform_plain_copy), @@ -95,7 +95,7 @@ MGLevelGlobalTransfer::clear() copy_indices_global_mine.clear(); copy_indices_level_mine.clear(); component_to_block_map.resize(0); - mg_constrained_dofs = 0; + mg_constrained_dofs = nullptr; } @@ -173,7 +173,7 @@ MGLevelGlobalTransfer >::fill_and_com const parallel::Triangulation *ptria = dynamic_cast *> (&mg_dof.get_tria()); - const MPI_Comm mpi_communicator = ptria != 0 ? ptria->get_communicator() : + const MPI_Comm mpi_communicator = ptria != nullptr ? ptria->get_communicator() : MPI_COMM_SELF; IndexSet index_set(mg_dof.locally_owned_dofs().size()); @@ -286,7 +286,7 @@ MGLevelGlobalTransfer >::clear() copy_indices_global_mine.clear(); copy_indices_level_mine.clear(); component_to_block_map.resize(0); - mg_constrained_dofs = 0; + mg_constrained_dofs = nullptr; ghosted_global_vector.reinit(0); ghosted_level_vector.resize(0, 0); } diff --git a/source/multigrid/mg_transfer_block.cc b/source/multigrid/mg_transfer_block.cc index 21fcd462af..a560e66708 100644 --- a/source/multigrid/mg_transfer_block.cc +++ b/source/multigrid/mg_transfer_block.cc @@ -398,7 +398,7 @@ void MGTransferBlockBase::build_matrices ( // impose boundary conditions // but only in the column of // the prolongation matrix - if (mg_constrained_dofs != 0 && mg_constrained_dofs->have_boundary_indices()) + if (mg_constrained_dofs != nullptr && mg_constrained_dofs->have_boundary_indices()) { std::vector constrain_indices; std::vector > constraints_per_block (n_blocks); @@ -494,7 +494,7 @@ void MGTransferBlockSelect::build_matrices ( const unsigned int block = fe.system_to_block_index(i).first; if (selected[block]) { - if (mg_constrained_dofs != 0) + if (mg_constrained_dofs != nullptr) { if (!mg_constrained_dofs->at_refinement_edge(level,level_dof_indices[i])) temp_copy_indices[level_dof_indices[i] - mg_block_start[level][block]] diff --git a/source/multigrid/mg_transfer_internal.cc b/source/multigrid/mg_transfer_internal.cc index f2913b8a7c..7606ca0d6f 100644 --- a/source/multigrid/mg_transfer_internal.cc +++ b/source/multigrid/mg_transfer_internal.cc @@ -114,7 +114,7 @@ namespace internal for (unsigned int i=0; iat_refinement_edge(level, level_dof_indices[i])) continue; types::global_dof_index global_idx = globally_relevant.index_within_set(global_dof_indices[i]); @@ -151,7 +151,7 @@ namespace internal const dealii::parallel::distributed::Triangulation *tria = (dynamic_cast*> (&mg_dof.get_triangulation())); - AssertThrow(send_data_temp.size()==0 || tria!=NULL, ExcMessage("parallel Multigrid only works with a distributed Triangulation!")); + AssertThrow(send_data_temp.size()==0 || tria!=nullptr, ExcMessage("parallel Multigrid only works with a distributed Triangulation!")); #ifdef DEAL_II_WITH_MPI if (tria) @@ -201,7 +201,7 @@ namespace internal } else { - const int ierr = MPI_Isend(NULL, 0, MPI_BYTE, dest, 71, + const int ierr = MPI_Isend(nullptr, 0, MPI_BYTE, dest, 71, tria->get_communicator(), &*requests.rbegin()); AssertThrowMPI(ierr); } @@ -223,7 +223,7 @@ namespace internal if (len==0) { - ierr = MPI_Recv(NULL, 0, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG, + ierr = MPI_Recv(nullptr, 0, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG, tria->get_communicator(), &status); AssertThrowMPI(ierr); continue; @@ -596,7 +596,7 @@ namespace internal // set Dirichlet boundary conditions (as a list of // constrained DoFs) for the child - if (mg_constrained_dofs != 0) + if (mg_constrained_dofs != nullptr) for (unsigned int i=0; iis_boundary_index(level, local_dof_indices[elem_info.lexicographic_numbering[i]])) @@ -632,7 +632,7 @@ namespace internal &global_level_dof_indices_l0[start_index]); dirichlet_indices[0].push_back(std::vector()); - if (mg_constrained_dofs != 0) + if (mg_constrained_dofs != nullptr) for (unsigned int i=0; iis_boundary_index(0, local_dof_indices[elem_info.lexicographic_numbering[i]])) dirichlet_indices[0].back().push_back(i); @@ -665,7 +665,7 @@ namespace internal const parallel::Triangulation *ptria = (dynamic_cast*> (&tria)); const MPI_Comm communicator = - ptria != 0 ? ptria->get_communicator() : MPI_COMM_SELF; + ptria != nullptr ? ptria->get_communicator() : MPI_COMM_SELF; reinit_ghosted_vector (mg_dof.locally_owned_mg_dofs(level), ghosted_level_dofs, communicator, diff --git a/source/multigrid/mg_transfer_prebuilt.cc b/source/multigrid/mg_transfer_prebuilt.cc index a35c37353c..a97182c30d 100644 --- a/source/multigrid/mg_transfer_prebuilt.cc +++ b/source/multigrid/mg_transfer_prebuilt.cc @@ -249,7 +249,7 @@ void MGTransferPrebuilt::build_matrices = mg_dof.get_fe().get_prolongation_matrix (child, cell->refinement_case()); - if (this->mg_constrained_dofs != 0 && + if (this->mg_constrained_dofs != nullptr && this->mg_constrained_dofs->have_boundary_indices()) for (unsigned int j=0; jmg_constrained_dofs->is_boundary_index(level, dof_indices_parent[j])) diff --git a/source/multigrid/multigrid.cc b/source/multigrid/multigrid.cc index d5ccb8210b..19adb5148a 100644 --- a/source/multigrid/multigrid.cc +++ b/source/multigrid/multigrid.cc @@ -61,14 +61,14 @@ MGTransferBlockBase::MGTransferBlockBase (const ConstraintMatrix &/*c*/, template MGTransferBlock::MGTransferBlock () : - memory(0, typeid(*this).name()) + memory(nullptr, typeid(*this).name()) {} template MGTransferBlock::~MGTransferBlock () { - if (memory != 0) memory = 0; + if (memory != nullptr) memory = nullptr; } @@ -126,7 +126,7 @@ void MGTransferBlock::restrict_and_add ( { if (factors.size() != 0) { - Assert (memory != 0, ExcNotInitialized()); + Assert (memory != nullptr, ExcNotInitialized()); Vector *aux = memory->alloc(); aux->reinit(dst.block(this->mg_block[b])); prolongation_matrices[from_level-1]->block(b,b).Tvmult ( diff --git a/source/numerics/data_out.cc b/source/numerics/data_out.cc index 4fa6429a8f..d32cb9452d 100644 --- a/source/numerics/data_out.cc +++ b/source/numerics/data_out.cc @@ -145,7 +145,7 @@ build_one_patch const DataPostprocessor *postprocessor = this->dof_data[dataset]->postprocessor; - if (postprocessor != 0) + if (postprocessor != nullptr) { // we have to postprocess the data, so determine, which fields // have to be updated @@ -331,7 +331,7 @@ void DataOut::build_patches // Check consistency of redundant template parameter Assert (dim==DoFHandlerType::dimension, ExcDimensionMismatch(dim, DoFHandlerType::dimension)); - Assert (this->triangulation != 0, + Assert (this->triangulation != nullptr, Exceptions::DataOut::ExcNoTriangulationSelected()); const unsigned int n_subdivisions = (n_subdivisions_ != 0) diff --git a/source/numerics/data_out_dof_data.cc b/source/numerics/data_out_dof_data.cc index d8a7f6472f..e767e33cc0 100644 --- a/source/numerics/data_out_dof_data.cc +++ b/source/numerics/data_out_dof_data.cc @@ -82,7 +82,7 @@ namespace internal x_fe_values[i] = x_fe_values[j]; break; } - if (x_fe_values[i].get() == 0) + if (x_fe_values[i].get() == nullptr) x_fe_values[i].reset(new dealii::hp::FEValues (this->mapping_collection, *this->finite_elements[i], @@ -107,7 +107,7 @@ namespace internal x_fe_face_values[i] = x_fe_face_values[j]; break; } - if (x_fe_face_values[i].get() == 0) + if (x_fe_face_values[i].get() == nullptr) x_fe_face_values[i].reset(new dealii::hp::FEFaceValues (this->mapping_collection, *this->finite_elements[i], @@ -166,7 +166,7 @@ namespace internal x_fe_values[i] = x_fe_values[j]; break; } - if (x_fe_values[i].get() == 0) + if (x_fe_values[i].get() == nullptr) x_fe_values[i].reset(new dealii::hp::FEValues (this->mapping_collection, *this->finite_elements[i], @@ -190,7 +190,7 @@ namespace internal x_fe_face_values[i] = x_fe_face_values[j]; break; } - if (x_fe_face_values[i].get() == 0) + if (x_fe_face_values[i].get() == nullptr) x_fe_face_values[i].reset(new dealii::hp::FEFaceValues (this->mapping_collection, *this->finite_elements[i], @@ -312,7 +312,7 @@ namespace internal dof_handler (dofs, typeid(dealii::DataOut_DoFData).name()), names(names_in), data_component_interpretation (data_component_interpretation), - postprocessor(0, typeid(*this).name()), + postprocessor(nullptr, typeid(*this).name()), n_output_variables(names.size()) { Assert (names.size() == data_component_interpretation.size(), @@ -820,8 +820,8 @@ namespace internal void DataEntry::clear () { - vector = 0; - this->dof_handler = 0; + vector = nullptr; + this->dof_handler = nullptr; } } } @@ -832,8 +832,8 @@ template DataOut_DoFData::DataOut_DoFData () : - triangulation(0,typeid(*this).name()), - dofs(0,typeid(*this).name()) + triangulation(nullptr,typeid(*this).name()), + dofs(nullptr,typeid(*this).name()) {} @@ -892,10 +892,10 @@ add_data_vector (const VectorType &vec, const DataVectorType type, const std::vector &data_component_interpretation) { - Assert (triangulation != 0, + Assert (triangulation != nullptr, Exceptions::DataOut::ExcNoTriangulationSelected ()); const unsigned int n_components = - dofs != 0 ? dofs->get_fe().n_components () : 1; + dofs != nullptr ? dofs->get_fe().n_components () : 1; std::vector names; // if only one component or vector is cell vector: we only need one name @@ -931,7 +931,7 @@ add_data_vector (const VectorType &vec, const DataVectorType type, const std::vector &data_component_interpretation_) { - Assert (triangulation != 0, + Assert (triangulation != nullptr, Exceptions::DataOut::ExcNoTriangulationSelected ()); const std::vector & @@ -949,7 +949,7 @@ add_data_vector (const VectorType &vec, if (type == type_automatic) { // in the rare case that someone has a DGP(0) attached, we can not decide what she wants here: - Assert((dofs == 0) || (triangulation->n_active_cells() != dofs->n_dofs()), + Assert((dofs == nullptr) || (triangulation->n_active_cells() != dofs->n_dofs()), ExcMessage("Unable to determine the type of vector automatically because the number of DoFs " "is equal to the number of cells. Please specify DataVectorType.")); @@ -970,7 +970,7 @@ add_data_vector (const VectorType &vec, break; case type_dof_data: - Assert (dofs != 0, + Assert (dofs != nullptr, Exceptions::DataOut::ExcNoDoFHandlerSelected ()); Assert (vec.size() == dofs->n_dofs(), Exceptions::DataOut::ExcInvalidVectorSize (vec.size(), @@ -1010,7 +1010,7 @@ add_data_vector (const VectorType &vec, // things a bit simpler, we also don't need to deal with some of the other // stuff and use a different constructor of DataEntry - Assert (dofs != 0, + Assert (dofs != nullptr, Exceptions::DataOut::ExcNoDoFHandlerSelected ()); Assert (vec.size() == dofs->n_dofs(), @@ -1096,7 +1096,7 @@ add_data_vector // this is an extended version of the other functions where we pass a vector // together with its DoFHandler. if we do, we know that we have // type_dof_data, which makes things a bit simpler - if (triangulation == 0) + if (triangulation == nullptr) triangulation = SmartPointer >(&dof_handler.get_triangulation(), typeid(*this).name()); Assert (&dof_handler.get_triangulation() == triangulation, @@ -1152,8 +1152,8 @@ clear_input_data_references () for (unsigned int i=0; iclear (); - if (dofs != 0) - dofs = 0; + if (dofs != nullptr) + dofs = nullptr; } @@ -1166,8 +1166,8 @@ DataOut_DoFData::clear () dof_data.erase (dof_data.begin(), dof_data.end()); cell_data.erase (cell_data.begin(), cell_data.end()); - if (dofs != 0) - dofs = 0; + if (dofs != nullptr) + dofs = nullptr; // delete patches std::vector dummy; @@ -1320,7 +1320,7 @@ std::vectordof_data.size()); for (unsigned int i=0; idof_data.size(); ++i) { - Assert (dof_data[i]->dof_handler != 0, + Assert (dof_data[i]->dof_handler != nullptr, Exceptions::DataOut::ExcNoDoFHandlerSelected ()); // avoid creating too many finite elements and doing a lot of work on diff --git a/source/numerics/data_out_faces.cc b/source/numerics/data_out_faces.cc index a8ecfcc96d..6424125a5f 100644 --- a/source/numerics/data_out_faces.cc +++ b/source/numerics/data_out_faces.cc @@ -143,7 +143,7 @@ build_one_patch (const FaceDescriptor *cell_and_face, const unsigned int n_components = this_fe_patch_values.get_fe().n_components(); const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; - if (postprocessor != 0) + if (postprocessor != nullptr) { // we have to postprocess the data, so determine, which fields // have to be updated @@ -290,7 +290,7 @@ void DataOutFaces::build_patches (const Mapping & Assert (n_subdivisions >= 1, Exceptions::DataOut::ExcInvalidNumberOfSubdivisions(n_subdivisions)); - Assert (this->triangulation != 0, + Assert (this->triangulation != nullptr, Exceptions::DataOut::ExcNoTriangulationSelected()); this->validate_dataset_names(); diff --git a/source/numerics/data_out_rotation.cc b/source/numerics/data_out_rotation.cc index 664ec0e9cd..eb2b54a90d 100644 --- a/source/numerics/data_out_rotation.cc +++ b/source/numerics/data_out_rotation.cc @@ -191,7 +191,7 @@ build_one_patch (const cell_iterator const unsigned int n_components = fe_patch_values.get_fe().n_components(); const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; - if (postprocessor != 0) + if (postprocessor != nullptr) { // we have to postprocess the // data, so determine, which @@ -407,7 +407,7 @@ void DataOutRotation::build_patches (const unsigned int n_pa // Check consistency of redundant // template parameter Assert (dim==dimension, ExcDimensionMismatch(dim, dimension)); - Assert (this->triangulation != 0, + Assert (this->triangulation != nullptr, Exceptions::DataOut::ExcNoTriangulationSelected()); const unsigned int n_subdivisions = (nnnn_subdivisions != 0) diff --git a/source/numerics/data_out_stack.cc b/source/numerics/data_out_stack.cc index b931d0aaa0..bdd25283ec 100644 --- a/source/numerics/data_out_stack.cc +++ b/source/numerics/data_out_stack.cc @@ -168,7 +168,7 @@ template void DataOutStack::add_data_vector (const Vector &vec, const std::vector &names) { - Assert (dof_handler != 0, + Assert (dof_handler != nullptr, Exceptions::DataOut::ExcNoDoFHandlerSelected ()); // either cell data and one name, // or dof data and n_components names @@ -243,7 +243,7 @@ void DataOutStack::build_patches (const unsigned in Assert (n_subdivisions >= 1, Exceptions::DataOut::ExcInvalidNumberOfSubdivisions(n_subdivisions)); - Assert (dof_handler != 0, + Assert (dof_handler != nullptr, Exceptions::DataOut::ExcNoDoFHandlerSelected()); this->validate_dataset_names(); @@ -421,7 +421,7 @@ template void DataOutStack::finish_parameter_value () { // release lock on dof handler - dof_handler = 0; + dof_handler = nullptr; for (typename std::vector::iterator i=dof_data.begin(); i!=dof_data.end(); ++i) i->data.reinit (0); diff --git a/source/numerics/error_estimator_1d.cc b/source/numerics/error_estimator_1d.cc index b38c6be421..8ab52414bc 100644 --- a/source/numerics/error_estimator_1d.cc +++ b/source/numerics/error_estimator_1d.cc @@ -224,7 +224,7 @@ estimate (const Mapping<1,spacedim> &mapping, #ifdef DEAL_II_WITH_P4EST if (dynamic_cast*> (&dof_handler.get_triangulation()) - != 0) + != nullptr) Assert ((subdomain_id_ == numbers::invalid_subdomain_id) || (subdomain_id_ == @@ -237,7 +237,7 @@ estimate (const Mapping<1,spacedim> &mapping, const types::subdomain_id subdomain_id = ((dynamic_cast*> (&dof_handler.get_triangulation()) - != 0) + != nullptr) ? dynamic_cast&> (dof_handler.get_triangulation()).locally_owned_subdomain() @@ -269,7 +269,7 @@ estimate (const Mapping<1,spacedim> &mapping, Assert (component_mask.n_selected_components(n_components) > 0, ExcInvalidComponentMask()); - Assert ((coefficient == 0) || + Assert ((coefficient == nullptr) || (coefficient->n_components == n_components) || (coefficient->n_components == 1), ExcInvalidCoefficient()); @@ -283,7 +283,7 @@ estimate (const Mapping<1,spacedim> &mapping, ExcDimensionMismatch(solutions[n]->size(), dof_handler.n_dofs())); - Assert ((coefficient == 0) || + Assert ((coefficient == nullptr) || (coefficient->n_components == n_components) || (coefficient->n_components == 1), ExcInvalidCoefficient()); @@ -315,7 +315,7 @@ estimate (const Mapping<1,spacedim> &mapping, // coefficient, then we fill it by unity once and for all and don't set it // any more Vector coefficient_values (n_components); - if (coefficient == 0) + if (coefficient == nullptr) for (unsigned int c=0; c &mapping, // if there is a coefficient, then evaluate it at the present // position. if there is none, reuse the preset values. - if (coefficient != 0) + if (coefficient != nullptr) { if (coefficient->n_components == 1) { diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index c7a5052a2b..d7b41f505f 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -531,7 +531,7 @@ void PointValueHistory ::clear () { cleared = true; - dof_handler = 0; + dof_handler = nullptr; have_dof_handler = false; } diff --git a/source/numerics/solution_transfer.cc b/source/numerics/solution_transfer.cc index a07d3df637..7c27ab681b 100644 --- a/source/numerics/solution_transfer.cc +++ b/source/numerics/solution_transfer.cc @@ -46,7 +46,7 @@ SolutionTransfer(const DoFHandlerType &dof) { Assert ((dynamic_cast*> (&dof_handler->get_tria()) - == 0), + == nullptr), ExcMessage ("You are calling the dealii::SolutionTransfer class " "with a DoF handler that is built on a " "parallel::distributed::Triangulation. This will not " @@ -451,7 +451,7 @@ interpolate (const std::vector &all_in, // cell stayed as it was or was refined if (indexptr) { - Assert (valuesptr == 0, + Assert (valuesptr == nullptr, ExcInternalError()); const unsigned int old_fe_index = @@ -478,7 +478,7 @@ interpolate (const std::vector &all_in, // deleted { Assert (!cell->has_children(), ExcInternalError()); - Assert (indexptr == 0, + Assert (indexptr == nullptr, ExcInternalError()); const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; @@ -502,7 +502,7 @@ interpolate (const std::vector &all_in, // test we would have to // store the fe_index of all // cells - const Vector *data = 0; + const Vector *data = nullptr; const unsigned int active_fe_index = cell->active_fe_index(); if (active_fe_index != pointerstruct->second.active_fe_index) { diff --git a/source/numerics/time_dependent.cc b/source/numerics/time_dependent.cc index 1cf56e6b0c..7438686ebe 100644 --- a/source/numerics/time_dependent.cc +++ b/source/numerics/time_dependent.cc @@ -65,34 +65,34 @@ TimeDependent::insert_timestep (const TimeStepBase *position, TimeStepBase *new_timestep) { Assert ((std::find(timesteps.begin(), timesteps.end(), position) != timesteps.end()) || - (position == 0), + (position == nullptr), ExcInvalidPosition()); // first insert the new time step // into the doubly linked list // of timesteps - if (position == 0) + if (position == nullptr) { // at the end - new_timestep->set_next_timestep (0); + new_timestep->set_next_timestep (nullptr); if (timesteps.size() > 0) { timesteps.back()->set_next_timestep (new_timestep); new_timestep->set_previous_timestep (timesteps.back()); } else - new_timestep->set_previous_timestep (0); + new_timestep->set_previous_timestep (nullptr); } else if (position == timesteps[0]) { // at the beginning - new_timestep->set_previous_timestep (0); + new_timestep->set_previous_timestep (nullptr); if (timesteps.size() > 0) { timesteps[0]->set_previous_timestep (new_timestep); new_timestep->set_next_timestep (timesteps[0]); } else - new_timestep->set_next_timestep (0); + new_timestep->set_next_timestep (nullptr); } else { @@ -108,7 +108,7 @@ TimeDependent::insert_timestep (const TimeStepBase *position, // finally enter it into the // array - timesteps.insert ((position == 0 ? + timesteps.insert ((position == nullptr ? timesteps.end() : std::find(timesteps.begin(), timesteps.end(), position)), new_timestep); @@ -118,7 +118,7 @@ TimeDependent::insert_timestep (const TimeStepBase *position, void TimeDependent::add_timestep (TimeStepBase *new_timestep) { - insert_timestep (0, new_timestep); + insert_timestep (nullptr, new_timestep); } @@ -131,7 +131,7 @@ void TimeDependent::delete_timestep (const unsigned int position) // later deletion and unlock // SmartPointer TimeStepBase *t = timesteps[position]; - timesteps[position] = 0; + timesteps[position] = nullptr; // Now delete unsubscribed object delete t; @@ -250,8 +250,8 @@ TimeDependent::memory_consumption () const TimeStepBase::TimeStepBase (const double time) : - previous_timestep(0), - next_timestep (0), + previous_timestep(nullptr), + next_timestep (nullptr), sweep_no (numbers::invalid_unsigned_int), timestep_no (numbers::invalid_unsigned_int), time (time), @@ -348,7 +348,7 @@ TimeStepBase::get_timestep_no () const double TimeStepBase::get_backward_timestep () const { - Assert (previous_timestep != 0, + Assert (previous_timestep != nullptr, ExcMessage("The backward time step cannot be computed because " "there is no previous time step.")); return time - previous_timestep->time; @@ -359,7 +359,7 @@ TimeStepBase::get_backward_timestep () const double TimeStepBase::get_forward_timestep () const { - Assert (next_timestep != 0, + Assert (next_timestep != nullptr, ExcMessage("The forward time step cannot be computed because " "there is no next time step.")); return next_timestep->time - time; @@ -411,8 +411,8 @@ TimeStepBase::memory_consumption () const template TimeStepBase_Tria::TimeStepBase_Tria() : TimeStepBase (0), - tria (0, typeid(*this).name()), - coarse_grid (0, typeid(*this).name()), + tria (nullptr, typeid(*this).name()), + coarse_grid (nullptr, typeid(*this).name()), flags (), refinement_flags(0) { @@ -427,7 +427,7 @@ TimeStepBase_Tria::TimeStepBase_Tria (const double time, const Flags &flags, const RefinementFlags &refinement_flags) : TimeStepBase (time), - tria(0, typeid(*this).name()), + tria(nullptr, typeid(*this).name()), coarse_grid (&coarse_grid, typeid(*this).name()), flags (flags), refinement_flags (refinement_flags) @@ -441,13 +441,13 @@ TimeStepBase_Tria::~TimeStepBase_Tria () if (!flags.delete_and_rebuild_tria) { Triangulation *t = tria; - tria = 0; + tria = nullptr; delete t; } else - Assert (tria==0, ExcInternalError()); + Assert (tria==nullptr, ExcInternalError()); - coarse_grid = 0; + coarse_grid = nullptr; } @@ -471,12 +471,12 @@ TimeStepBase_Tria::sleep (const unsigned int sleep_level) { if (sleep_level == flags.sleep_level_to_delete_grid) { - Assert (tria!=0, ExcInternalError()); + Assert (tria!=nullptr, ExcInternalError()); if (flags.delete_and_rebuild_tria) { Triangulation *t = tria; - tria = 0; + tria = nullptr; delete t; } } @@ -502,7 +502,7 @@ void TimeStepBase_Tria::save_refine_flags () template void TimeStepBase_Tria::restore_grid () { - Assert (tria == 0, ExcGridNotDeleted()); + Assert (tria == nullptr, ExcGridNotDeleted()); Assert (refine_flags.size() == coarsen_flags.size(), ExcInternalError()); @@ -741,8 +741,8 @@ void TimeStepBase_Tria::refine_grid (const RefinementData refinement_data) // two pointers into this array denoting // the position where the two thresholds // are assumed - Vector::const_iterator p_refinement_threshold=0, - p_coarsening_threshold=0; + Vector::const_iterator p_refinement_threshold=nullptr, + p_coarsening_threshold=nullptr; // if we are to do some cell number diff --git a/tests/algorithms/any_data_01.cc b/tests/algorithms/any_data_01.cc index aa4fab80af..1c73bce3cb 100644 --- a/tests/algorithms/any_data_01.cc +++ b/tests/algorithms/any_data_01.cc @@ -64,12 +64,12 @@ void extract(const AnyData &data) deallog << *data.try_read(" d 17.") << std::endl; - if (data.try_read(" d 17.") == 0) + if (data.try_read(" d 17.") == nullptr) deallog << "(nil)" << std::endl; else AssertThrow (false, ExcInternalError()); - if (data.try_read("does not exist") == 0) + if (data.try_read("does not exist") == nullptr) deallog << "(nil)" << std::endl; else AssertThrow (false, ExcInternalError()); diff --git a/tests/algorithms/newton_02.cc b/tests/algorithms/newton_02.cc index 140fd3325b..673063a411 100644 --- a/tests/algorithms/newton_02.cc +++ b/tests/algorithms/newton_02.cc @@ -40,7 +40,7 @@ public: for (unsigned int i=0; i(i); - if (p!=0) + if (p!=nullptr) { // this should be equal to dof->n_dofs() otherwise // DoFOutputOperator will complain diff --git a/tests/aniso/up_and_down.cc b/tests/aniso/up_and_down.cc index cf0639d626..762d8db0db 100644 --- a/tests/aniso/up_and_down.cc +++ b/tests/aniso/up_and_down.cc @@ -155,8 +155,8 @@ void test () new FE_DGQ(0), new FE_DGQ(1), new FE_DGQ(2), - (dim<3 ? new FE_DGQ(3) : 0), - (dim<3 ? new FE_DGQ(4) : 0), + (dim<3 ? new FE_DGQ(3) : nullptr), + (dim<3 ? new FE_DGQ(4) : nullptr), // FE_DGP new FE_DGP(0), @@ -225,7 +225,7 @@ void test () for (unsigned int i=0; i a (&v[4], 0); ArrayView b = a; - ArrayView c (NULL, 0); + ArrayView c (nullptr, 0); ArrayView d = a; deallog << "OK" << std::endl; diff --git a/tests/base/memory_consumption_02.cc b/tests/base/memory_consumption_02.cc index 5bc44585ec..be0ae3e6f1 100644 --- a/tests/base/memory_consumption_02.cc +++ b/tests/base/memory_consumption_02.cc @@ -32,6 +32,24 @@ struct EqualityWithSizeofTest } }; + +template +struct EqualityWithSizeofTest +{ + EqualityWithSizeofTest() + { + T *t = nullptr; + deallog << (sizeof(t) == dealii::MemoryConsumption::memory_consumption(t)) + << std::endl; + + std::vector vector_test(42); + deallog << ((sizeof(std::vector) + vector_test.capacity()*sizeof(T *)) + == dealii::MemoryConsumption::memory_consumption(vector_test)) + << std::endl; + } +}; + + int main() { std::ofstream logfile("output"); diff --git a/tests/base/patterns_01.cc b/tests/base/patterns_01.cc index 4e0a0b0003..c1575847bb 100644 --- a/tests/base/patterns_01.cc +++ b/tests/base/patterns_01.cc @@ -37,7 +37,7 @@ int main() // started out with Patterns::Integer *pattern2 = Patterns::Integer::create (desc); - AssertThrow (pattern2 != 0, ExcInternalError()); + AssertThrow (pattern2 != nullptr, ExcInternalError()); AssertThrow (desc == pattern2->description(), ExcInternalError()); deallog << desc << std::endl; diff --git a/tests/bits/error_estimator_01.cc b/tests/bits/error_estimator_01.cc index 7f4e06b64d..7eb924d6db 100644 --- a/tests/bits/error_estimator_01.cc +++ b/tests/bits/error_estimator_01.cc @@ -71,7 +71,7 @@ get_q_face (Function &) Quadrature<0> & get_q_face (Function<1> &) { - Quadrature<0> *q = 0; + Quadrature<0> *q = nullptr; return *q; } @@ -169,7 +169,7 @@ check () Vector this_error (tria.n_active_cells()); KellyErrorEstimator::estimate (mapping, dof, q_face, neumann_bc, v, this_error, - std::vector(), 0, + std::vector(), nullptr, MultithreadInfo::n_threads(), subdomain); this_error *= scaling_factor; diff --git a/tests/bits/error_estimator_02.cc b/tests/bits/error_estimator_02.cc index 13095bb33d..56aa933862 100644 --- a/tests/bits/error_estimator_02.cc +++ b/tests/bits/error_estimator_02.cc @@ -71,7 +71,7 @@ get_q_face (Function &) Quadrature<0> & get_q_face (Function<1> &) { - Quadrature<0> *q = 0; + Quadrature<0> *q = nullptr; return *q; } @@ -169,7 +169,7 @@ check () Vector this_error (tria.n_active_cells()); KellyErrorEstimator::estimate (mapping, dof, q_face, neumann_bc, v, this_error, - std::vector(), 0, + std::vector(), nullptr, MultithreadInfo::n_threads(), numbers::invalid_unsigned_int, material); diff --git a/tests/bits/step-13.cc b/tests/bits/step-13.cc index b418b8be3d..b00e098f26 100644 --- a/tests/bits/step-13.cc +++ b/tests/bits/step-13.cc @@ -762,7 +762,7 @@ void solve_problem (const std::string &solver_name) const RightHandSide rhs_function; const Solution boundary_values; - LaplaceSolver::Base *solver = 0; + LaplaceSolver::Base *solver = nullptr; if (solver_name == "global") solver = new LaplaceSolver::RefinementGlobal (triangulation, fe, quadrature, diff --git a/tests/bits/step-14.cc b/tests/bits/step-14.cc index ba43cc5637..cf90862b73 100644 --- a/tests/bits/step-14.cc +++ b/tests/bits/step-14.cc @@ -2019,7 +2019,7 @@ void Framework::run (const ProblemDescription &descriptor) const QGauss quadrature(descriptor.dual_fe_degree+1); const QGauss face_quadrature(descriptor.dual_fe_degree+1); - LaplaceSolver::Base *solver = 0; + LaplaceSolver::Base *solver = nullptr; switch (descriptor.refinement_criterion) { case ProblemDescription::dual_weighted_error_estimator: @@ -2106,7 +2106,7 @@ void Framework::run (const ProblemDescription &descriptor) deallog << std::endl; delete solver; - solver = 0; + solver = nullptr; } diff --git a/tests/codim_one/bem_integration.cc b/tests/codim_one/bem_integration.cc index 7c91cea272..2d12f59c62 100644 --- a/tests/codim_one/bem_integration.cc +++ b/tests/codim_one/bem_integration.cc @@ -108,7 +108,7 @@ template LaplaceKernelIntegration::~LaplaceKernelIntegration() { FEValues *fp = fe_values; - fe_values = 0; + fe_values = nullptr; delete fp; } diff --git a/tests/codim_one/error_estimator_01.cc b/tests/codim_one/error_estimator_01.cc index 59a59faf05..aef5dc3313 100644 --- a/tests/codim_one/error_estimator_01.cc +++ b/tests/codim_one/error_estimator_01.cc @@ -71,7 +71,7 @@ template<> Quadrature<0> & get_q_face <1>() { - Quadrature<0> *q = 0; + Quadrature<0> *q = nullptr; return *q; } @@ -167,7 +167,7 @@ check () Vector this_error (tria.n_active_cells()); KellyErrorEstimator::estimate (mapping, dof, q_face, neumann_bc, v, this_error, - std::vector(), 0, + std::vector(), nullptr, MultithreadInfo::n_threads(), subdomain); this_error *= scaling_factor; diff --git a/tests/codim_one/error_estimator_02.cc b/tests/codim_one/error_estimator_02.cc index 3e5956b818..c08315fbdb 100644 --- a/tests/codim_one/error_estimator_02.cc +++ b/tests/codim_one/error_estimator_02.cc @@ -101,7 +101,7 @@ template<> Quadrature<0> & get_q_face <1>() { - Quadrature<0> *q = 0; + Quadrature<0> *q = nullptr; return *q; } diff --git a/tests/dofs/dof_renumbering_02.cc b/tests/dofs/dof_renumbering_02.cc index 8fa2008be5..e7c7652494 100644 --- a/tests/dofs/dof_renumbering_02.cc +++ b/tests/dofs/dof_renumbering_02.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; @@ -88,12 +88,12 @@ print_dofs (const DoFHandler &dof, unsigned int level) cell != dof.end(level); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_mg_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_03.cc b/tests/dofs/dof_renumbering_03.cc index 225fd4e5ca..6ac9ef7cce 100644 --- a/tests/dofs/dof_renumbering_03.cc +++ b/tests/dofs/dof_renumbering_03.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_04.cc b/tests/dofs/dof_renumbering_04.cc index 51c71c20a2..a1e70392e8 100644 --- a/tests/dofs/dof_renumbering_04.cc +++ b/tests/dofs/dof_renumbering_04.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_05.cc b/tests/dofs/dof_renumbering_05.cc index 447272021d..7568b311fe 100644 --- a/tests/dofs/dof_renumbering_05.cc +++ b/tests/dofs/dof_renumbering_05.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_06.cc b/tests/dofs/dof_renumbering_06.cc index d555e1562f..f0018d1b57 100644 --- a/tests/dofs/dof_renumbering_06.cc +++ b/tests/dofs/dof_renumbering_06.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_07.cc b/tests/dofs/dof_renumbering_07.cc index 971ecf33ab..7eaeb3c7a2 100644 --- a/tests/dofs/dof_renumbering_07.cc +++ b/tests/dofs/dof_renumbering_07.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_08.cc b/tests/dofs/dof_renumbering_08.cc index d475801fc9..a17ac03151 100644 --- a/tests/dofs/dof_renumbering_08.cc +++ b/tests/dofs/dof_renumbering_08.cc @@ -55,12 +55,12 @@ print_dofs (const DoFHandler &dof) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else deallog << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_zorder_01.cc b/tests/dofs/dof_renumbering_zorder_01.cc index a0028d7e43..242e30f0d8 100644 --- a/tests/dofs/dof_renumbering_zorder_01.cc +++ b/tests/dofs/dof_renumbering_zorder_01.cc @@ -54,12 +54,12 @@ print_dofs (const DoFHandler &dof, stream &out) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else out << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_renumbering_zorder_02.cc b/tests/dofs/dof_renumbering_zorder_02.cc index af9ce0c490..ca2e43c15f 100644 --- a/tests/dofs/dof_renumbering_zorder_02.cc +++ b/tests/dofs/dof_renumbering_zorder_02.cc @@ -57,12 +57,12 @@ print_dofs (const DoFHandler &dof, stream &out) cell != dof.end(); ++cell) { Point p = cell->center(); - if (fevalues.get() != 0) + if (fevalues.get() != nullptr) fevalues->reinit(cell); cell->get_dof_indices (v); for (unsigned int i=0; iquadrature_point(i) << '\t' << v[i] << std::endl; else out << p << '\t' << v[i] << std::endl; diff --git a/tests/dofs/dof_test.cc b/tests/dofs/dof_test.cc index d7e696e8b4..86544fda1b 100644 --- a/tests/dofs/dof_test.cc +++ b/tests/dofs/dof_test.cc @@ -197,7 +197,7 @@ private: template TestCases::TestCases () : - tria(0), dof(0) {} + tria(nullptr), dof(nullptr) {} @@ -213,8 +213,8 @@ TestCases::~TestCases () template void TestCases::create_new () { - if (dof != 0) delete dof; - if (tria != 0) delete tria; + if (dof != nullptr) delete dof; + if (tria != nullptr) delete tria; tria = new Triangulation(); GridGenerator::hyper_cube(*tria); diff --git a/tests/dofs/dof_tools_14.cc b/tests/dofs/dof_tools_14.cc index 1c2204864b..784e3f3539 100644 --- a/tests/dofs/dof_tools_14.cc +++ b/tests/dofs/dof_tools_14.cc @@ -34,7 +34,7 @@ check_this (const DoFHandler &dof_handler) // with FunctionMap typename FunctionMap::type fm; - fm[0] = 0; + fm[0] = nullptr; deallog << dof_handler.n_boundary_dofs(fm) << std::endl; // with std::set diff --git a/tests/dofs/dof_tools_16a.cc b/tests/dofs/dof_tools_16a.cc index ef60eca95d..ac73898bf7 100644 --- a/tests/dofs/dof_tools_16a.cc +++ b/tests/dofs/dof_tools_16a.cc @@ -44,7 +44,7 @@ check_this (const DoFHandler &dof_handler) // create sparsity pattern typename FunctionMap::type boundary_ids; - boundary_ids[0] = 0; + boundary_ids[0] = nullptr; SparsityPattern sp (dof_handler.n_boundary_dofs(boundary_ids), dof_handler.max_couplings_between_dofs()); DoFTools::make_boundary_sparsity_pattern (dof_handler, boundary_ids, diff --git a/tests/dofs/dof_tools_16b.cc b/tests/dofs/dof_tools_16b.cc index e737b2ba4d..84b8019074 100644 --- a/tests/dofs/dof_tools_16b.cc +++ b/tests/dofs/dof_tools_16b.cc @@ -43,7 +43,7 @@ check_this (const DoFHandler &dof_handler) // create sparsity pattern typename FunctionMap::type boundary_ids; - boundary_ids[0] = 0; + boundary_ids[0] = nullptr; DynamicSparsityPattern sp (dof_handler.n_boundary_dofs(boundary_ids)); DoFTools::make_boundary_sparsity_pattern (dof_handler, boundary_ids, map, sp); diff --git a/tests/dofs/dof_tools_16c.cc b/tests/dofs/dof_tools_16c.cc index 2c53c6db42..ec4aff5e15 100644 --- a/tests/dofs/dof_tools_16c.cc +++ b/tests/dofs/dof_tools_16c.cc @@ -42,7 +42,7 @@ check_this (const DoFHandler &dof_handler) DoFTools::map_dof_to_boundary_indices (dof_handler, set, map); typename FunctionMap::type boundary_ids; - boundary_ids[0] = 0; + boundary_ids[0] = nullptr; const unsigned int n_boundary_dofs = dof_handler.n_boundary_dofs(boundary_ids); const unsigned int n_blocks = std::min (dof_handler.get_fe().n_components(), n_boundary_dofs); diff --git a/tests/dofs/dof_tools_16d.cc b/tests/dofs/dof_tools_16d.cc index ae5ae7f6c9..05af7c50a6 100644 --- a/tests/dofs/dof_tools_16d.cc +++ b/tests/dofs/dof_tools_16d.cc @@ -42,7 +42,7 @@ check_this (const DoFHandler &dof_handler) DoFTools::map_dof_to_boundary_indices (dof_handler, set, map); typename FunctionMap::type boundary_ids; - boundary_ids[0] = 0; + boundary_ids[0] = nullptr; const types::global_dof_index n_boundary_dofs = dof_handler.n_boundary_dofs(boundary_ids); const unsigned int n_blocks = std::min ( static_cast(dof_handler.get_fe().n_components()), diff --git a/tests/fail/hp-step-14.cc b/tests/fail/hp-step-14.cc index 9fc47113e8..fa08031a9b 100644 --- a/tests/fail/hp-step-14.cc +++ b/tests/fail/hp-step-14.cc @@ -2013,7 +2013,7 @@ void Framework::run (const ProblemDescription &descriptor) const hp::QCollection quadrature(QGauss(descriptor.dual_fe_degree+1)); const hp::QCollection face_quadrature(QGauss(descriptor.dual_fe_degree+1)); - LaplaceSolver::Base *solver = 0; + LaplaceSolver::Base *solver = nullptr; switch (descriptor.refinement_criterion) { case ProblemDescription::dual_weighted_error_estimator: @@ -2100,7 +2100,7 @@ void Framework::run (const ProblemDescription &descriptor) deallog << std::endl; delete solver; - solver = 0; + solver = nullptr; } diff --git a/tests/fail/rt_6.cc b/tests/fail/rt_6.cc index 98db065885..950ec236a0 100644 --- a/tests/fail/rt_6.cc +++ b/tests/fail/rt_6.cc @@ -150,7 +150,7 @@ void test () }; for (unsigned int i=0; i &mapping, SparseMatrix &matrix, const Function &rhs_function, Vector &rhs_vector, - const Function *const coefficient = 0) + const Function *const coefficient = nullptr) { UpdateFlags update_flags = UpdateFlags(update_values | update_JxW_values | update_quadrature_points); - if (coefficient != 0) + if (coefficient != nullptr) update_flags = UpdateFlags (update_flags | update_quadrature_points); FEValues fe_values (mapping, dof.get_fe(), q, update_flags); @@ -156,7 +156,7 @@ void create_mass_matrix (const Mapping &mapping, const FiniteElement &fe = fe_values.get_fe(); const unsigned int n_components = fe.n_components(); - Assert(coefficient == 0 || + Assert(coefficient == nullptr || coefficient->n_components==1 || coefficient->n_components==n_components, ExcInternalError()); @@ -183,7 +183,7 @@ void create_mass_matrix (const Mapping &mapping, rhs_function.vector_value_list (fe_values.get_quadrature_points(), rhs_values); cell_vector = 0; - if (coefficient != 0) + if (coefficient != nullptr) { if (coefficient->n_components==1) { diff --git a/tests/fe/abf_02.cc b/tests/fe/abf_02.cc index 5975264ca0..6dcb858306 100644 --- a/tests/fe/abf_02.cc +++ b/tests/fe/abf_02.cc @@ -154,10 +154,10 @@ void create_mass_matrix (const Mapping &mapping, SparseMatrix &matrix, const Function &rhs_function, Vector &rhs_vector, - const Function *const coefficient = 0) + const Function *const coefficient = nullptr) { UpdateFlags update_flags = UpdateFlags(update_values | update_JxW_values | update_quadrature_points); - if (coefficient != 0) + if (coefficient != nullptr) update_flags = UpdateFlags (update_flags | update_quadrature_points); FEValues fe_values (mapping, dof.get_fe(), q, update_flags); @@ -167,7 +167,7 @@ void create_mass_matrix (const Mapping &mapping, const FiniteElement &fe = fe_values.get_fe(); const unsigned int n_components = fe.n_components(); - Assert(coefficient == 0 || + Assert(coefficient == nullptr || coefficient->n_components==1 || coefficient->n_components==n_components, ExcInternalError()); @@ -194,7 +194,7 @@ void create_mass_matrix (const Mapping &mapping, rhs_function.vector_value_list (fe_values.get_quadrature_points(), rhs_values); cell_vector = 0; - if (coefficient != 0) + if (coefficient != nullptr) { if (coefficient->n_components==1) { diff --git a/tests/fe/deformed_projection.h b/tests/fe/deformed_projection.h index aa3e3ba20e..674a6d2851 100644 --- a/tests/fe/deformed_projection.h +++ b/tests/fe/deformed_projection.h @@ -193,10 +193,10 @@ void create_mass_matrix (const Mapping &mapping, SparseMatrix &matrix, const Function &rhs_function, Vector &rhs_vector, - const Function *const coefficient = 0) + const Function *const coefficient = nullptr) { UpdateFlags update_flags = UpdateFlags(update_values | update_JxW_values | update_quadrature_points); - if (coefficient != 0) + if (coefficient != nullptr) update_flags = UpdateFlags (update_flags | update_quadrature_points); FEValues fe_values (mapping, dof.get_fe(), q, update_flags); @@ -206,7 +206,7 @@ void create_mass_matrix (const Mapping &mapping, const FiniteElement &fe = fe_values.get_fe(); const unsigned int n_components = fe.n_components(); - Assert(coefficient == 0 || + Assert(coefficient == nullptr || coefficient->n_components==1 || coefficient->n_components==n_components, ExcInternalError()); @@ -233,7 +233,7 @@ void create_mass_matrix (const Mapping &mapping, rhs_function.vector_value_list (fe_values.get_quadrature_points(), rhs_values); cell_vector = 0; - if (coefficient != 0) + if (coefficient != nullptr) { if (coefficient->n_components==1) { diff --git a/tests/fe/up_and_down.cc b/tests/fe/up_and_down.cc index 61dc05487f..7146106fa0 100644 --- a/tests/fe/up_and_down.cc +++ b/tests/fe/up_and_down.cc @@ -154,15 +154,15 @@ void test () new FE_Q(1), new FE_Q(2), new FE_Q(3), - (dim<2 ? new FE_Q(4) : 0), - (dim<2 ? new FE_Q(5) : 0), + (dim<2 ? new FE_Q(4) : nullptr), + (dim<2 ? new FE_Q(5) : nullptr), // FE_DGQ new FE_DGQ(0), new FE_DGQ(1), new FE_DGQ(2), - (dim<3 ? new FE_DGQ(3) : 0), - (dim<3 ? new FE_DGQ(4) : 0), + (dim<3 ? new FE_DGQ(3) : nullptr), + (dim<3 ? new FE_DGQ(4) : nullptr), // FE_DGP does not // presently have the @@ -176,8 +176,8 @@ void test () // new FE_DGP(3), // a non-primitive FE - (dim != 1 ? new FE_Nedelec(0) : 0), - (dim != 1 ? new FE_Nedelec(1) : 0), + (dim != 1 ? new FE_Nedelec(0) : nullptr), + (dim != 1 ? new FE_Nedelec(1) : nullptr), // some composed elements // of increasing @@ -217,21 +217,21 @@ void test () // really difficult (dim != 1 ? new FESystem(FE_Nedelec(0), 2) - : 0), + : nullptr), (dim != 1 ? new FESystem(FE_Nedelec(0), 2, FE_Q (2), 2) - : 0), + : nullptr), (dim != 1 ? new FESystem(FE_Nedelec(0), 2, FE_DGQ (2), 2, FESystem(FE_Nedelec(0), 2, FE_Q (2), 2), 2) - : 0), + : nullptr), }; for (unsigned int i=0; i (new_points,tria, NULL, true); + GridTools::laplace_transform (new_points,tria, nullptr, true); std::ofstream out ("output"); GridOut grid_out; grid_out.write_eps (tria, out); diff --git a/tests/grid/grid_transform_3d.cc b/tests/grid/grid_transform_3d.cc index 46caa044dc..79598ada9d 100644 --- a/tests/grid/grid_transform_3d.cc +++ b/tests/grid/grid_transform_3d.cc @@ -87,7 +87,7 @@ int main () } } - GridTools::laplace_transform (new_points, tria, NULL, true); + GridTools::laplace_transform (new_points, tria, nullptr, true); GridOut grid_out; diff --git a/tests/grid/intergrid_constraints.cc b/tests/grid/intergrid_constraints.cc index 77c3ab1abe..fc142e3f96 100644 --- a/tests/grid/intergrid_constraints.cc +++ b/tests/grid/intergrid_constraints.cc @@ -74,7 +74,7 @@ void check () ? new FE_DGQ(2) : - 0); + nullptr); // define composed finite // elements. to limit memory @@ -231,7 +231,7 @@ void check () delete fe_1; delete fe_2; - if (fe_dq_quadratic != 0) + if (fe_dq_quadratic != nullptr) delete fe_dq_quadratic; } diff --git a/tests/hp/create_laplace_matrix_constraints_02.cc b/tests/hp/create_laplace_matrix_constraints_02.cc index cc481f7423..5896b654ad 100644 --- a/tests/hp/create_laplace_matrix_constraints_02.cc +++ b/tests/hp/create_laplace_matrix_constraints_02.cc @@ -121,7 +121,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (hp::MappingCollection(mapping), dof, hp::QCollection(quadrature), matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/hp/create_laplace_matrix_constraints_02b.cc b/tests/hp/create_laplace_matrix_constraints_02b.cc index afba9d44aa..9c5fad3617 100644 --- a/tests/hp/create_laplace_matrix_constraints_02b.cc +++ b/tests/hp/create_laplace_matrix_constraints_02b.cc @@ -116,7 +116,7 @@ check () hp::QCollection(quadrature), matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (hp::MappingCollection(mapping), dof, hp::QCollection(quadrature), matrix, dummy, constraints); diff --git a/tests/hp/create_mass_matrix_constraints_02.cc b/tests/hp/create_mass_matrix_constraints_02.cc index d8c57f16e0..b120228ad7 100644 --- a/tests/hp/create_mass_matrix_constraints_02.cc +++ b/tests/hp/create_mass_matrix_constraints_02.cc @@ -121,7 +121,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (hp::MappingCollection(mapping), dof, hp::QCollection(quadrature), matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/hp/create_mass_matrix_constraints_02b.cc b/tests/hp/create_mass_matrix_constraints_02b.cc index 422027c6a8..ccc1f7c925 100644 --- a/tests/hp/create_mass_matrix_constraints_02b.cc +++ b/tests/hp/create_mass_matrix_constraints_02b.cc @@ -116,7 +116,7 @@ check () hp::QCollection(quadrature), matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (hp::MappingCollection(mapping), dof, hp::QCollection(quadrature), matrix, dummy, constraints); diff --git a/tests/hp/step-13.cc b/tests/hp/step-13.cc index f7a7c7405f..06fcab2885 100644 --- a/tests/hp/step-13.cc +++ b/tests/hp/step-13.cc @@ -762,7 +762,7 @@ void solve_problem (const std::string &solver_name) const RightHandSide rhs_function; const Solution boundary_values; - LaplaceSolver::Base *solver = 0; + LaplaceSolver::Base *solver = nullptr; if (solver_name == "global") solver = new LaplaceSolver::RefinementGlobal (triangulation, fe, quadrature, diff --git a/tests/integrators/cochain_01.cc b/tests/integrators/cochain_01.cc index d73ea43b27..33ba29afb1 100644 --- a/tests/integrators/cochain_01.cc +++ b/tests/integrators/cochain_01.cc @@ -166,7 +166,7 @@ test_cochain(const Triangulation &tr, const FiniteElement &fe) MeshWorker::loop, MeshWorker::IntegrationInfoBox >( dof.begin_active(), dof.end(), dof_info, info_box, - cell_matrix, 0, 0, assembler); + cell_matrix, nullptr, nullptr, assembler); for (unsigned int b=0; b &dof_handler, SparseMatrix &matrix) dof_info, info_box, &MatrixIntegrator::cell, - 0, + nullptr, &MatrixIntegrator::face, assembler); } diff --git a/tests/lac/constraints.cc b/tests/lac/constraints.cc index c123a67bc0..3167def163 100644 --- a/tests/lac/constraints.cc +++ b/tests/lac/constraints.cc @@ -257,7 +257,7 @@ int main () deallog.attach(logfile); deallog.threshold_double(1.e-10); - FiniteElement<3> *fe = 0; + FiniteElement<3> *fe = nullptr; for (unsigned int element=0; element<2; ++element) { diff --git a/tests/mappings/mapping.cc b/tests/mappings/mapping.cc index 2dfd81417f..56a7d65ce7 100644 --- a/tests/mappings/mapping.cc +++ b/tests/mappings/mapping.cc @@ -537,11 +537,11 @@ void mapping_test() // delete all triangulations and // boundary objects for (unsigned int i=0; i &s) unsigned int tag = 1234; for (std::set::iterator it = s.begin(); it != s.end(); ++it) - MPI_Send(NULL, 0, MPI_INT, *it, tag, MPI_COMM_WORLD); + MPI_Send(nullptr, 0, MPI_INT, *it, tag, MPI_COMM_WORLD); for (unsigned int i=0; i &s) unsigned int tag = 1234; for (std::set::iterator it = s.begin(); it != s.end(); ++it) - MPI_Send(NULL, 0, MPI_INT, *it, tag, MPI_COMM_WORLD); + MPI_Send(nullptr, 0, MPI_INT, *it, tag, MPI_COMM_WORLD); for (unsigned int i=0; i::output_gpl(const DoFHandler &dof, dof.begin_mg(l), dof.end_mg(l), dof_info, info_box, std::bind(&OutputCreator::cell, &matrix_integrator, std::placeholders::_1, std::placeholders::_2), - 0, - 0, + nullptr, + nullptr, assembler); } } diff --git a/tests/multigrid/mg_renumbered_03.cc b/tests/multigrid/mg_renumbered_03.cc index 859aa4b1ea..b7495cfe57 100644 --- a/tests/multigrid/mg_renumbered_03.cc +++ b/tests/multigrid/mg_renumbered_03.cc @@ -314,8 +314,8 @@ LaplaceProblem::output_gpl(const DoFHandler &dof, dof.begin_mg(l), dof.end_mg(l), dof_info, info_box, std::bind(&OutputCreator::cell, &matrix_integrator, std::placeholders::_1, std::placeholders::_2), - 0, - 0, + nullptr, + nullptr, assembler); } } diff --git a/tests/numerics/boundaries.cc b/tests/numerics/boundaries.cc index d4bcc42a1b..c5be172d7b 100644 --- a/tests/numerics/boundaries.cc +++ b/tests/numerics/boundaries.cc @@ -72,7 +72,7 @@ boundary_q (const DoFHandler &) const Quadrature<0> & boundary_q (const DoFHandler<1> &) { - static const Quadrature<0> *q = 0; + static const Quadrature<0> *q = nullptr; return *q; } diff --git a/tests/numerics/create_laplace_matrix_constraints_01.cc b/tests/numerics/create_laplace_matrix_constraints_01.cc index f6bac3a8d6..7174673bc8 100644 --- a/tests/numerics/create_laplace_matrix_constraints_01.cc +++ b/tests/numerics/create_laplace_matrix_constraints_01.cc @@ -104,7 +104,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/numerics/create_laplace_matrix_constraints_02.cc b/tests/numerics/create_laplace_matrix_constraints_02.cc index f582e2ffb4..2faf7d23b7 100644 --- a/tests/numerics/create_laplace_matrix_constraints_02.cc +++ b/tests/numerics/create_laplace_matrix_constraints_02.cc @@ -108,7 +108,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/numerics/create_laplace_matrix_constraints_02b.cc b/tests/numerics/create_laplace_matrix_constraints_02b.cc index 273a3f6288..a2b2de1c93 100644 --- a/tests/numerics/create_laplace_matrix_constraints_02b.cc +++ b/tests/numerics/create_laplace_matrix_constraints_02b.cc @@ -104,7 +104,7 @@ check () quadrature, matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, dummy, constraints); diff --git a/tests/numerics/create_mass_matrix_constraints_01.cc b/tests/numerics/create_mass_matrix_constraints_01.cc index 134b3010c1..eb904bf6a6 100644 --- a/tests/numerics/create_mass_matrix_constraints_01.cc +++ b/tests/numerics/create_mass_matrix_constraints_01.cc @@ -104,7 +104,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/numerics/create_mass_matrix_constraints_02.cc b/tests/numerics/create_mass_matrix_constraints_02.cc index 5a22efa4c9..4063c20664 100644 --- a/tests/numerics/create_mass_matrix_constraints_02.cc +++ b/tests/numerics/create_mass_matrix_constraints_02.cc @@ -108,7 +108,7 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, rhs_function, rhs, dummy, constraints); diff --git a/tests/numerics/create_mass_matrix_constraints_02b.cc b/tests/numerics/create_mass_matrix_constraints_02b.cc index 71444a5f4b..b9985b73c6 100644 --- a/tests/numerics/create_mass_matrix_constraints_02b.cc +++ b/tests/numerics/create_mass_matrix_constraints_02b.cc @@ -104,7 +104,7 @@ check () quadrature, matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = 0; + const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, dummy, constraints); diff --git a/tests/numerics/error_estimator.cc b/tests/numerics/error_estimator.cc index 9b2fd792d4..f8f28a282d 100644 --- a/tests/numerics/error_estimator.cc +++ b/tests/numerics/error_estimator.cc @@ -71,7 +71,7 @@ get_q_face (Function &) Quadrature<0> & get_q_face (Function<1> &) { - Quadrature<0> *q = 0; + Quadrature<0> *q = nullptr; return *q; } diff --git a/tests/numerics/error_estimator_02.cc b/tests/numerics/error_estimator_02.cc index b5d54be577..6ec450ae4b 100644 --- a/tests/numerics/error_estimator_02.cc +++ b/tests/numerics/error_estimator_02.cc @@ -298,7 +298,7 @@ void test_neumann(const NeumanBC &func) values, error, dealii::ComponentMask(), - 0, + nullptr, dealii::numbers::invalid_unsigned_int, dealii::numbers::invalid_subdomain_id, dealii::numbers::invalid_material_id, @@ -410,7 +410,7 @@ void test_regular(const MyFunction &func) values, error, dealii::ComponentMask(), - 0, + nullptr, dealii::numbers::invalid_unsigned_int, dealii::numbers::invalid_subdomain_id, dealii::numbers::invalid_material_id, @@ -537,7 +537,7 @@ void test_irregular(const MyFunction &func) values, error, dealii::ComponentMask(), - 0, + nullptr, dealii::numbers::invalid_unsigned_int, dealii::numbers::invalid_subdomain_id, dealii::numbers::invalid_material_id, @@ -704,7 +704,7 @@ void test(const MySecondFunction &func) values, error, dealii::ComponentMask(), - 0, + nullptr, dealii::numbers::invalid_unsigned_int, dealii::numbers::invalid_subdomain_id, dealii::numbers::invalid_material_id, diff --git a/tests/numerics/project_boundary_01.cc b/tests/numerics/project_boundary_01.cc index fe4d34a70a..3d389f6e0c 100644 --- a/tests/numerics/project_boundary_01.cc +++ b/tests/numerics/project_boundary_01.cc @@ -83,7 +83,7 @@ boundary_q (const DoFHandler &) const Quadrature<0> & boundary_q (const DoFHandler<1> &) { - static const Quadrature<0> *q = 0; + static const Quadrature<0> *q = nullptr; return *q; } diff --git a/tests/physics/step-18-rotation_matrix.cc b/tests/physics/step-18-rotation_matrix.cc index 27a58b0e90..b8d70f6dd8 100644 --- a/tests/physics/step-18-rotation_matrix.cc +++ b/tests/physics/step-18-rotation_matrix.cc @@ -660,7 +660,7 @@ namespace Step18 incremental_displacement, error_per_cell, ComponentMask(), - 0, + nullptr, MultithreadInfo::n_threads(), this_mpi_process); const unsigned int n_local_cells = triangulation.n_locally_owned_active_cells (); diff --git a/tests/physics/step-18.cc b/tests/physics/step-18.cc index 8f24216ae4..75fbf0c3c1 100644 --- a/tests/physics/step-18.cc +++ b/tests/physics/step-18.cc @@ -687,7 +687,7 @@ namespace Step18 incremental_displacement, error_per_cell, ComponentMask(), - 0, + nullptr, MultithreadInfo::n_threads(), this_mpi_process); const unsigned int n_local_cells = triangulation.n_locally_owned_active_cells (); diff --git a/tests/quick_tests/affinity.cc b/tests/quick_tests/affinity.cc index 35dd8db3e9..bb2fbb37af 100644 --- a/tests/quick_tests/affinity.cc +++ b/tests/quick_tests/affinity.cc @@ -60,7 +60,7 @@ bool getaffinity(unsigned int &bits_set,unsigned int &mask) int get_num_thread_env() { const char *penv = getenv ("DEAL_II_NUM_THREADS"); - if (penv!=NULL) + if (penv!=nullptr) { int max_threads_env = -1; try diff --git a/tests/serialization/pointer_01.cc b/tests/serialization/pointer_01.cc index 74ae826d29..81abf94ff7 100644 --- a/tests/serialization/pointer_01.cc +++ b/tests/serialization/pointer_01.cc @@ -71,7 +71,7 @@ void test () // p2 should have been created, and should // have been different from the address of // p1 - AssertThrow (p2 != 0, ExcInternalError()); + AssertThrow (p2 != nullptr, ExcInternalError()); AssertThrow (p1 != p2, ExcInternalError()); delete p1; diff --git a/tests/serialization/pointer_05.cc b/tests/serialization/pointer_05.cc index 1c189e94ac..ecce228c4c 100644 --- a/tests/serialization/pointer_05.cc +++ b/tests/serialization/pointer_05.cc @@ -100,8 +100,8 @@ void test () pair_1.first.c = c; pair_1.second.c = c; - pair_2.first.c = 0; - pair_2.second.c = 0; + pair_2.first.c = nullptr; + pair_2.second.c = nullptr; verify (pair_1, pair_2); diff --git a/tests/slepc/00.cc b/tests/slepc/00.cc index 4a8fe5e8a2..dfe266bc7c 100644 --- a/tests/slepc/00.cc +++ b/tests/slepc/00.cc @@ -36,7 +36,7 @@ int main (int argc,char **argv) logfile << "Initializing SLEPc (PETSc): " << std::flush; - SlepcInitialize (&argc, &argv, 0, 0); + SlepcInitialize (&argc, &argv, nullptr, nullptr); { logfile << "ok" << std::endl; diff --git a/tests/slepc_complex/00.cc b/tests/slepc_complex/00.cc index 3194456798..a6ea0b733a 100644 --- a/tests/slepc_complex/00.cc +++ b/tests/slepc_complex/00.cc @@ -39,7 +39,7 @@ int main (int argc, char **argv) logfile << "Initializing SLEPc (PETSc): " << std::flush; - SlepcInitialize (&argc, &argv, 0, 0); + SlepcInitialize (&argc, &argv, nullptr, nullptr); { logfile << "ok" << std::endl; diff --git a/tests/trilinos/mg_transfer_prebuilt_01.cc b/tests/trilinos/mg_transfer_prebuilt_01.cc index 45a152fc1b..47f631cc5e 100644 --- a/tests/trilinos/mg_transfer_prebuilt_01.cc +++ b/tests/trilinos/mg_transfer_prebuilt_01.cc @@ -46,7 +46,7 @@ reinit_vector (const dealii::DoFHandler &mg_dof, const dealii::parallel::distributed::Triangulation *tria = (dynamic_cast*> (&mg_dof.get_triangulation())); - AssertThrow(tria!=NULL, ExcMessage("multigrid with Trilinos vectors only works with distributed Triangulation!")); + AssertThrow(tria!=nullptr, ExcMessage("multigrid with Trilinos vectors only works with distributed Triangulation!")); for (unsigned int level=v.min_level(); level<=v.max_level(); ++level) diff --git a/tests/vector_tools/integrate_difference_02.cc b/tests/vector_tools/integrate_difference_02.cc index fbf2eddd7a..994292aaff 100644 --- a/tests/vector_tools/integrate_difference_02.cc +++ b/tests/vector_tools/integrate_difference_02.cc @@ -75,7 +75,7 @@ void test(VectorTools::NormType norm, double value, double exp = 2.0) Vector cellwise_errors (tria.n_active_cells()); QIterated quadrature (QTrapez<1>(), 5); - const dealii::Function *w = 0; + const dealii::Function *w = nullptr; VectorTools::integrate_difference (dofh, solution, ZeroFunction(dim), diff --git a/tests/vector_tools/integrate_difference_03.cc b/tests/vector_tools/integrate_difference_03.cc index 8fc47d8e78..6c74729f07 100644 --- a/tests/vector_tools/integrate_difference_03.cc +++ b/tests/vector_tools/integrate_difference_03.cc @@ -83,7 +83,7 @@ void test(VectorTools::NormType norm, double value, double exp = 2.0) Vector cellwise_errors (tria.n_active_cells()); QIterated quadrature (QTrapez<1>(), 5); - const dealii::Function *w = 0; + const dealii::Function *w = nullptr; VectorTools::integrate_difference (dofh, solution, ZeroFunction(dim), diff --git a/tests/vector_tools/integrate_difference_04.cc b/tests/vector_tools/integrate_difference_04.cc index 52f8e36b56..9ba8a56ef8 100644 --- a/tests/vector_tools/integrate_difference_04.cc +++ b/tests/vector_tools/integrate_difference_04.cc @@ -83,7 +83,7 @@ void test(VectorTools::NormType norm, double value, double exp = 2.0) Vector cellwise_errors (tria.n_active_cells()); QIterated quadrature (QTrapez<1>(), 5); - const dealii::Function *w = 0; + const dealii::Function *w = nullptr; VectorTools::integrate_difference (dofh, solution, ZeroFunction(dim), -- 2.39.5