]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added IndexSet constructor with Epetra_Map
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 24 Jul 2015 17:43:17 +0000 (19:43 +0200)
committerTimo Heister <timo.heister@gmail.com>
Sun, 26 Jul 2015 21:42:23 +0000 (17:42 -0400)
include/deal.II/base/index_set.h
include/deal.II/lac/trilinos_vector.h

index b8dd4bd2362669cd007c7ebd10fb12cc4b0f9da5..3549ce1d566cbca0d48b04f7e692a9722aacdfe4 100644 (file)
@@ -88,6 +88,14 @@ public:
    */
   explicit IndexSet (const types::global_dof_index size);
 
+
+#ifdef DEAL_II_WITH_TRILINOS
+  /**
+   * Constructor from a trilinos Epetra_Map.
+   */
+  IndexSet(const Epetra_Map &map);
+#endif
+
   /**
    * Remove all indices from this index set. The index set retains its size,
    * however.
@@ -534,6 +542,24 @@ IndexSet::IndexSet (const types::global_dof_index size)
 
 
 
+
+#ifdef DEAL_II_WITH_TRILINOS
+inline
+IndexSet::IndexSet (const Epetra_Map &map)
+  :
+  is_compressed (true),
+  index_space_size (map.NumGlobalElements()),
+  largest_range (numbers::invalid_unsigned_int)
+{
+  int *map_indices = map.MyGlobalElements();
+  for (int i=0; i<map.NumMyElements(); ++i)
+    add_index((size_type)map_indices[i]);
+  compress();
+}
+#endif
+
+
+
 inline
 void
 IndexSet::clear ()
@@ -544,6 +570,7 @@ IndexSet::clear ()
 }
 
 
+
 inline
 void
 IndexSet::set_size (const types::global_dof_index sz)
index 59f21c6ecb53b82f83ed69248fd91895104d0f98..a34869895f16853635edfd38f8a8527055bad256 100644 (file)
@@ -988,7 +988,7 @@ namespace internal
                                 TrilinosWrappers::MPI::Vector &v,
                                 bool fast)
       {
-        v.reinit(matrix.range_partitioner(), fast);
+        v.reinit(IndexSet(matrix.range_partitioner()), MPI_COMM_WORLD, fast);
       }
 
       template <typename Matrix>
@@ -997,7 +997,7 @@ namespace internal
                                 TrilinosWrappers::MPI::Vector &v,
                                 bool fast)
       {
-        v.reinit(matrix.domain_partitioner(), fast);
+        v.reinit(IndexSet(matrix.domain_partitioner()), MPI_COMM_WORLD, fast);
       }
     };
 
@@ -1015,7 +1015,7 @@ namespace internal
                                 TrilinosWrappers::Vector &v,
                                 bool fast)
       {
-        v.reinit(matrix.range_partitioner(), fast);
+        v.reinit(IndexSet(matrix.range_partitioner()), MPI_COMM_WORLD, fast);
       }
 
       template <typename Matrix>
@@ -1024,7 +1024,7 @@ namespace internal
                                 TrilinosWrappers::Vector &v,
                                 bool fast)
       {
-        v.reinit(matrix.domain_partitioner(), fast);
+        v.reinit(IndexSet(matrix.domain_partitioner()), MPI_COMM_WORLD, fast);
       }
     };
 

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.