From: Matthias Maier Date: Sat, 18 Apr 2015 13:23:53 +0000 (+0200) Subject: Fix a bunch of warnings X-Git-Tag: v8.3.0-rc1~244^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c85714582380c0ebb1119a122f322bf6f58eb274;p=dealii.git Fix a bunch of warnings These are harmless code modifications to make a variety of compilers happy. --- diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 793f3d8893..e36ffbed12 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -287,17 +287,18 @@ #ifdef DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA -# define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS \ -_Pragma("GCC diagnostic push") \ -_Pragma("GCC diagnostic ignored \"-Wpragmas\"") \ -_Pragma("GCC diagnostic ignored \"-Wextra\"") \ -_Pragma("GCC diagnostic ignored \"-Woverloaded-virtual\"") \ -_Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ -_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \ -_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ +# define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS \ +_Pragma("GCC diagnostic push") \ +_Pragma("GCC diagnostic ignored \"-Wpragmas\"") \ +_Pragma("GCC diagnostic ignored \"-Wextra\"") \ +_Pragma("GCC diagnostic ignored \"-Woverloaded-virtual\"") \ +_Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ +_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \ +_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ +_Pragma("GCC diagnostic ignored \"-Wunused-but-set-parameter\"") \ _Pragma("GCC diagnostic warning \"-Wpragmas\"") -# define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS \ +# define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS \ _Pragma("GCC diagnostic pop") #else diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index 7c0546cc99..6bcbacbc5a 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2004 - 2014 by the deal.II authors +// Copyright (C) 2004 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -1226,6 +1226,8 @@ namespace PETScWrappers const PetscScalar *values, const bool elide_zero_values) { + (void)elide_zero_values; + prepare_action(VectorOperation::insert); const PetscInt petsc_i = row; @@ -1234,8 +1236,7 @@ namespace PETScWrappers PetscScalar const *col_value_ptr; int n_columns; - // If we don't elide zeros, the pointers - // are already available... + // If we don't elide zeros, the pointers are already available... #ifndef PETSC_USE_64BIT_INDICES if (elide_zero_values == false) { @@ -1246,8 +1247,8 @@ namespace PETScWrappers else #endif { - // Otherwise, extract nonzero values in - // each row and get the respective index. + // Otherwise, extract nonzero values in each row and get the + // respective index. if (column_indices.size() < n_cols) { column_indices.resize(n_cols); @@ -1291,16 +1292,11 @@ namespace PETScWrappers if (value == PetscScalar()) { - // we have to do checkings on Insert/Add - // in any case - // to be consistent with the MPI - // communication model (see the comments - // in the documentation of - // TrilinosWrappers::Vector), but we can - // save some work if the addend is - // zero. However, these actions are done - // in case we pass on to the other - // function. + // we have to do checkings on Insert/Add in any case to be + // consistent with the MPI communication model (see the comments in + // the documentation of TrilinosWrappers::Vector), but we can save + // some work if the addend is zero. However, these actions are done + // in case we pass on to the other function. prepare_action(VectorOperation::add); return; @@ -1368,10 +1364,12 @@ namespace PETScWrappers MatrixBase::add (const size_type row, const size_type n_cols, const size_type *col_indices, - const PetscScalar *values, + const PetscScalar *values, const bool elide_zero_values, const bool /*col_indices_are_sorted*/) { + (void)elide_zero_values; + prepare_action(VectorOperation::add); const PetscInt petsc_i = row; @@ -1380,8 +1378,7 @@ namespace PETScWrappers PetscScalar const *col_value_ptr; int n_columns; - // If we don't elide zeros, the pointers - // are already available... + // If we don't elide zeros, the pointers are already available... #ifndef PETSC_USE_64BIT_INDICES if (elide_zero_values == false) { @@ -1392,8 +1389,8 @@ namespace PETScWrappers else #endif { - // Otherwise, extract nonzero values in - // each row and get the respective index. + // Otherwise, extract nonzero values in each row and get the + // respective index. if (column_indices.size() < n_cols) { column_indices.resize(n_cols); diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 9d7c076279..a9ad0a6b1a 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -54,6 +54,7 @@ namespace TrilinosWrappers // define a helper function that queries the global ID of local ID of // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. + inline int gid(const Epetra_BlockMap &map, int i) { return map.GID(i); @@ -62,6 +63,7 @@ namespace TrilinosWrappers // define a helper function that queries the global ID of local ID of // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. + inline long long int gid(const Epetra_BlockMap &map, int i) { return map.GID64(i); diff --git a/source/grid/grid_refinement.cc b/source/grid/grid_refinement.cc index c8b44a438a..8d987eca95 100644 --- a/source/grid/grid_refinement.cc +++ b/source/grid/grid_refinement.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2014 by the deal.II authors +// Copyright (C) 2000 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -61,6 +61,7 @@ namespace #ifdef DEAL_II_WITH_PETSC + inline PetscScalar max_element (const PETScWrappers::Vector &criteria) { @@ -74,6 +75,7 @@ namespace } + inline PetscScalar min_element (const PETScWrappers::Vector &criteria) { @@ -89,6 +91,7 @@ namespace #ifdef DEAL_II_WITH_TRILINOS + inline TrilinosScalar max_element (const TrilinosWrappers::Vector &criteria) { @@ -98,6 +101,7 @@ namespace } + inline TrilinosScalar min_element (const TrilinosWrappers::Vector &criteria) { diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index e78afd109d..56568a97e0 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -58,9 +58,8 @@ DEAL_II_NAMESPACE_OPEN namespace GridTools { -// This anonymous namespace contains utility functions to extract the -// triangulation from any container such as DoFHandler -// and the like + // This anonymous namespace contains utility functions to extract the + // triangulation from any container such as DoFHandler and the like namespace { template @@ -113,36 +112,25 @@ namespace GridTools double diameter (const Triangulation &tria) { - // we can't deal with distributed meshes - // since we don't have all vertices - // locally. there is one exception, - // however: if the mesh has never been - // refined. the way to test this is not to - // ask tria.n_levels()==1, since this is - // something that can happen on one - // processor without being true on - // all. however, we can ask for the global - // number of active cells and use that -#ifdef DEAL_II_WITH_P4EST + // we can't deal with distributed meshes since we don't have all + // vertices locally. there is one exception, however: if the mesh has + // never been refined. the way to test this is not to ask + // tria.n_levels()==1, since this is something that can happen on one + // processor without being true on all. however, we can ask for the + // global number of active cells and use that +#if defined(DEAL_II_WITH_P4EST) && defined(DEBUG) if (const parallel::distributed::Triangulation *p_tria = dynamic_cast*>(&tria)) Assert (p_tria->n_global_active_cells() == tria.n_cells(0), ExcNotImplemented()); #endif - // the algorithm used simply - // traverses all cells and picks - // out the boundary vertices. it - // may or may not be faster to - // simply get all vectors, don't - // mark boundary vertices, and - // compute the distances thereof, - // but at least as the mesh is - // refined, it seems better to - // first mark boundary nodes, as - // marking is O(N) in the number of - // cells/vertices, while computing - // the maximal distance is O(N*N) + // the algorithm used simply traverses all cells and picks out the + // boundary vertices. it may or may not be faster to simply get all + // vectors, don't mark boundary vertices, and compute the distances + // thereof, but at least as the mesh is refined, it seems better to + // first mark boundary nodes, as marking is O(N) in the number of + // cells/vertices, while computing the maximal distance is O(N*N) const std::vector > &vertices = tria.get_vertices (); std::vector boundary_vertices (vertices.size(), false); @@ -156,11 +144,8 @@ namespace GridTools for (unsigned int i=0; i::vertices_per_face; ++i) boundary_vertices[cell->face(face)->vertex_index(i)] = true; - // now traverse the list of - // boundary vertices and check - // distances. since distances are - // symmetric, we only have to check - // one half + // now traverse the list of boundary vertices and check distances. + // since distances are symmetric, we only have to check one half double max_distance_sqr = 0; std::vector::const_iterator pi = boundary_vertices.begin(); const unsigned int N = boundary_vertices.size(); diff --git a/source/lac/trilinos_precondition.cc b/source/lac/trilinos_precondition.cc index 76c6c94bcd..b5e0bc6a13 100644 --- a/source/lac/trilinos_precondition.cc +++ b/source/lac/trilinos_precondition.cc @@ -822,7 +822,6 @@ namespace TrilinosWrappers additional_data.constant_modes[0].size() == n_rows; const size_type n_relevant_rows = constant_modes_are_global ? n_rows : additional_data.constant_modes[0].size(); - (void)n_relevant_rows; const size_type my_size = domain_map.NumMyElements(); if (constant_modes_are_global == false) Assert (n_relevant_rows == my_size, @@ -831,6 +830,8 @@ namespace TrilinosWrappers static_cast(global_length(distributed_constant_modes)), ExcDimensionMismatch(n_rows, global_length(distributed_constant_modes))); + + (void)n_relevant_rows; (void)global_length; // Reshape null space as a contiguous vector of doubles so that @@ -1076,6 +1077,9 @@ namespace TrilinosWrappers ExcDimensionMismatch(n_rows, global_length(distributed_constant_modes))); + (void)n_relevant_rows; + (void)global_length; + // Reshape null space as a contiguous vector of doubles so that // Trilinos can read from it. for (size_type d=0; d