From 8ab9aef17f0319146d2252cb5987dec49fb7ee04 Mon Sep 17 00:00:00 2001 From: turcksin Date: Wed, 10 Apr 2013 23:12:23 +0000 Subject: [PATCH] Fix some conversion warnings. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29252 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/block_matrix_base.h | 120 +++++++++--------- .../include/deal.II/multigrid/mg_transfer.h | 2 +- deal.II/source/lac/constraint_matrix.cc | 6 +- .../source/multigrid/mg_transfer_component.cc | 4 +- deal.II/source/numerics/matrix_tools.cc | 15 ++- .../source/numerics/point_value_history.cc | 10 +- 6 files changed, 77 insertions(+), 80 deletions(-) diff --git a/deal.II/include/deal.II/lac/block_matrix_base.h b/deal.II/include/deal.II/lac/block_matrix_base.h index 18cfc16e5e..803501437c 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_matrix_base.h @@ -443,8 +443,8 @@ public: * given coordinates. */ BlockType & - block (const size_type row, - const size_type column); + block (const unsigned int row, + const unsigned int column); /** @@ -453,8 +453,8 @@ public: * constant objects. */ const BlockType & - block (const size_type row, - const size_type column) const; + block (const unsigned int row, + const unsigned int column) const; /** * Return the dimension of the @@ -479,7 +479,7 @@ public: * sparsity pattern is presently * associated to this matrix. */ - size_type n_block_rows () const; + unsigned int n_block_rows () const; /** * Return the number of blocks in @@ -487,7 +487,7 @@ public: * sparsity pattern is presently * associated to this matrix. */ - size_type n_block_cols () const; + unsigned int n_block_cols () const; /** * Set the element (i,j) @@ -1336,7 +1336,7 @@ namespace BlockMatrixIterators // find the first block that does // have an entry in this row - for (size_type bc=0; bcn_block_cols(); ++bc) + for (unsigned int bc=0; bcn_block_cols(); ++bc) { base_iterator = matrix->block(indices.first, bc).begin(indices.second); @@ -1740,8 +1740,8 @@ BlockMatrixBase & BlockMatrixBase:: copy_from (const BlockMatrixType &source) { - for (size_type r=0; r::memory_consumption () const MemoryConsumption::memory_consumption(column_indices)+ MemoryConsumption::memory_consumption(column_values); - for (size_type r=0; rsub_objects[r][c]; mem += MemoryConsumption::memory_consumption(*p); @@ -1777,8 +1777,8 @@ inline void BlockMatrixBase::clear () { - for (size_type r=0; rsub_objects[r][c]; this->sub_objects[r][c] = 0; @@ -1795,8 +1795,8 @@ BlockMatrixBase::clear () template inline typename BlockMatrixBase::BlockType & -BlockMatrixBase::block (const size_type row, - const size_type column) +BlockMatrixBase::block (const unsigned int row, + const unsigned int column) { Assert (row::block (const size_type row, template inline const typename BlockMatrixBase::BlockType & -BlockMatrixBase::block (const size_type row, - const size_type column) const +BlockMatrixBase::block (const unsigned int row, + const unsigned int column) const { Assert (row::n () const template inline -typename BlockMatrixBase::size_type +unsigned int BlockMatrixBase::n_block_cols () const { return column_block_indices.size(); @@ -1855,7 +1855,7 @@ BlockMatrixBase::n_block_cols () const template inline -typename BlockMatrixBase::size_type +unsigned int BlockMatrixBase::n_block_rows () const { return row_block_indices.size(); @@ -1980,7 +1980,7 @@ BlockMatrixBase::set (const size_type row, // through all of them. if (column_indices[0].size() < n_cols) { - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) { column_indices[i].resize(n_cols); column_values[i].resize(n_cols); @@ -1989,7 +1989,7 @@ BlockMatrixBase::set (const size_type row, // Reset the number of added elements // in each block to zero. - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -2021,7 +2021,7 @@ BlockMatrixBase::set (const size_type row, // If in debug mode, do a check whether // the right length has been obtained. size_type length = 0; - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2033,7 +2033,7 @@ BlockMatrixBase::set (const size_type row, // the individual blocks! const std::pair row_index = this->row_block_indices.global_to_local (row); - for (size_type block_col=0; block_col::add (const size_type row, // through all of them. if (column_indices[0].size() < n_cols) { - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) { column_indices[i].resize(n_cols); column_values[i].resize(n_cols); @@ -2234,7 +2234,7 @@ BlockMatrixBase::add (const size_type row, // Reset the number of added elements // in each block to zero. - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -2266,7 +2266,7 @@ BlockMatrixBase::add (const size_type row, // If in debug mode, do a check whether // the right length has been obtained. size_type length = 0; - for (size_type i=0; in_block_cols(); ++i) + for (unsigned int i=0; in_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2278,7 +2278,7 @@ BlockMatrixBase::add (const size_type row, // the individual blocks! const std::pair row_index = this->row_block_indices.global_to_local (row); - for (size_type block_col=0; block_col::add (const value_type factor, (factor == 0)) return; - for (size_type row=0; row::compress (::dealii::VectorOperation::values operation) { - for (size_type r=0; r::operator *= (const value_type factor) Assert (n_block_cols() != 0, ExcNotInitialized()); Assert (n_block_rows() != 0, ExcNotInitialized()); - for (size_type r=0; r::operator /= (const value_type factor) const value_type factor_inv = 1. / factor; - for (size_type r=0; r::vmult_add (BlockVectorType &dst, Assert (src.n_blocks() == n_block_cols(), ExcDimensionMismatch(src.n_blocks(), n_block_cols())); - for (size_type row=0; row::Tvmult_add (BlockVectorType &dst, Assert (src.n_blocks() == n_block_rows(), ExcDimensionMismatch(src.n_blocks(), n_block_rows())); - for (size_type row=0; row::matrix_norm_square (const BlockVectorType &v) const ExcDimensionMismatch(v.n_blocks(), n_block_rows())); value_type norm_sqr = 0; - for (size_type row=0; row::print (std::ostream &out, const bool alternative_output) const { - for (size_type row=0; row::collect_sizes () // first find out the row sizes // from the first block column - for (size_type r=0; rn_block_rows(); ++r) + for (unsigned int r=0; rn_block_rows(); ++r) row_sizes[r] = sub_objects[r][0]->m(); // then check that the following // block columns have the same // sizes - for (size_type c=1; cn_block_cols(); ++c) - for (size_type r=0; rn_block_rows(); ++r) + for (unsigned int c=1; cn_block_cols(); ++c) + for (unsigned int r=0; rn_block_rows(); ++r) Assert (row_sizes[r] == sub_objects[r][c]->m(), ExcIncompatibleRowNumbers (r,0,r,c)); @@ -2876,10 +2876,10 @@ BlockMatrixBase::collect_sizes () // then do the same with the columns - for (size_type c=0; cn_block_cols(); ++c) + for (unsigned int c=0; cn_block_cols(); ++c) col_sizes[c] = sub_objects[0][c]->n(); - for (size_type r=1; rn_block_rows(); ++r) - for (size_type c=0; cn_block_cols(); ++c) + for (unsigned int r=1; rn_block_rows(); ++r) + for (unsigned int c=0; cn_block_cols(); ++c) Assert (col_sizes[c] == sub_objects[r][c]->n(), ExcIncompatibleRowNumbers (0,c,r,c)); @@ -2894,8 +2894,8 @@ template void BlockMatrixBase::prepare_add_operation () { - for (size_type row=0; row void BlockMatrixBase::prepare_set_operation () { - for (size_type row=0; row sizes; + std::vector sizes; /** * Sparsity patterns for transfer diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index 108f6b5dee..d37393aa33 100644 --- a/deal.II/source/lac/constraint_matrix.cc +++ b/deal.II/source/lac/constraint_matrix.cc @@ -642,7 +642,11 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // store for each line of the matrix its new line number after // compression. If the shift is -1, this line will be condensed away +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE std::vector new_line; +#else + std::vector new_line; +#endif new_line.reserve (uncondensed.n_rows()); @@ -1504,7 +1508,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) else // distribute entry at irregular row @p{row} and // irregular column @p{global_col} - { for (size_type int p=0; + { for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, diff --git a/deal.II/source/multigrid/mg_transfer_component.cc b/deal.II/source/multigrid/mg_transfer_component.cc index 8d920f126e..a6c41c3e80 100644 --- a/deal.II/source/multigrid/mg_transfer_component.cc +++ b/deal.II/source/multigrid/mg_transfer_component.cc @@ -524,11 +524,11 @@ void MGTransferComponentBase::build_matrices ( ende = prolongation_matrices[level]->block(iblock,jblock).end(i); for (; anfang != ende; ++anfang) { - const unsigned int column_number = anfang->column(); + const types::global_dof_index column_number = anfang->column(); //convert global indices into local ones const BlockIndices block_indices_coarse (dofs_per_component[level]); - const unsigned int global_j = block_indices_coarse.local_to_global(iblock, column_number); + const types::global_dof_index global_j = block_indices_coarse.local_to_global(iblock, column_number); std::set::const_iterator found_dof = boundary_indices[level].find(global_j); diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index 9b33964c32..4d95a80303 100644 --- a/deal.II/source/numerics/matrix_tools.cc +++ b/deal.II/source/numerics/matrix_tools.cc @@ -1236,7 +1236,7 @@ namespace MatrixCreator #ifdef DEBUG if (true) { - unsigned int max_element = 0; + types::global_dof_index max_element = 0; for (std::vector::const_iterator i=dof_to_boundary_mapping.begin(); i!=dof_to_boundary_mapping.end(); ++i) if ((*i != hp::DoFHandler::invalid_dof_index) && @@ -1960,7 +1960,7 @@ namespace MatrixTools return; - const unsigned int n_dofs = matrix.m(); + const types::global_dof_index n_dofs = matrix.m(); // if a diagonal entry is zero // later, then we use another @@ -2048,7 +2048,7 @@ namespace MatrixTools q = matrix.begin(dof_number)+1; q != matrix.end(dof_number); ++q) { - const unsigned int row = q->column(); + const types::global_dof_index row = q->column(); // find the position of // element @@ -2125,7 +2125,7 @@ namespace MatrixTools return; - const unsigned int n_dofs = matrix.m(); + const types::global_dof_index n_dofs = matrix.m(); // if a diagonal entry is zero // later, then we use another @@ -2290,7 +2290,7 @@ namespace MatrixTools // get the number of the column in this row in which a // nonzero entry is. this is also the row of the transpose // block which has an entry in the interesting row - const unsigned int row = q->column(); + const types::global_dof_index row = q->column(); // find the position of element (row,dof_number) in this // block (not in the transpose one). note that we have to @@ -2389,7 +2389,7 @@ namespace MatrixTools // matrix that we can see. if we can't // find such an entry, take one PetscScalar average_nonzero_diagonal_entry = 1; - for (unsigned int i=local_range.first; i > block_boundary_values(n_blocks); { - int offset = 0, block=0; + int block = 0; + dealii::types::global_dof_index offset = 0; for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); diff --git a/deal.II/source/numerics/point_value_history.cc b/deal.II/source/numerics/point_value_history.cc index 70a15161f3..03859e48e1 100644 --- a/deal.II/source/numerics/point_value_history.cc +++ b/deal.II/source/numerics/point_value_history.cc @@ -270,11 +270,7 @@ void PointValueHistory std::vector local_dof_indices (dof_handler->get_fe ().dofs_per_cell); -#ifndef deal_ii_use_large_index_type - std::vector new_solution_indices; -#else - std::vector new_solution_indices; -#endif + std::vector new_solution_indices; current_cell->get_dof_indices (local_dof_indices); // there is an implicit assumption here // that all the closest support point to @@ -419,11 +415,7 @@ void PointValueHistory for (unsigned int point = 0; point < locations.size (); point++) { current_cell[point]->get_dof_indices (local_dof_indices); -#ifndef deal_ii_use_large_index_type std::vector new_solution_indices; -#else - std::vector new_solution_indices; -#endif for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++) { -- 2.39.5