From: kronbichler Date: Tue, 12 Feb 2013 09:44:10 +0000 (+0000) Subject: Fix warnings (deprecated functions, unused variables. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd4c2e9ae8432814f027532d08c181a6d557c798;p=dealii-svn.git Fix warnings (deprecated functions, unused variables. git-svn-id: https://svn.dealii.org/trunk@28318 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/fe/fe.h b/deal.II/include/deal.II/fe/fe.h index 8b260a3b5e..999fd6466c 100644 --- a/deal.II/include/deal.II/fe/fe.h +++ b/deal.II/include/deal.II/fe/fe.h @@ -2079,7 +2079,7 @@ public: DeclException2 (ExcComponentIndexInvalid, int, int, << "The component-index pair (" << arg1 << ", " << arg2 - << ") is invalid, i.e. non-existent"); + << ") is invalid, i.e. non-existent."); /** * Exception * @ingroup Exceptions diff --git a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h index 33a47c6e22..3935ef107b 100644 --- a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h +++ b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h @@ -214,7 +214,6 @@ SparseLUDecomposition::copy_from (const SparseMatrix &matrix SparseMatrix::operator= (number(0)); // both allow more and less entries in the new matrix - std::size_t in_index, index; for (unsigned int row=0; rowm(); ++row) { typename SparseMatrix::iterator index = this->begin(row); diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index d2a1ed74d5..4fdc3389c0 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -251,6 +251,35 @@ ChunkSparsityPattern::copy_from (const SparsityType &csp, } + +namespace internal +{ + namespace + { + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type + template + void copy_row (const Sparsity &csp, + const unsigned int row, + ChunkSparsityPattern &dst) + { + typename Sparsity::row_iterator col_num = csp.row_begin (row); + for (; col_num != csp.row_end (row); ++col_num) + dst.add (row, *col_num); + } + + void copy_row (const SparsityPattern &csp, + const unsigned int row, + ChunkSparsityPattern &dst) + { + SparsityPattern::iterator col_num = csp.begin (row); + for (; col_num != csp.end (row); ++col_num) + dst.add (row, col_num->column()); + } + } +} + + template void ChunkSparsityPattern::copy_from (const SparsityType &csp, @@ -271,12 +300,7 @@ ChunkSparsityPattern::copy_from (const SparsityType &csp, // then actually fill it for (unsigned int row = 0; row + void copy_row (const Sparsity &csp, + const unsigned int row, + std::vector &row_indices) + { + typename Sparsity::row_iterator col_num = csp.row_begin (row); + for (unsigned int col=0; col_num != csp.row_end (row); ++col_num, ++col) + row_indices[col] = *col_num; + } + + void copy_row (const dealii::SparsityPattern &csp, + const unsigned int row, + std::vector &row_indices) + { + dealii::SparsityPattern::iterator col_num = csp.begin (row); + for (unsigned int col=0; col_num != csp.end (row); ++col_num, ++col) + row_indices[col] = col_num->column(); + } + } + } + + + template void SparseMatrix::reinit (const Epetra_Map &input_row_map, @@ -372,14 +401,10 @@ namespace TrilinosWrappers temp_vector.clear(); matrix.reset(); - // if we want to exchange data, build - // a usual Trilinos sparsity pattern - // and let that handle the - // exchange. otherwise, manually - // create a CrsGraph, which consumes - // considerably less memory because it - // can set correct number of indices - // right from the start + // if we want to exchange data, build a usual Trilinos sparsity pattern + // and let that handle the exchange. otherwise, manually create a + // CrsGraph, which consumes considerably less memory because it can set + // correct number of indices right from the start if (exchange_data) { SparsityPattern trilinos_sparsity; @@ -408,29 +433,19 @@ namespace TrilinosWrappers for (unsigned int row=first_row; row graph; if (input_row_map.Comm().NumProc() > 1) graph.reset (new Epetra_CrsGraph (Copy, input_row_map, @@ -439,10 +454,8 @@ namespace TrilinosWrappers graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map, &n_entries_per_row[0], true)); - // This functions assumes that the - // sparsity pattern sits on all processors - // (completely). The parallel version uses - // an Epetra graph that is already + // This functions assumes that the sparsity pattern sits on all processors + // (completely). The parallel version uses an Epetra graph that is already // distributed. // now insert the indices @@ -455,24 +468,17 @@ namespace TrilinosWrappers continue; row_indices.resize (row_length, -1); - - typename SparsityType::row_iterator col_num = sparsity_pattern.row_begin (row), - row_end = sparsity_pattern.row_end(row); - for (unsigned int col = 0; col_num != row_end; ++col_num, ++col) - row_indices[col] = *col_num; - + internal::copy_row(sparsity_pattern, row, row_indices); graph->Epetra_CrsGraph::InsertGlobalIndices (row, row_length, &row_indices[0]); } - // Eventually, optimize the graph - // structure (sort indices, make memory + // Eventually, optimize the graph structure (sort indices, make memory // contiguous, etc). graph->FillComplete(input_col_map, input_row_map); graph->OptimizeStorage(); - // check whether we got the number of - // columns right. + // check whether we got the number of columns right. AssertDimension (sparsity_pattern.n_cols(), static_cast(graph->NumGlobalCols())); @@ -480,9 +486,8 @@ namespace TrilinosWrappers matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); last_action = Zero; - // In the end, the matrix needs to - // be compressed in order to be - // really ready. + // In the end, the matrix needs to be compressed in order to be really + // ready. compress(); } diff --git a/deal.II/source/lac/trilinos_sparsity_pattern.cc b/deal.II/source/lac/trilinos_sparsity_pattern.cc index b3d2dabf0c..9d2e1f8868 100644 --- a/deal.II/source/lac/trilinos_sparsity_pattern.cc +++ b/deal.II/source/lac/trilinos_sparsity_pattern.cc @@ -271,6 +271,35 @@ namespace TrilinosWrappers + namespace internal + { + namespace + { + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type + template + void copy_row (const Sparsity &csp, + const unsigned int row, + std::vector &row_indices) + { + typename Sparsity::row_iterator col_num = csp.row_begin (row); + for (unsigned int col=0; col_num != csp.row_end (row); ++col_num, ++col) + row_indices[col] = *col_num; + } + + void copy_row (const dealii::SparsityPattern &csp, + const unsigned int row, + std::vector &row_indices) + { + dealii::SparsityPattern::iterator col_num = csp.begin (row); + for (unsigned int col=0; col_num != csp.end (row); ++col_num, ++col) + row_indices[col] = col_num->column(); + } + } + } + + + template void SparsityPattern::reinit (const Epetra_Map &input_row_map, @@ -323,12 +352,7 @@ namespace TrilinosWrappers continue; row_indices.resize (row_length, -1); - - typename SparsityType::row_iterator col_num = sp.row_begin (row), - row_end = sp.row_end(row); - for (unsigned int col = 0; col_num != row_end; ++col_num, ++col) - row_indices[col] = *col_num; - + internal::copy_row(sp, row, row_indices); graph->Epetra_CrsGraph::InsertGlobalIndices (row, row_length, &row_indices[0]); } @@ -340,14 +364,9 @@ namespace TrilinosWrappers continue; row_indices.resize (row_length, -1); - - typename SparsityType::row_iterator col_num = sp.row_begin (row), - row_end = sp.row_end(row); - for (unsigned int col = 0; col_num != row_end; ++col_num, ++col) - row_indices[col] = *col_num; - - graph->InsertGlobalIndices (1, reinterpret_cast(&row), row_length, - &row_indices[0]); + internal::copy_row(sp, row, row_indices); + graph->InsertGlobalIndices (1, reinterpret_cast(&row), + row_length, &row_indices[0]); } compress(); diff --git a/deal.II/source/multigrid/mg_tools.cc b/deal.II/source/multigrid/mg_tools.cc index 03d20c9650..026398b526 100644 --- a/deal.II/source/multigrid/mg_tools.cc +++ b/deal.II/source/multigrid/mg_tools.cc @@ -1654,8 +1654,6 @@ namespace MGTools BlockSparseMatrix &matrix, const bool preserve_symmetry) { - const unsigned int blocks = matrix.n_block_rows(); - Assert (matrix.n_block_rows() == matrix.n_block_cols(), ExcNotQuadratic()); Assert (matrix.get_sparsity_pattern().get_row_indices() ==