]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add locally_owned_range_indices and locally_owned_domain_indices
authorESeNonFossiIo <esenonfossiio@gmail.com>
Tue, 12 Apr 2016 20:09:22 +0000 (22:09 +0200)
committerESeNonFossiIo <esenonfossiio@gmail.com>
Thu, 14 Apr 2016 08:41:23 +0000 (10:41 +0200)
include/deal.II/lac/petsc_parallel_sparse_matrix.h
source/lac/petsc_parallel_sparse_matrix.cc

index b97810e8c87eb0f6270683b677f850c5908ed171..fd5905527fc13ce8f97b46fd297be4fe666daf0d 100644 (file)
@@ -379,6 +379,19 @@ namespace PETScWrappers
       PetscScalar matrix_scalar_product (const Vector &u,
                                          const Vector &v) const;
 
+       /**
+        * Return the partitioning of the domain space of this matrix, i.e., the
+        * partitioning of the vectors this matrix has to be multiplied with.
+        */
+       IndexSet locally_owned_domain_indices() const;
+
+       /**
+        * Return the partitioning of the range space of this matrix, i.e., the
+        * partitioning of the vectors that are result from matrix-vector
+        * products.
+        */
+       IndexSet locally_owned_range_indices() const;
+                                         
     private:
 
       /**
index 6aff059d3cc3381435ddb6dbc752afb17afb072e..c2837beb54270bb16d329b7eea149da4f65d63b4 100644 (file)
@@ -890,6 +890,42 @@ namespace PETScWrappers
       return u*tmp;
     }
 
+    IndexSet
+    SparseMatrix::locally_owned_domain_indices () const
+    {
+      PetscInt n_rows, n_cols, min, max;
+      PetscErrorCode ierr;
+      IS* rows = nullptr;
+      IS* cols = nullptr;
+      
+      ierr = MatGetSize (matrix, &n_rows, &n_cols);
+      ierr = MatGetOwnershipIS(matrix, rows, cols);
+      ierr = ISGetMinMax(*rows, &min, &max);
+
+      IndexSet locally_owned_domain_indices(n_rows);
+      locally_owned_domain_indices.add_range(min, max);
+      
+      return locally_owned_domain_indices;
+    }
+
+    IndexSet
+    SparseMatrix::locally_owned_range_indices () const
+    {
+      PetscInt n_rows, n_cols, min, max;
+      PetscErrorCode ierr;
+      IS* rows = nullptr;
+      IS* cols = nullptr;
+      
+      ierr = MatGetSize (matrix, &n_rows, &n_cols);
+      ierr = MatGetOwnershipIS(matrix, rows, cols);
+      ierr = ISGetMinMax(*cols, &min, &max);
+      
+      IndexSet locally_owned_range_indices(n_cols);
+      locally_owned_range_indices.add_range(min, max);
+      
+      return locally_owned_range_indices;
+    }
+    
   }
 }
 

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.