From cef5142b28d687c5be9d49d608dda53fc4d630d8 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 2 Jul 2001 16:30:37 +0000 Subject: [PATCH] Fix many missing std:: which Compaq's cxx wants to have, mostly for two reasons: 1. because it does not inject the math functions sqrt, sin, cos, fabs, ... into global namespace when we write include. 2. because cxx can't do Koenig lookup of functions. git-svn-id: https://svn.dealii.org/trunk@4795 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/source/dofs/dof_constraints.cc | 14 +++--- deal.II/deal.II/source/dofs/dof_handler.cc | 2 +- .../deal.II/source/dofs/dof_renumbering.cc | 28 +++++------ deal.II/deal.II/source/fe/fe_values.cc | 8 ++-- deal.II/deal.II/source/fe/mapping_c1.cc | 24 +++++----- deal.II/deal.II/source/fe/mapping_q.cc | 6 +-- deal.II/deal.II/source/fe/mapping_q1.cc | 22 ++++----- deal.II/deal.II/source/grid/grid_generator.cc | 34 ++++++------- deal.II/deal.II/source/grid/grid_out.cc | 16 +++---- .../deal.II/source/grid/grid_refinement.cc | 4 +- .../deal.II/source/grid/grid_reordering.cc | 10 ++-- deal.II/deal.II/source/grid/tria.cc | 8 ++-- deal.II/deal.II/source/grid/tria_accessor.cc | 8 ++-- .../deal.II/source/grid/tria_boundary_lib.cc | 18 +++---- .../deal.II/source/multigrid/mg_smoother.cc | 6 +-- deal.II/deal.II/source/numerics/data_out.cc | 2 +- .../source/numerics/data_out_rotation.cc | 8 ++-- .../numerics/derivative_approximation.cc | 8 ++-- .../source/numerics/error_estimator.cc | 2 +- deal.II/deal.II/source/numerics/histogram.cc | 6 +-- deal.II/deal.II/source/numerics/matrices.cc | 6 +-- .../deal.II/source/numerics/time_dependent.cc | 6 +-- deal.II/deal.II/source/numerics/vectors.cc | 13 ++--- deal.II/lac/include/lac/block_vector.h | 5 -- .../lac/include/lac/block_vector.templates.h | 2 +- .../lac/include/lac/full_matrix.templates.h | 22 ++++----- deal.II/lac/include/lac/solver_cg.h | 2 +- .../lac/include/lac/sparse_ilu.templates.h | 2 +- .../include/lac/swappable_vector.templates.h | 2 +- deal.II/lac/include/lac/vector.h | 5 -- deal.II/lac/include/lac/vector.templates.h | 48 +++++++------------ .../lac/source/compressed_sparsity_pattern.cc | 4 +- deal.II/lac/source/sparsity_pattern.cc | 4 +- 33 files changed, 167 insertions(+), 188 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index 96884c75f5..dc827038d9 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -201,7 +201,7 @@ void ConstraintMatrix::close () }; // sort the lines - sort (lines.begin(), lines.end()); + std::sort (lines.begin(), lines.end()); #ifdef DEBUG // if in debug mode: check that no @@ -218,9 +218,9 @@ void ConstraintMatrix::close () ConstraintLine test_line; test_line.line = entry->first; const std::vector::const_iterator - test_line_position = lower_bound (lines.begin(), - lines.end(), - test_line); + test_line_position = std::lower_bound (lines.begin(), + lines.end(), + test_line); Assert ((test_line_position == lines.end()) || (test_line_position->line != entry->first), @@ -939,9 +939,9 @@ bool ConstraintMatrix::is_constrained (const unsigned int index) const ConstraintLine index_comparison; index_comparison.line = index; - return binary_search (lines.begin (), - lines.end (), - index_comparison); + return std::binary_search (lines.begin (), + lines.end (), + index_comparison); } else { diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index 222b8a10ea..04c6ddf248 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1558,7 +1558,7 @@ void DoFHandler<2>::renumber_dofs (const std::vector &new_numbers) if (true) { std::vector tmp(new_numbers); - sort (tmp.begin(), tmp.end()); + std::sort (tmp.begin(), tmp.end()); std::vector::const_iterator p = tmp.begin(); unsigned int i = 0; for (; p!=tmp.end(); ++p, ++i) diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index 0730d58b56..6dfeda85d0 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -169,11 +169,11 @@ void DoFRenumbering::Cuthill_McKee (DoFHandler &dof_handler next_round_dofs.push_back (sparsity.get_column_numbers()[j]); // sort dof numbers - sort (next_round_dofs.begin(), next_round_dofs.end()); + std::sort (next_round_dofs.begin(), next_round_dofs.end()); // delete multiple entries std::vector::iterator end_sorted; - end_sorted = unique (next_round_dofs.begin(), next_round_dofs.end()); + end_sorted = std::unique (next_round_dofs.begin(), next_round_dofs.end()); next_round_dofs.erase (end_sorted, next_round_dofs.end()); // eliminate dofs which are @@ -243,7 +243,7 @@ void DoFRenumbering::Cuthill_McKee (DoFHandler &dof_handler // In any case, if not all DoFs // have been reached, renumbering // will not be possible - if (find (new_number.begin(), new_number.end(), DoFHandler::invalid_dof_index) + if (std::find (new_number.begin(), new_number.end(), DoFHandler::invalid_dof_index) != new_number.end()) Assert (false, ExcRenumberingIncomplete()); @@ -352,7 +352,7 @@ void DoFRenumbering::Cuthill_McKee (MGDoFHandler &dof_handler next_round_dofs.push_back (sparsity.get_column_numbers()[j]); // sort dof numbers - sort (next_round_dofs.begin(), next_round_dofs.end()); + std::sort (next_round_dofs.begin(), next_round_dofs.end()); // delete multiple entries std::vector::iterator end_sorted; @@ -409,8 +409,8 @@ void DoFRenumbering::Cuthill_McKee (MGDoFHandler &dof_handler #ifdef DEBUG // test for all indices numbered - if (find (new_number.begin(), new_number.end(), - DoFHandler::invalid_dof_index) + if (std::find (new_number.begin(), new_number.end(), + DoFHandler::invalid_dof_index) != new_number.end()) Assert (false, ExcRenumberingIncomplete()); @@ -452,7 +452,7 @@ void DoFRenumbering::component_wise (DoFHandler &dof_handle Assert (component_order.size() == dof_handler.get_fe().n_components(), ExcInvalidComponentOrder()); for (unsigned int i=0; i &dof_handle // entries for (unsigned int component=0; component& dof, for(cell = cells.begin(); cell != cells.end(); ++cell) { (*cell)->get_dof_indices(cell_dofs); - sort(cell_dofs.begin(), cell_dofs.end()); + std::sort(cell_dofs.begin(), cell_dofs.end()); for (unsigned int i=0;i& dof, Assert ((*cell)->level() == (int) level, ExcInternalError()); (*cell)->get_mg_dof_indices(cell_dofs); - sort(cell_dofs.begin(), cell_dofs.end()); + std::sort(cell_dofs.begin(), cell_dofs.end()); for (unsigned int i=0;i &dof_handler) for (unsigned i=0; i::get_function_values (const InputVector &fe_fu present_cell->get_interpolated_dof_values(fe_function, dof_values); // initialize with zero - fill_n (values.begin(), n_quadrature_points, 0); + std::fill_n (values.begin(), n_quadrature_points, 0); // add up contributions of trial // functions @@ -265,7 +265,7 @@ get_function_grads (const InputVector &fe_function, present_cell->get_interpolated_dof_values(fe_function, dof_values); // initialize with zero - fill_n (gradients.begin(), n_quadrature_points, Tensor<1,dim>()); + std::fill_n (gradients.begin(), n_quadrature_points, Tensor<1,dim>()); // add up contributions of trial // functions @@ -306,7 +306,7 @@ get_function_grads (const InputVector // initialize with zero for (unsigned i=0;i()); + std::fill_n (gradients[i].begin(), gradients[i].size(), Tensor<1,dim>()); // add up contributions of trial // functions @@ -387,7 +387,7 @@ get_function_2nd_derivatives (const InputVector // initialize with zero for (unsigned i=0;i()); + std::fill_n (second_derivs[i].begin(), second_derivs[i].size(), Tensor<2,dim>()); // add up contributions of trial // functions diff --git a/deal.II/deal.II/source/fe/mapping_c1.cc b/deal.II/deal.II/source/fe/mapping_c1.cc index cc20ddb6f3..d33a1d906b 100644 --- a/deal.II/deal.II/source/fe/mapping_c1.cc +++ b/deal.II/deal.II/source/fe/mapping_c1.cc @@ -142,14 +142,14 @@ MappingC1<2>::add_line_support_points (const Triangulation<2>::cell_iterator &ce coordinate_axis /= h; const double alpha = std::atan2(coordinate_axis[1], coordinate_axis[0]); - const double b = ((face_vertex_normals[0][1] * sin(alpha) - +face_vertex_normals[0][0] * cos(alpha)) / - (face_vertex_normals[0][1] * cos(alpha) - -face_vertex_normals[0][0] * sin(alpha))), - c = ((face_vertex_normals[1][1] * sin(alpha) - +face_vertex_normals[1][0] * cos(alpha)) / - (face_vertex_normals[1][1] * cos(alpha) - -face_vertex_normals[1][0] * sin(alpha))); + const double b = ((face_vertex_normals[0][1] * std::sin(alpha) + +face_vertex_normals[0][0] * std::cos(alpha)) / + (face_vertex_normals[0][1] * std::cos(alpha) + -face_vertex_normals[0][0] * std::sin(alpha))), + c = ((face_vertex_normals[1][1] * std::sin(alpha) + +face_vertex_normals[1][0] * std::cos(alpha)) / + (face_vertex_normals[1][1] * std::cos(alpha) + -face_vertex_normals[1][0] * std::sin(alpha))); // next evaluate the so // determined cubic @@ -164,10 +164,10 @@ MappingC1<2>::add_line_support_points (const Triangulation<2>::cell_iterator &ce // scaling and shifting for (unsigned int i=0; i<2; ++i) { - Point<2> real_point (cos(alpha) * new_unit_points[i][0] - - sin(alpha) * new_unit_points[i][1], - sin(alpha) * new_unit_points[i][0] - + cos(alpha) * new_unit_points[i][1]); + Point<2> real_point (std::cos(alpha) * new_unit_points[i][0] + - std::sin(alpha) * new_unit_points[i][1], + std::sin(alpha) * new_unit_points[i][0] + + std::cos(alpha) * new_unit_points[i][1]); real_point *= h; real_point += line->vertex(0); a.push_back (real_point); diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index d8a1c8321c..30ac922a5e 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -104,7 +104,7 @@ MappingQ::MappingQ (const unsigned int p): // shape functions of the Qp // mapping. renumber.resize(n_shape_functions,0); - std::vector dpo(dim+1, 1); + std::vector dpo(dim+1, static_cast(1)); for (unsigned int i=1; i fe_data(dpo, 1); @@ -460,8 +460,8 @@ MappingQ::set_laplace_on_quad_vector(std::vector > &loq // at the outer rim should be // one. check this for (unsigned int unit_point=0; unit_point::compute_face_data (const UpdateFlags update_flags, Tensor<1,dim> tangential; tangential[(nindex+1)%dim] = (normal_directions[i]%2) ? -1 : 1; data.unit_tangentials[i].resize(n_original_q_points); - fill (data.unit_tangentials[i].begin(), - data.unit_tangentials[i].end(), - tangential); + std::fill (data.unit_tangentials[i].begin(), + data.unit_tangentials[i].end(), + tangential); if (dim>2) { @@ -479,9 +479,9 @@ MappingQ1::compute_fill (const typename DoFHandler::cell_iterator &cel { Assert (quadrature_points.size() == npts, ExcDimensionMismatch(quadrature_points.size(), npts)); - fill(quadrature_points.begin(), - quadrature_points.end(), - Point()); + std::fill(quadrature_points.begin(), + quadrature_points.end(), + Point()); } if (update_flags & update_covariant_transformation) @@ -494,9 +494,9 @@ MappingQ1::compute_fill (const typename DoFHandler::cell_iterator &cel { Assert (data.contravariant.size() == npts, ExcDimensionMismatch(data.contravariant.size(), npts)); - fill(data.contravariant.begin(), - data.contravariant.end(), - Tensor<2,dim>()); + std::fill(data.contravariant.begin(), + data.contravariant.end(), + Tensor<2,dim>()); } if (update_flags & update_jacobian_grads) @@ -679,8 +679,8 @@ MappingQ1::compute_fill_face (const typename DoFHandler::cell_iterator | update_JxW_values)) for (unsigned int i=0;i &tria, // equilibrate cell sizes at // transition from the inner part // to the radial cells - const double a = 1./(1+sqrt(2.0)); - const Point<2> vertices[8] = { p+Point<2>(-1,-1)*(radius/sqrt(2.0)), - p+Point<2>(+1,-1)*(radius/sqrt(2.0)), - p+Point<2>(-1,-1)*(radius/sqrt(2.0)*a), - p+Point<2>(+1,-1)*(radius/sqrt(2.0)*a), - p+Point<2>(-1,+1)*(radius/sqrt(2.0)*a), - p+Point<2>(+1,+1)*(radius/sqrt(2.0)*a), - p+Point<2>(-1,+1)*(radius/sqrt(2.0)), - p+Point<2>(+1,+1)*(radius/sqrt(2.0)) }; + const double a = 1./(1+std::sqrt(2.0)); + const Point<2> vertices[8] = { p+Point<2>(-1,-1)*(radius/std::sqrt(2.0)), + p+Point<2>(+1,-1)*(radius/std::sqrt(2.0)), + p+Point<2>(-1,-1)*(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,-1)*(radius/std::sqrt(2.0)*a), + p+Point<2>(-1,+1)*(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,+1)*(radius/std::sqrt(2.0)*a), + p+Point<2>(-1,+1)*(radius/std::sqrt(2.0)), + p+Point<2>(+1,+1)*(radius/std::sqrt(2.0)) }; const int cell_vertices[5][4] = {{0, 1, 3, 2}, {0, 2, 4, 6}, @@ -389,8 +389,8 @@ void GridGenerator::hyper_shell (Triangulation<2> &tria, // radii) const unsigned int N = (n_cells == 0 ? static_cast - (ceil((2*pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : + (std::ceil((2*pi* (outer_radius + inner_radius)/2) / + (outer_radius - inner_radius))) : n_cells); // set up N vertices on the @@ -402,8 +402,8 @@ void GridGenerator::hyper_shell (Triangulation<2> &tria, std::vector > vertices(2*N); for (unsigned int i=0; i( cos(2*pi * i/N), - sin(2*pi * i/N)) * outer_radius; + vertices[i] = Point<2>( std::cos(2*pi * i/N), + std::sin(2*pi * i/N)) * outer_radius; vertices[i+N] = vertices[i] * (inner_radius/outer_radius); vertices[i] += center; @@ -449,8 +449,8 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, // radii) const unsigned int N = (n_cells == 0 ? static_cast - (ceil((pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : + (std::ceil((pi* (outer_radius + inner_radius)/2) / + (outer_radius - inner_radius))) : n_cells); // set up N+1 vertices on the @@ -470,8 +470,8 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, // value of pi) vertices[i] = Point<2>( ( (i==0) || (i==N) ? 0 : - cos(pi * i/N - pi/2) ), - sin(pi * i/N - pi/2)) * outer_radius; + std::cos(pi * i/N - pi/2) ), + std::sin(pi * i/N - pi/2)) * outer_radius; vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius); vertices[i] += center; diff --git a/deal.II/deal.II/source/grid/grid_out.cc b/deal.II/deal.II/source/grid/grid_out.cc index e95c010e8e..9b6a9aaf33 100644 --- a/deal.II/deal.II/source/grid/grid_out.cc +++ b/deal.II/deal.II/source/grid/grid_out.cc @@ -69,8 +69,8 @@ void GridOut::write_ucd (const Triangulation &tria, // block this to have local // variables destroyed after // use - time_t time1= time (0); - tm *time = localtime(&time1); + std::time_t time1= std::time (0); + std::tm *time = std::localtime(&time1); out << "# This file was generated by the deal.II library." << std::endl << "# Date = " << time->tm_year+1900 << "/" @@ -682,9 +682,9 @@ void GridOut::write_eps (const Triangulation &tria, const double pi = 3.141592653589793238462; const double z_angle = eps_flags_3.azimut_angle; const double turn_angle = eps_flags_3.turn_angle; - const Point view_direction(-sin(z_angle * 2.*pi / 360.) * sin(turn_angle * 2.*pi / 360.), - +sin(z_angle * 2.*pi / 360.) * cos(turn_angle * 2.*pi / 360.), - -cos(z_angle * 2.*pi / 360.)); + const Point view_direction(-std::sin(z_angle * 2.*pi / 360.) * std::sin(turn_angle * 2.*pi / 360.), + +std::sin(z_angle * 2.*pi / 360.) * std::cos(turn_angle * 2.*pi / 360.), + -std::cos(z_angle * 2.*pi / 360.)); // decide about the two unit vectors // in this plane. we chose the first one @@ -692,7 +692,7 @@ void GridOut::write_eps (const Triangulation &tria, // to this plane const Point vector1 = Point(0,0,1) - ((Point(0,0,1) * view_direction) * view_direction); - const Point unit_vector1 = vector1 / sqrt(vector1.square()); + const Point unit_vector1 = vector1 / std::sqrt(vector1.square()); // now the third vector is fixed. we // chose the projection of a more or @@ -761,8 +761,8 @@ void GridOut::write_eps (const Triangulation &tria, // block this to have local // variables destroyed after // use - time_t time1= time (0); - tm *time = localtime(&time1); + std::time_t time1= std::time (0); + std::tm *time = std::localtime(&time1); out << "%!PS-Adobe-2.0 EPSF-1.2" << std::endl << "%%Title: deal.II Output" << std::endl << "%%Creator: the deal.II library" << std::endl diff --git a/deal.II/deal.II/source/grid/grid_refinement.cc b/deal.II/deal.II/source/grid/grid_refinement.cc index 06668ad00f..269f87367a 100644 --- a/deal.II/deal.II/source/grid/grid_refinement.cc +++ b/deal.II/deal.II/source/grid/grid_refinement.cc @@ -95,7 +95,7 @@ void GridRefinement::refine (Triangulation &tria, const unsigned int n_cells = criteria.size(); for (unsigned int index=0; index= threshold) + if (std::fabs(criteria(index)) >= threshold) cell->set_refine_flag(); }; @@ -115,7 +115,7 @@ void GridRefinement::coarsen (Triangulation &tria, const unsigned int n_cells = criteria.size(); for (unsigned int index=0; indexset_coarsen_flag(); }; diff --git a/deal.II/deal.II/source/grid/grid_reordering.cc b/deal.II/deal.II/source/grid/grid_reordering.cc index 70a31063ce..65f397fa3e 100644 --- a/deal.II/deal.II/source/grid/grid_reordering.cc +++ b/deal.II/deal.II/source/grid/grid_reordering.cc @@ -1050,9 +1050,9 @@ void GridReordering::find_reordering (typename std::vector const unsigned int new_cell_number = rotation_states.size()-1; const unsigned int - old_cell_number = find (new_cell_numbers.begin(), - new_cell_numbers.end(), - new_cell_number) - new_cell_numbers.begin(); + old_cell_number = std::find (new_cell_numbers.begin(), + new_cell_numbers.end(), + new_cell_number) - new_cell_numbers.begin(); Assert (old_cell_number < cells.size(), ExcInternalError()); original_cells[old_cell_number].rotate (rotation_states.back()); @@ -1163,12 +1163,12 @@ GridReordering::presort_cells (typename std::vector &cells, // next_round_cells array, // which is needed for the next // loop iteration anyway - sort (new_next_round_cells.begin(), new_next_round_cells.end()); + std::sort (new_next_round_cells.begin(), new_next_round_cells.end()); next_round_cells.clear (); unique_copy (new_next_round_cells.begin(), new_next_round_cells.end(), back_inserter(next_round_cells)); }; - Assert (find (new_cell_numbers.begin(), new_cell_numbers.end(), invalid_cell_number) + Assert (std::find (new_cell_numbers.begin(), new_cell_numbers.end(), invalid_cell_number) == new_cell_numbers.end(), ExcInternalError()); diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index e7c5ce4d7f..0bc0aa6885 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -555,8 +555,8 @@ void Triangulation<2>::create_triangulation (const std::vector > &v, // is at least two. if not so, // then clean triangulation and // exit with an exception - if ( ! (* (min_element(vertex_touch_count.begin(), - vertex_touch_count.end())) >= 2)) + if ( ! (* (std::min_element(vertex_touch_count.begin(), + vertex_touch_count.end())) >= 2)) { // clear will only work if // there are no @@ -1702,10 +1702,10 @@ void Triangulation::distort_random (const double factor, // first compute a random shift vector for (unsigned int d=0; d::at_boundary () const template double TriaObjectAccessor<1, dim>::diameter () const { - return sqrt((vertex(1)-vertex(0)).square()); + return std::sqrt((vertex(1)-vertex(0)).square()); }; @@ -202,7 +202,7 @@ Point TriaObjectAccessor<1, dim>::barycenter () const template double TriaObjectAccessor<1, dim>::measure () const { - return sqrt((vertex(1)-vertex(0)).square()); + return std::sqrt((vertex(1)-vertex(0)).square()); }; @@ -379,8 +379,8 @@ bool TriaObjectAccessor<2, dim>::at_boundary () const template double TriaObjectAccessor<2, dim>::diameter () const { - return sqrt(std::max((vertex(2)-vertex(0)).square(), - (vertex(3)-vertex(1)).square())); + return std::sqrt(std::max((vertex(2)-vertex(0)).square(), + (vertex(3)-vertex(1)).square())); }; diff --git a/deal.II/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/deal.II/source/grid/tria_boundary_lib.cc index 4e56c909e9..476c392464 100644 --- a/deal.II/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/deal.II/source/grid/tria_boundary_lib.cc @@ -40,12 +40,12 @@ HyperBallBoundary::get_new_point_on_line (const typename Triangulation if (compute_radius_automatically) { const Point vertex_relative = line->vertex(0) - center; - r = sqrt(vertex_relative.square()); + r = std::sqrt(vertex_relative.square()); } else r=radius; // project to boundary - middle *= r / sqrt(middle.square()); + middle *= r / std::sqrt(middle.square()); middle += center; return middle; @@ -81,12 +81,12 @@ get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) c if (compute_radius_automatically) { const Point vertex_relative = quad->vertex(0) - center; - r = sqrt(vertex_relative.square()); + r = std::sqrt(vertex_relative.square()); } else r=radius; // project to boundary - middle *= r / sqrt(middle.square()); + middle *= r / std::sqrt(middle.square()); middle += center; return middle; @@ -131,7 +131,7 @@ HyperBallBoundary::get_intermediate_points_between_points ( const Point v0=p0-center, v1=p1-center; - const double length=sqrt((v1-v0).square()); + const double length=std::sqrt((v1-v0).square()); double eps=1e-14; double r=0; @@ -143,14 +143,14 @@ HyperBallBoundary::get_intermediate_points_between_points ( else r=radius; - Assert(fabs(v0.square()-r*r) pm=0.5*(v0+v1); - const double h=sqrt(pm.square()); + const double h=std::sqrt(pm.square()); double beta=0; unsigned int left_index=0, right_index=0; diff --git a/deal.II/deal.II/source/multigrid/mg_smoother.cc b/deal.II/deal.II/source/multigrid/mg_smoother.cc index ed80acf359..9fd6e98053 100644 --- a/deal.II/deal.II/source/multigrid/mg_smoother.cc +++ b/deal.II/deal.II/source/multigrid/mg_smoother.cc @@ -106,9 +106,9 @@ MGSmoother::MGSmoother (const MGDoFHandler &mg_dof, unsigned int steps) // now sort the list of interior boundary // dofs and eliminate duplicates - sort (boundary_dofs.begin(), boundary_dofs.end()); - boundary_dofs.erase (unique (boundary_dofs.begin(), - boundary_dofs.end()), + std::sort (boundary_dofs.begin(), boundary_dofs.end()); + boundary_dofs.erase (std::unique (boundary_dofs.begin(), + boundary_dofs.end()), boundary_dofs.end()); // now finally copy the result diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index b2d889fbba..ad2f58edd8 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -315,7 +315,7 @@ void DataOut::build_some_patches (Data data) const unsigned int n_q_points = patch_points.n_quadrature_points; unsigned int cell_number = 0; - typename std::vector >::iterator patch = patches.begin(); + typename std::vector >::iterator patch = patches.begin(); typename DoFHandler::cell_iterator cell=first_cell(); // get first cell in this thread diff --git a/deal.II/deal.II/source/numerics/data_out_rotation.cc b/deal.II/deal.II/source/numerics/data_out_rotation.cc index 7d14c47f56..877d544619 100644 --- a/deal.II/deal.II/source/numerics/data_out_rotation.cc +++ b/deal.II/deal.II/source/numerics/data_out_rotation.cc @@ -72,8 +72,8 @@ void DataOutRotation::build_some_patches (Data data) std::vector > angle_directions (n_patches_per_circle+1); for (unsigned int i=0; i<=n_patches_per_circle; ++i) { - angle_directions[i][0] = cos(2*pi*i/n_patches_per_circle); - angle_directions[i][1] = sin(2*pi*i/n_patches_per_circle); + angle_directions[i][0] = std::cos(2*pi*i/n_patches_per_circle); + angle_directions[i][1] = std::sin(2*pi*i/n_patches_per_circle); }; @@ -84,7 +84,7 @@ void DataOutRotation::build_some_patches (Data data) // get first cell in this thread for (unsigned int i=0; (iend()); ++i) { - advance (patch, n_patches_per_circle); + std::advance (patch, n_patches_per_circle); ++cell_number; cell=next_cell(cell); } @@ -271,7 +271,7 @@ void DataOutRotation::build_some_patches (Data data) // belonging to this thread. const int skip_threads = static_cast(data.n_threads)-1; for (int i=0; (iend()); ++i) - advance (patch, n_patches_per_circle); + std::advance (patch, n_patches_per_circle); // however, cell and cell // number have not yet been diff --git a/deal.II/deal.II/source/numerics/derivative_approximation.cc b/deal.II/deal.II/source/numerics/derivative_approximation.cc index ee006ca738..18c0595108 100644 --- a/deal.II/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/deal.II/source/numerics/derivative_approximation.cc @@ -78,7 +78,7 @@ DerivativeApproximation::Gradient::derivative_norm (const Derivative &d) double s = 0; for (unsigned int i=0; i &mapping, // the centers of two // cells Point y = neighbor_center - this_center; - const double distance = sqrt(y.square()); + const double distance = std::sqrt(y.square()); // normalize y y /= distance; // *** note that unlike in diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index 087274c7d0..a1a9ff3cfc 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -666,7 +666,7 @@ void KellyErrorEstimator::estimate (const Mapping &ma }; for (unsigned int n=0; n > &values, case logarithmic: { - const float delta = (log(max_value)-log(min_value))/n_intervals; + const float delta = (std::log(max_value)-std::log(min_value))/n_intervals; for (unsigned int n=0; n &mapping, // diagonal entry. double max_diag_entry = 0; for (unsigned int i=0; i max_diag_entry) + if (std::fabs(cell_matrix(i,i)) > max_diag_entry) max_diag_entry = fabs(cell_matrix(i,i)); #endif @@ -669,7 +669,7 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, //TODO:[?] We assume here that shape functions that have support also on the boundary also have their support point on the boundary (by having their indices in dof_is_on_face set true). This is not true, however, e.g. for discontinuous elements. // compare here for relative // smallness - Assert (fabs(cell_matrix(i,j)) <= 1e-10 * max_diag_entry, + Assert (std::fabs(cell_matrix(i,j)) <= 1e-10 * max_diag_entry, ExcInternalError ()); }; @@ -680,7 +680,7 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, { // compare here for relative // smallness - Assert (fabs(cell_vector(j)) <= 1e-10 * max_diag_entry, + Assert (std::fabs(cell_vector(j)) <= 1e-10 * max_diag_entry, ExcInternalError()); }; mutex.release (); diff --git a/deal.II/deal.II/source/numerics/time_dependent.cc b/deal.II/deal.II/source/numerics/time_dependent.cc index 4b4d8614bd..091819f838 100644 --- a/deal.II/deal.II/source/numerics/time_dependent.cc +++ b/deal.II/deal.II/source/numerics/time_dependent.cc @@ -58,7 +58,7 @@ void TimeDependent::insert_timestep (const TimeStepBase *position, TimeStepBase *new_timestep) { - Assert ((find(timesteps.begin(), timesteps.end(), position) != timesteps.end()) || + Assert ((std::find(timesteps.begin(), timesteps.end(), position) != timesteps.end()) || (position == 0), ExcInvalidPosition()); @@ -97,7 +97,7 @@ TimeDependent::insert_timestep (const TimeStepBase *position, { // inner time step std::vector::iterator insert_position - = find(timesteps.begin(), timesteps.end(), position); + = std::find(timesteps.begin(), timesteps.end(), position); (*(insert_position-1))->set_next_timestep (new_timestep); new_timestep->set_previous_timestep (*(insert_position-1)); @@ -109,7 +109,7 @@ TimeDependent::insert_timestep (const TimeStepBase *position, // array timesteps.insert ((position == 0 ? timesteps.end() : - find(timesteps.begin(), timesteps.end(), position)), + std::find(timesteps.begin(), timesteps.end(), position)), new_timestep); }; diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 0421d80c58..bf104eb10a 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -966,7 +966,8 @@ VectorTools::integrate_difference (const Mapping &mapping, std::vector > > function_grads (n_q_points, std::vector >(n_components)); std::vector weight_values (n_q_points); - std::vector > weight_vectors (n_q_points, n_components); + std::vector > weight_vectors (n_q_points, + Vector(n_components)); std::vector > psi_values (n_q_points, Vector(n_components)); @@ -1097,9 +1098,9 @@ VectorTools::integrate_difference (const Mapping &mapping, psi_scalar[q] = psi_values[q].norm_sqr(); // Integration on one cell - diff = inner_product (psi_scalar.begin(), psi_scalar.end(), - fe_values.get_JxW_values().begin(), - 0.0); + diff = std::inner_product (psi_scalar.begin(), psi_scalar.end(), + fe_values.get_JxW_values().begin(), + 0.0); if (norm == L2_norm) diff=sqrt(diff); break; @@ -1114,7 +1115,7 @@ VectorTools::integrate_difference (const Mapping &mapping, psi_scalar[q] = 0; // weighted scalar product for (unsigned int i=0; in_components == 1 @@ -1144,7 +1145,7 @@ VectorTools::integrate_difference (const Mapping &mapping, psi_scalar[q] = 0; for (unsigned int i=0; i::l1_norm () const template Number BlockVector::l2_norm () const { - return sqrt(norm_sqr()); + return std::sqrt(norm_sqr()); } diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 1c492bf0cb..256d706e83 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -273,7 +273,7 @@ double FullMatrix::residual (Vector& dst, dst(i) = s; res += s*s; } - return sqrt(res); + return std::sqrt(res); } @@ -595,7 +595,7 @@ number FullMatrix::l1_norm () const { sum=0; for (unsigned int row=0; row max) max = sum; } @@ -615,7 +615,7 @@ number FullMatrix::linfty_norm () const { sum=0; for (unsigned int col=0; col max) max = sum; } @@ -1074,7 +1074,7 @@ FullMatrix::norm2 () const number s = 0.; for (unsigned int i=0;i::relative_symmetry_norm2 () const s += (*this)(i,j)*(*this)(i,j); } if (s!=0.) - return sqrt(a)/sqrt(s); + return std::sqrt(a)/std::sqrt(s); return 0; } @@ -1323,13 +1323,13 @@ FullMatrix::gauss_jordan() for (unsigned int j=0; j max) + if (std::fabs(el(i,j)) > max) { - max = fabs(el(i,j)); + max = std::fabs(el(i,j)); r = i; } } @@ -1391,9 +1391,9 @@ FullMatrix::householder(Vector& src) number2 sigma = 0; unsigned int i; for (i=j ; i::least_squares(Vector& dst, Vector& src) number2 sum = 0.; for (unsigned int i=n() ; i double SolverCG::criterion() { - return sqrt(res2); + return std::sqrt(res2); } diff --git a/deal.II/lac/include/lac/sparse_ilu.templates.h b/deal.II/lac/include/lac/sparse_ilu.templates.h index b12ad24d3e..e356222bf5 100644 --- a/deal.II/lac/include/lac/sparse_ilu.templates.h +++ b/deal.II/lac/include/lac/sparse_ilu.templates.h @@ -108,7 +108,7 @@ void SparseILU::decompose (const SparseMatrix &matrix, number rowsum = 0; for (unsigned int global_index=rowstart; global_index::kill_file () if (filename != "") { - int status = remove (filename.c_str()); + int status = std::remove (filename.c_str()); AssertThrow (status == 0, ExcInternalError()); filename = ""; diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index a852fff4e3..0ada7046db 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -417,11 +417,6 @@ class Vector * @name 5: Mixed stuff */ //@{ - /** - * Output of vector in user-defined format. - */ - void print (FILE* fp, const char* format = 0) const; - /** * Output of vector in user-defined format. */ diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index a592039928..682610b6e1 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -207,14 +207,14 @@ Number Vector::l1_norm () const eptr = ptr + (dim/4)*4; while (ptr!=eptr) { - sum0 += fabs(*ptr++); - sum1 += fabs(*ptr++); - sum2 += fabs(*ptr++); - sum3 += fabs(*ptr++); + sum0 += std::fabs(*ptr++); + sum1 += std::fabs(*ptr++); + sum2 += std::fabs(*ptr++); + sum3 += std::fabs(*ptr++); }; // add up remaining elements while (ptr != end()) - sum0 += fabs(*ptr++); + sum0 += std::fabs(*ptr++); return sum0+sum1+sum2+sum3; }; @@ -223,7 +223,7 @@ Number Vector::l1_norm () const template Number Vector::l2_norm () const { - return sqrt(norm_sqr()); + return std::sqrt(norm_sqr()); }; @@ -237,15 +237,15 @@ Number Vector::linfty_norm () const { max3=0.; for (unsigned int i=0; i<(dim/4); ++i) { - if (max0::operator = (const Vector& v) -template -void Vector::print (FILE* f, const char* format) const -{ - Assert (dim!=0, ExcEmptyVector()); - if (!format) format = " %5.2f"; - for (unsigned int j=0;j void Vector::print (const char* format) const { Assert (dim!=0, ExcEmptyVector()); if (!format) format = " %5.2f"; for (unsigned int j=0;j::block_write (std::ostream &out) const const unsigned int sz = size(); char buf[16]; - sprintf(buf, "%d", sz); - strcat(buf, "\n["); + std::sprintf(buf, "%d", sz); + std::strcat(buf, "\n["); - out.write(buf, strlen(buf)); + out.write(buf, std::strlen(buf)); out.write (reinterpret_cast(begin()), reinterpret_cast(end()) - reinterpret_cast(begin())); @@ -607,7 +595,7 @@ void Vector::block_read (std::istream &in) in.getline(buf,16,'\n'); - sz=atoi(buf); + sz=std::atoi(buf); // fast initialization, since the // data elements are overwritten anyway diff --git a/deal.II/lac/source/compressed_sparsity_pattern.cc b/deal.II/lac/source/compressed_sparsity_pattern.cc index f779e404f0..d9f6e9ed48 100644 --- a/deal.II/lac/source/compressed_sparsity_pattern.cc +++ b/deal.II/lac/source/compressed_sparsity_pattern.cc @@ -201,8 +201,8 @@ CompressedSparsityPattern::bandwidth () const for (unsigned int row=0; row::const_iterator i=column_indices[row].begin(); i!=column_indices[row].end(); ++i) - if (static_cast(abs(static_cast(row-*i))) > b) - b = abs(static_cast(row-*i)); + if (static_cast(std::abs(static_cast(row-*i))) > b) + b = std::abs(static_cast(row-*i)); return b; }; diff --git a/deal.II/lac/source/sparsity_pattern.cc b/deal.II/lac/source/sparsity_pattern.cc index 8eb682f67b..cc0760cf88 100644 --- a/deal.II/lac/source/sparsity_pattern.cc +++ b/deal.II/lac/source/sparsity_pattern.cc @@ -663,8 +663,8 @@ SparsityPattern::bandwidth () const for (unsigned int j=rowstart[i]; j(abs(static_cast(i-colnums[j]))) > b) - b = abs(static_cast(i-colnums[j])); + if (static_cast(std::abs(static_cast(i-colnums[j]))) > b) + b = std::abs(static_cast(i-colnums[j])); } else // leave if at the end of -- 2.39.5