]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix method on 64 bit indices 1242/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 3 Aug 2015 13:21:55 +0000 (15:21 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 3 Aug 2015 13:21:55 +0000 (15:21 +0200)
source/base/index_set.cc

index a43e8856a3ade28db6143f6ed724c825a078123b..f654da01974aac9adf42be934fee1a885d19cce8 100644 (file)
@@ -30,35 +30,56 @@ DEAL_II_NAMESPACE_OPEN
 
 
 #ifdef DEAL_II_WITH_TRILINOS
+
+// the 64-bit path uses a few different names, so put that into a separate
+// implementation
+
+#ifdef DEAL_II_WITH_64BIT_INDICES
+
 IndexSet::IndexSet (const Epetra_Map &map)
   :
   is_compressed (true),
-  index_space_size (map.NumGlobalElements()),
+  index_space_size (map.NumGlobalElements64()),
   largest_range (numbers::invalid_unsigned_int)
 {
   // For a contiguous map, we do not need to go through the whole data...
   if (map.LinearMap())
+    add_range(size_type(map.MinMyGID64()), size_type(map.MaxMyGID64()+1));
+  else
     {
-#ifndef DEAL_II_WITH_64BIT_INDICES
-      add_range(size_type(map.MinMyGID()), size_type(map.MaxMyGID()+1));
-#else
-      add_range(size_type(map.MinMyGID64()), size_type(map.MaxMyGID64()+1));
-#endif
+      const size_type n_indices = map.NumMyElements();
+      size_type *indices = (size_type *)map.MyGlobalElements64();
+      add_indices(indices, indices+n_indices);
     }
+  compress();
+}
+
+#else
+
+// this is the standard 32-bit implementation
+
+IndexSet::IndexSet (const Epetra_Map &map)
+  :
+  is_compressed (true),
+  index_space_size (map.NumGlobalElements()),
+  largest_range (numbers::invalid_unsigned_int)
+{
+  // For a contiguous map, we do not need to go through the whole data...
+  if (map.LinearMap())
+    add_range(size_type(map.MinMyGID()), size_type(map.MaxMyGID()+1));
   else
     {
       const size_type n_indices = map.NumMyElements();
-#ifndef DEAL_II_WITH_64BIT_INDICES
       unsigned int *indices = (unsigned int *)map.MyGlobalElements();
-#else
-      size_type *indices = (size_type *)map.MyGlobalElements64();
-#endif
       add_indices(indices, indices+n_indices);
     }
   compress();
 }
+
 #endif
 
+#endif // ifdef DEAL_II_WITH_TRILINOS
+
 
 
 void

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.