From c5ad446e7c424a5fbd44b874eff12cbedca50b8e Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 13 Jan 2018 17:37:31 +0100 Subject: [PATCH] Use nullptr --- .../differentiation/ad/ad_number_traits.h | 2 +- include/deal.II/fe/fe_values.h | 58 +++++++++---------- source/base/parameter_acceptor.cc | 8 +-- source/lac/petsc_matrix_base.cc | 2 +- source/particles/particle.cc | 10 ++-- source/particles/particle_accessor.cc | 2 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index a1a98589cc..ec0b74a37a 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -621,7 +621,7 @@ namespace Differentiation value (const F &f, typename std::enable_if< !is_ad_number::value - >::type * = 0) + >::type * = nullptr) -> decltype (dealii::internal::NumberType::value(f)) { // We call the other function defined in the numbers diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index b9074bd405..df7bd6f8f7 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -4365,7 +4365,7 @@ FEValuesBase::shape_value (const unsigned int i, ExcAccessToUninitializedField("update_values")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: @@ -4402,7 +4402,7 @@ FEValuesBase::shape_value_component (const unsigned int i, ExcAccessToUninitializedField("update_values")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function @@ -4433,7 +4433,7 @@ FEValuesBase::shape_grad (const unsigned int i, ExcAccessToUninitializedField("update_gradients")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: @@ -4470,7 +4470,7 @@ FEValuesBase::shape_grad_component (const unsigned int i, ExcAccessToUninitializedField("update_gradients")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within @@ -4500,7 +4500,7 @@ FEValuesBase::shape_hessian (const unsigned int i, ExcAccessToUninitializedField("update_hessians")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: @@ -4537,7 +4537,7 @@ FEValuesBase::shape_hessian_component (const unsigned int i, ExcAccessToUninitializedField("update_hessians")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within @@ -4567,7 +4567,7 @@ FEValuesBase::shape_3rd_derivative (const unsigned int i, ExcAccessToUninitializedField("update_3rd_derivatives")); Assert (fe->is_primitive (i), ExcShapeFunctionNotPrimitive(i)); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // if the entire FE is primitive, // then we can take a short-cut: @@ -4604,7 +4604,7 @@ FEValuesBase::shape_3rd_derivative_component (const unsigned int i ExcAccessToUninitializedField("update_3rd_derivatives")); Assert (component < fe->n_components(), ExcIndexRange(component, 0, fe->n_components())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); // check whether the shape function // is non-zero at all within @@ -4658,7 +4658,7 @@ FEValuesBase::get_quadrature_points () const { Assert (this->update_flags & update_quadrature_points, ExcAccessToUninitializedField("update_quadrature_points")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.quadrature_points; } @@ -4672,7 +4672,7 @@ FEValuesBase::get_JxW_values () const { Assert (this->update_flags & update_JxW_values, ExcAccessToUninitializedField("update_JxW_values")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.JxW_values; } @@ -4686,7 +4686,7 @@ FEValuesBase::get_jacobians () const { Assert (this->update_flags & update_jacobians, ExcAccessToUninitializedField("update_jacobians")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobians; } @@ -4700,7 +4700,7 @@ FEValuesBase::get_jacobian_grads () const { Assert (this->update_flags & update_jacobian_grads, ExcAccessToUninitializedField("update_jacobians_grads")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_grads; } @@ -4714,7 +4714,7 @@ FEValuesBase::jacobian_pushed_forward_grad (const unsigned int i) { Assert (this->update_flags & update_jacobian_pushed_forward_grads, ExcAccessToUninitializedField("update_jacobian_pushed_forward_grads")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_grads[i]; } @@ -4728,7 +4728,7 @@ FEValuesBase::get_jacobian_pushed_forward_grads () const { Assert (this->update_flags & update_jacobian_pushed_forward_grads, ExcAccessToUninitializedField("update_jacobian_pushed_forward_grads")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_grads; } @@ -4742,7 +4742,7 @@ FEValuesBase::jacobian_2nd_derivative (const unsigned int i) const { Assert (this->update_flags & update_jacobian_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_2nd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_2nd_derivatives[i]; } @@ -4756,7 +4756,7 @@ FEValuesBase::get_jacobian_2nd_derivatives () const { Assert (this->update_flags & update_jacobian_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_2nd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_2nd_derivatives; } @@ -4770,7 +4770,7 @@ FEValuesBase::jacobian_pushed_forward_2nd_derivative (const unsign { Assert (this->update_flags & update_jacobian_pushed_forward_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_2nd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_2nd_derivatives[i]; } @@ -4784,7 +4784,7 @@ FEValuesBase::get_jacobian_pushed_forward_2nd_derivatives () const { Assert (this->update_flags & update_jacobian_pushed_forward_2nd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_2nd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_2nd_derivatives; } @@ -4798,7 +4798,7 @@ FEValuesBase::jacobian_3rd_derivative (const unsigned int i) const { Assert (this->update_flags & update_jacobian_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_3rd_derivatives[i]; } @@ -4812,7 +4812,7 @@ FEValuesBase::get_jacobian_3rd_derivatives () const { Assert (this->update_flags & update_jacobian_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_3rd_derivatives; } @@ -4826,7 +4826,7 @@ FEValuesBase::jacobian_pushed_forward_3rd_derivative (const unsign { Assert (this->update_flags & update_jacobian_pushed_forward_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_3rd_derivatives[i]; } @@ -4840,7 +4840,7 @@ FEValuesBase::get_jacobian_pushed_forward_3rd_derivatives () const { Assert (this->update_flags & update_jacobian_pushed_forward_3rd_derivatives, ExcAccessToUninitializedField("update_jacobian_pushed_forward_3rd_derivatives")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_pushed_forward_3rd_derivatives; } @@ -4853,7 +4853,7 @@ FEValuesBase::get_inverse_jacobians () const { Assert (this->update_flags & update_inverse_jacobians, ExcAccessToUninitializedField("update_inverse_jacobians")); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.inverse_jacobians; } @@ -4869,7 +4869,7 @@ FEValuesBase::quadrature_point (const unsigned int i) const ExcAccessToUninitializedField("update_quadrature_points")); Assert (imapping_output.quadrature_points.size(), ExcIndexRange(i, 0, this->mapping_output.quadrature_points.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.quadrature_points[i]; @@ -4887,7 +4887,7 @@ FEValuesBase::JxW (const unsigned int i) const ExcAccessToUninitializedField("update_JxW_values")); Assert (imapping_output.JxW_values.size(), ExcIndexRange(i, 0, this->mapping_output.JxW_values.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.JxW_values[i]; @@ -4904,7 +4904,7 @@ FEValuesBase::jacobian (const unsigned int i) const ExcAccessToUninitializedField("update_jacobians")); Assert (imapping_output.jacobians.size(), ExcIndexRange(i, 0, this->mapping_output.jacobians.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobians[i]; @@ -4921,7 +4921,7 @@ FEValuesBase::jacobian_grad (const unsigned int i) const ExcAccessToUninitializedField("update_jacobians_grads")); Assert (imapping_output.jacobian_grads.size(), ExcIndexRange(i, 0, this->mapping_output.jacobian_grads.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.jacobian_grads[i]; @@ -4938,7 +4938,7 @@ FEValuesBase::inverse_jacobian (const unsigned int i) const ExcAccessToUninitializedField("update_inverse_jacobians")); Assert (imapping_output.inverse_jacobians.size(), ExcIndexRange(i, 0, this->mapping_output.inverse_jacobians.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.inverse_jacobians[i]; @@ -4954,7 +4954,7 @@ FEValuesBase::normal_vector (const unsigned int i) const (typename FEValuesBase::ExcAccessToUninitializedField("update_normal_vectors"))); Assert (imapping_output.normal_vectors.size(), ExcIndexRange(i, 0, this->mapping_output.normal_vectors.size())); - Assert (present_cell.get() != 0, + Assert (present_cell.get() != nullptr, ExcMessage ("FEValues object is not reinit'ed to any cell")); return this->mapping_output.normal_vectors[i]; diff --git a/source/base/parameter_acceptor.cc b/source/base/parameter_acceptor.cc index e065144564..d717199e84 100644 --- a/source/base/parameter_acceptor.cc +++ b/source/base/parameter_acceptor.cc @@ -38,7 +38,7 @@ ParameterAcceptor::ParameterAcceptor(const std::string &name) : ParameterAcceptor::~ParameterAcceptor() { - class_list[acceptor_id] = 0; + class_list[acceptor_id] = nullptr; } std::string ParameterAcceptor::get_section_name() const @@ -154,7 +154,7 @@ void ParameterAcceptor::parse_parameters(ParameterHandler &) void ParameterAcceptor::parse_all_parameters(ParameterHandler &prm) { for (unsigned int i=0; i< class_list.size(); ++i) - if (class_list[i] != NULL) + if (class_list[i] != nullptr) { class_list[i]->enter_my_subsection(prm); class_list[i]->parse_parameters(prm); @@ -166,7 +166,7 @@ void ParameterAcceptor::parse_all_parameters(ParameterHandler &prm) void ParameterAcceptor::declare_all_parameters(ParameterHandler &prm) { for (unsigned int i=0; i< class_list.size(); ++i) - if (class_list[i] != NULL) + if (class_list[i] != nullptr) { class_list[i]->enter_my_subsection(prm); class_list[i]->declare_parameters(prm); @@ -198,7 +198,7 @@ ParameterAcceptor::get_section_path() const // trailing /, then the full path is used, else only the path except the // last one for (int i=acceptor_id-1; i>=0; --i) - if (class_list[i] != NULL) + if (class_list[i] != nullptr) { bool has_trailing = class_list[i]->get_section_name().back() == sep; auto previous_path = class_list[i]->get_section_path(); diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index cd1e821f99..f43df8ae55 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -544,7 +544,7 @@ namespace PETScWrappers ierr = MatTranspose(tmp, MAT_REUSE_MATRIX, &tmp); AssertThrow (ierr == 0, ExcPETScError(ierr)); } - ierr = MatDiagonalScale (tmp, NULL, V); + ierr = MatDiagonalScale (tmp, nullptr, V); AssertThrow (ierr == 0, ExcPETScError(ierr)); ierr = MatMatMult (tmp, inputright, diff --git a/source/particles/particle.cc b/source/particles/particle.cc index e06fe14bca..d1dbc5b643 100644 --- a/source/particles/particle.cc +++ b/source/particles/particle.cc @@ -25,7 +25,7 @@ namespace Particles location (), reference_location(), id (0), - property_pool(NULL), + property_pool(nullptr), properties(PropertyPool::invalid_handle) { } @@ -40,7 +40,7 @@ namespace Particles location (location), reference_location (reference_location), id (id), - property_pool(NULL), + property_pool(nullptr), properties (PropertyPool::invalid_handle) { } @@ -292,7 +292,7 @@ namespace Particles const ArrayView Particle::get_properties () const { - Assert(property_pool != NULL, + Assert(property_pool != nullptr, ExcInternalError()); return property_pool->get_properties(properties); @@ -304,7 +304,7 @@ namespace Particles const ArrayView Particle::get_properties () { - Assert(property_pool != NULL, + Assert(property_pool != nullptr, ExcInternalError()); return property_pool->get_properties(properties); @@ -316,7 +316,7 @@ namespace Particles bool Particle::has_properties () const { - return (property_pool != NULL) + return (property_pool != nullptr) && (properties != PropertyPool::invalid_handle); } } diff --git a/source/particles/particle_accessor.cc b/source/particles/particle_accessor.cc index f7f3eb62b6..115765269b 100644 --- a/source/particles/particle_accessor.cc +++ b/source/particles/particle_accessor.cc @@ -22,7 +22,7 @@ namespace Particles template ParticleAccessor::ParticleAccessor () : - map (NULL), + map (nullptr), particle () {} -- 2.39.5