From 929bf225abf528102281e2764c488b7101eb539f Mon Sep 17 00:00:00 2001 From: "kainan.wang" Date: Sun, 7 Apr 2013 06:05:40 +0000 Subject: [PATCH] Fix several conversion warnings git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29209 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/exceptions.h | 9 +++++++++ deal.II/include/deal.II/base/partitioner.h | 4 +++- deal.II/include/deal.II/dofs/dof_handler.h | 2 +- deal.II/include/deal.II/lac/block_indices.h | 14 +++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/deal.II/include/deal.II/base/exceptions.h b/deal.II/include/deal.II/base/exceptions.h index 82bdec6f35..9e979c178f 100644 --- a/deal.II/include/deal.II/base/exceptions.h +++ b/deal.II/include/deal.II/base/exceptions.h @@ -752,6 +752,15 @@ namespace StandardExceptions << "Number " << arg1 << " must be larger or equal " << arg2); + /** + * A generic exception definition for the ExcLowerRange above. + */ + template + DeclException2 (ExcLowerRangeType, + T, T, + << "Number " << arg1 << " must be larger or equal " + << arg2); + /** * This exception indicates that the first argument should be an * integer multiple of the second, but is not. diff --git a/deal.II/include/deal.II/base/partitioner.h b/deal.II/include/deal.II/base/partitioner.h index 7a7b23c18f..777b7a71a5 100644 --- a/deal.II/include/deal.II/base/partitioner.h +++ b/deal.II/include/deal.II/base/partitioner.h @@ -406,7 +406,9 @@ namespace Utilities unsigned int Partitioner::local_size () const { - return local_range_data.second - local_range_data.first; + types::global_dof_index size= local_range_data.second - local_range_data.first; + Assert(size<=UINT32_MAX, ExcNotImplemented()); + return static_cast(size); } diff --git a/deal.II/include/deal.II/dofs/dof_handler.h b/deal.II/include/deal.II/dofs/dof_handler.h index 16bd808a8a..e293946f1e 100644 --- a/deal.II/include/deal.II/dofs/dof_handler.h +++ b/deal.II/include/deal.II/dofs/dof_handler.h @@ -852,7 +852,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcNewNumbersNotConsecutive, - int, + types::global_dof_index, << "The given list of new dof indices is not consecutive: " << "the index " << arg1 << " does not exist."); /** diff --git a/deal.II/include/deal.II/lac/block_indices.h b/deal.II/include/deal.II/lac/block_indices.h index 7ab39f3198..d8f5d0ba84 100644 --- a/deal.II/include/deal.II/lac/block_indices.h +++ b/deal.II/include/deal.II/lac/block_indices.h @@ -125,7 +125,7 @@ public: /** * The size of the @p ith block. */ - size_type block_size (const size_type i) const; + size_type block_size (const unsigned int i) const; //@} @@ -227,13 +227,13 @@ inline LogStream & operator << (LogStream &s, const BlockIndices &bi) { - const std::size_t n = bi.size(); + const unsigned int n = bi.size(); s << n << ":["; // Write first size without leading space if (n>0) s << bi.block_size(0); // Write all other sizes - for (std::size_t i=1; i" << bi.total_size(); return s; @@ -406,8 +406,8 @@ inline std::pair BlockIndices::global_to_local (const size_type i) const { - Assert (i 0, ExcLowerRange(i, 1)); + Assert (i(i, 0, total_size())); + Assert (n_blocks > 0, ExcLowerRangeType(i, size_type(1))); unsigned int block = n_blocks-1; while (i < start_indices[block]) @@ -425,7 +425,7 @@ BlockIndices::local_to_global (const unsigned int block, { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); Assert (index < start_indices[block+1]-start_indices[block], - ExcIndexRange (index, 0, start_indices[block+1]-start_indices[block])); + ExcIndexRangeType (index, 0, start_indices[block+1]-start_indices[block])); return start_indices[block]+index; } @@ -452,7 +452,7 @@ BlockIndices::total_size () const inline BlockIndices::size_type -BlockIndices::block_size (const size_type block) const +BlockIndices::block_size (const unsigned int block) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); return start_indices[block+1]-start_indices[block]; -- 2.39.5