From 22197e202bcbc441ca043ab3ed3e3a8ca1250c7b Mon Sep 17 00:00:00 2001 From: turcksin Date: Thu, 4 Apr 2013 19:16:40 +0000 Subject: [PATCH] Fix some conversion warnings. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29185 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/index_set.h | 8 +-- .../include/deal.II/base/memory_consumption.h | 2 +- deal.II/include/deal.II/base/partitioner.h | 2 +- deal.II/include/deal.II/base/utilities.h | 2 +- deal.II/include/deal.II/fe/fe.h | 2 +- deal.II/include/deal.II/hp/dof_objects.h | 14 +++-- .../deal.II/lac/block_sparsity_pattern.h | 6 +- .../include/deal.II/matrix_free/dof_info.h | 14 ++--- .../deal.II/matrix_free/dof_info.templates.h | 56 +++++++++---------- .../matrix_free/matrix_free.templates.h | 4 +- 10 files changed, 56 insertions(+), 54 deletions(-) diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index 3dce70cade..ef1c16bb18 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -160,7 +160,7 @@ public: * local_index obviously needs to be less * than n_elements(). */ - types::global_dof_index nth_index_in_set (const types::global_dof_index local_index) const; + types::global_dof_index nth_index_in_set (const unsigned int local_index) const; /** * Return the how-manyth element of this @@ -172,7 +172,7 @@ public: * a member of this index set, i.e. if * is_element(global_index) is false. */ - types::global_dof_index index_within_set (const types::global_dof_index global_index) const; + unsigned int index_within_set (const types::global_dof_index global_index) const; /** * Each index set can be @@ -868,7 +868,7 @@ IndexSet::n_elements () const inline types::global_dof_index -IndexSet::nth_index_in_set (const types::global_dof_index n) const +IndexSet::nth_index_in_set (const unsigned int n) const { // to make this call thread-safe, compress() // must not be called through this function @@ -918,7 +918,7 @@ IndexSet::nth_index_in_set (const types::global_dof_index n) const inline -types::global_dof_index +unsigned int IndexSet::index_within_set (const types::global_dof_index n) const { // to make this call thread-safe, compress() diff --git a/deal.II/include/deal.II/base/memory_consumption.h b/deal.II/include/deal.II/base/memory_consumption.h index e9c854c4c6..76cfc4d9d6 100644 --- a/deal.II/include/deal.II/base/memory_consumption.h +++ b/deal.II/include/deal.II/base/memory_consumption.h @@ -530,7 +530,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { std::size_t mem = sizeof(std::vector); - const unsigned int n = v.size(); + const unsigned int n = static_cast(v.size()); for (unsigned int i=0; i(global_index - local_range_data.first); else if (is_ghost_entry (global_index)) return (local_size() + ghost_indices_data.index_within_set (global_index)); diff --git a/deal.II/include/deal.II/base/utilities.h b/deal.II/include/deal.II/base/utilities.h index 0059f45bb5..c76ff1d3f0 100644 --- a/deal.II/include/deal.II/base/utilities.h +++ b/deal.II/include/deal.II/base/utilities.h @@ -749,7 +749,7 @@ namespace Utilities Assert (last - first >= 0, ExcMessage ("The given iterators do not satisfy the proper ordering.")); - unsigned int len = last-first; + unsigned int len = static_cast(last-first); if (len==0) return first; diff --git a/deal.II/include/deal.II/fe/fe.h b/deal.II/include/deal.II/fe/fe.h index 851795456b..7a671ccbea 100644 --- a/deal.II/include/deal.II/fe/fe.h +++ b/deal.II/include/deal.II/fe/fe.h @@ -2815,7 +2815,7 @@ inline unsigned int FiniteElement::element_multiplicity (const unsigned int index) const { - return base_to_block_indices.block_size(index); + return static_cast(base_to_block_indices.block_size(index)); } diff --git a/deal.II/include/deal.II/hp/dof_objects.h b/deal.II/include/deal.II/hp/dof_objects.h index 3c938ef24e..da2d2b296b 100644 --- a/deal.II/include/deal.II/hp/dof_objects.h +++ b/deal.II/include/deal.II/hp/dof_objects.h @@ -313,8 +313,9 @@ namespace internal if (*pointer == fe_index) return *(pointer + 1 + local_index); else - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1; + pointer += static_cast( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object() + 1); } } } @@ -606,8 +607,8 @@ namespace internal // an exception if we can't // find a set for this // particular fe_index - const unsigned int starting_offset = dof_offsets[obj_index]; - const types::global_dof_index *pointer = &dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_offsets[obj_index]; + const types::global_dof_index *pointer = &dofs[starting_offset]; while (true) { if (*pointer == numbers::invalid_dof_index) @@ -616,8 +617,9 @@ namespace internal else if (*pointer == fe_index) return true; else - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1; + pointer += static_cast( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object()+1); } } } diff --git a/deal.II/include/deal.II/lac/block_sparsity_pattern.h b/deal.II/include/deal.II/lac/block_sparsity_pattern.h index cad22c9c5f..2de9afd2d9 100644 --- a/deal.II/include/deal.II/lac/block_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/block_sparsity_pattern.h @@ -342,7 +342,7 @@ public: * all the blocks that form this * row. */ - size_type row_length (const size_type row) const; + unsigned int row_length (const size_type row) const; /** * Return the number of nonzero @@ -1302,14 +1302,14 @@ BlockSparsityPatternBase::exists (const size_type i, template inline -typename BlockSparsityPatternBase::size_type +unsigned int BlockSparsityPatternBase:: row_length (const size_type row) const { const std::pair row_index = row_indices.global_to_local (row); - size_type c = 0; + unsigned int c = 0; for (size_type b=0; brow_length (row_index.second); diff --git a/deal.II/include/deal.II/matrix_free/dof_info.h b/deal.II/include/deal.II/matrix_free/dof_info.h index 96dcad8291..63552c1fde 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.h @@ -178,7 +178,7 @@ namespace internal */ void compute_renumber_serial (const std::vector &boundary_cells, const SizeInfo &size_info, - std::vector &renumbering); + std::vector &renumbering); /** * Reorganizes cells in the hp case without parallelism such that all @@ -187,7 +187,7 @@ namespace internal * DoFHandlers. */ void compute_renumber_hp_serial (SizeInfo &size_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells); /** @@ -197,7 +197,7 @@ namespace internal */ void compute_renumber_parallel (const std::vector &boundary_cells, SizeInfo &size_info, - std::vector &renumbering); + std::vector &renumbering); /** * This method reorders the way cells are gone through based on a given @@ -206,7 +206,7 @@ namespace internal * vectorization. */ void reorder_cells (const SizeInfo &size_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &constraint_pool_row_index, const std::vector &irregular_cells, const unsigned int vectorization_length); @@ -237,7 +237,7 @@ namespace internal void make_thread_graph_partition_color (SizeInfo &size_info, TaskInfo &task_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells, const bool hp_bool); @@ -258,7 +258,7 @@ namespace internal void make_thread_graph_partition_partition (SizeInfo &size_info, TaskInfo &task_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells, const bool hp_bool); @@ -271,7 +271,7 @@ namespace internal void make_connectivity_graph (const SizeInfo &size_info, const TaskInfo &task_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &irregular_cells, const bool do_blocking, CompressedSimpleSparsityPattern &connectivity) const; diff --git a/deal.II/include/deal.II/matrix_free/dof_info.templates.h b/deal.II/include/deal.II/matrix_free/dof_info.templates.h index ee57724793..ebb8577a20 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.templates.h @@ -178,7 +178,7 @@ namespace internal const unsigned int n_mpi_procs = vector_partitioner->n_mpi_processes(); const types::global_dof_index first_owned = vector_partitioner->local_range().first; const types::global_dof_index last_owned = vector_partitioner->local_range().second; - const unsigned int n_owned = last_owned - first_owned; + const types::global_dof_index n_owned = last_owned - first_owned; std::pair constraint_iterator (0,0); unsigned int dofs_this_cell = (cell_active_fe_index.empty()) ? @@ -208,7 +208,7 @@ namespace internal // to actually resolve the constraint entries const std::vector > &entries = *entries_ptr; - const unsigned int n_entries = entries.size(); + const types::global_dof_index n_entries = entries.size(); if (n_entries == 1 && std::fabs(entries[0].second-1.)<1e-14) { current_dof = entries[0].first; @@ -325,7 +325,7 @@ no_constraint: Assert (boundary_cells.size() < row_starts.size(), ExcInternalError()); // sort ghost dofs and compress out duplicates - const unsigned int n_owned = (vector_partitioner->local_range().second- + const types::global_dof_index n_owned = (vector_partitioner->local_range().second- vector_partitioner->local_range().first); const size_dof n_ghosts = ghost_dofs.size(); unsigned int n_unique_ghosts= 0; @@ -435,9 +435,9 @@ no_constraint: void DoFInfo::compute_renumber_serial (const std::vector &boundary_cells, const SizeInfo &size_info, - std::vector &renumbering) + std::vector &renumbering) { - std::vector reverse_numbering (size_info.n_active_cells, + std::vector reverse_numbering (size_info.n_active_cells, numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; j &renumbering, + std::vector &renumbering, std::vector &irregular_cells) { if (max_fe_index < 2) @@ -551,9 +551,9 @@ no_constraint: void DoFInfo::compute_renumber_parallel (const std::vector &boundary_cells, SizeInfo &size_info, - std::vector &renumbering) + std::vector &renumbering) { - std::vector reverse_numbering (size_info.n_active_cells, + std::vector reverse_numbering (size_info.n_active_cells, numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; j &renumbering, + const std::vector &renumbering, const std::vector &constraint_pool_row_index, const std::vector &irregular_cells, const unsigned int vectorization_length) @@ -810,11 +810,11 @@ no_constraint: void DoFInfo::make_thread_graph_partition_color - (SizeInfo &size_info, - TaskInfo &task_info, - std::vector &renumbering, - std::vector &irregular_cells, - const bool hp_bool) + (SizeInfo &size_info, + TaskInfo &task_info, + std::vector &renumbering, + std::vector &irregular_cells, + const bool hp_bool) { if (size_info.n_macro_cells == 0) return; @@ -923,12 +923,12 @@ no_constraint: // yet assigned a partition. std::vector cell_partition(task_info.n_blocks, size_info.n_macro_cells); - std::vector neighbor_list; - std::vector neighbor_neighbor_list; + std::vector neighbor_list; + std::vector neighbor_neighbor_list; // In element j of this variable, one puts the old number of the block // that should be the jth block in the new numeration. - std::vector partition_list (task_info.n_blocks,0); + std::vector partition_list (task_info.n_blocks,0); std::vector partition_color_list(task_info.n_blocks,0); // This vector points to the start of each partition. @@ -1121,7 +1121,7 @@ no_constraint: // check that the renumbering is one-to-one #ifdef DEBUG { - std::vector sorted_renumbering (renumbering); + std::vector sorted_renumbering (renumbering); std::sort(sorted_renumbering.begin(), sorted_renumbering.end()); for (unsigned int i=0; i &renumbering, - std::vector &irregular_cells, - const bool hp_bool) + (SizeInfo &size_info, + TaskInfo &task_info, + std::vector &renumbering, + std::vector &irregular_cells, + const bool hp_bool) { if (size_info.n_macro_cells == 0) return; @@ -1181,7 +1181,7 @@ no_constraint: // In element j of this variable, one puts the old number of the block // that should be the jth block in the new numeration. std::vector partition_list(size_info.n_active_cells,0); - std::vector partition_partition_list(size_info.n_active_cells,0); + std::vector partition_partition_list(size_info.n_active_cells,0); // This vector points to the start of each partition. std::vector partition_size(2,0); @@ -1436,7 +1436,7 @@ not_connect: missing_macros = 0; std::vector remaining_per_macro_cell (max_fe_index); - std::vector > + std::vector > renumbering_fe_index; unsigned int cell; bool filled = true; @@ -1688,7 +1688,7 @@ not_connect: DoFInfo::make_connectivity_graph (const SizeInfo &size_info, const TaskInfo &task_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &irregular_cells, const bool do_blocking, CompressedSimpleSparsityPattern &connectivity) const @@ -1741,9 +1741,9 @@ not_connect: scratch.insert(scratch.end(), begin_indices(block), end_indices(block)); std::sort(scratch.begin(), scratch.end()); - const unsigned int n_unique = + const types::global_dof_index n_unique = std::unique(scratch.begin(), scratch.end())-scratch.begin(); - for (unsigned int i=0; i::initialize_indices // reorganize the indices in order to overlap communication in MPI with // computations: Place all cells with ghost indices into one chunk. Also // reorder cells so that we can parallelize by threads - std::vector renumbering; + std::vector renumbering; if (task_info.use_multithreading == true) { dof_info[0].compute_renumber_parallel (boundary_cells, size_info, @@ -650,7 +650,7 @@ void MatrixFree::initialize_indices // operations will then be done simultaneously). #ifdef DEBUG { - std::vector sorted_renumbering (renumbering); + std::vector sorted_renumbering (renumbering); std::sort (sorted_renumbering.begin(), sorted_renumbering.end()); for (unsigned int i=0; i