]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix several conversion warnings
authorKainan Wang <kennan.wong@gmail.com>
Sun, 7 Apr 2013 06:05:40 +0000 (06:05 +0000)
committerKainan Wang <kennan.wong@gmail.com>
Sun, 7 Apr 2013 06:05:40 +0000 (06:05 +0000)
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
deal.II/include/deal.II/base/partitioner.h
deal.II/include/deal.II/dofs/dof_handler.h
deal.II/include/deal.II/lac/block_indices.h

index 82bdec6f3547ca08f599fa0ce2939156c17dfce4..9e979c178f6c151298142c621d48db6905792a53 100644 (file)
@@ -752,6 +752,15 @@ namespace StandardExceptions
                   << "Number " << arg1 << " must be larger or equal "
                   << arg2);
 
+  /**
+   * A generic exception definition for the ExcLowerRange above.
+   */
+  template<typename T>
+  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.
index 7a7b23c18f8d1b4305334acc1e3402be75f397fd..777b7a71a5502d305e1afe001ab3de2e5eb36ab8 100644 (file)
@@ -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<unsigned int>(size);
     }
 
 
index 16bd808a8accc65cae9bc8d3f89e6cdc7ad1f830..e293946f1e523c534a47e5007a8debb889fdccdf 100644 (file)
@@ -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.");
   /**
index 7ab39f3198a1350a3648d8c69165a3c1851c00f6..d8f5d0ba844d265173e49824abe4ebdba063abba 100644 (file)
@@ -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<n; ++i)
+  for (unsigned int i=1; i<n; ++i)
     s << ' ' << bi.block_size(i);
   s << "]->" << bi.total_size();
   return s;
@@ -406,8 +406,8 @@ inline
 std::pair<unsigned int,BlockIndices::size_type>
 BlockIndices::global_to_local (const size_type i) const
 {
-  Assert (i<total_size(), ExcIndexRange(i, 0, total_size()));
-  Assert (n_blocks > 0, ExcLowerRange(i, 1));
+  Assert (i<total_size(), ExcIndexRangeType<size_type>(i, 0, total_size()));
+  Assert (n_blocks > 0, ExcLowerRangeType<size_type>(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<size_type> (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];

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.