]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Better document TrilinosWrappers::SparsityPattern::row_length(). 6916/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 11 Jul 2018 19:26:03 +0000 (13:26 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 11 Jul 2018 19:26:03 +0000 (13:26 -0600)
include/deal.II/lac/trilinos_sparsity_pattern.h
source/lac/trilinos_sparsity_pattern.cc

index a61b358c21d063afc6fd49928ba8b325e69fe665..1d053e9068fef5eea2150e6e02c0897767c4f231 100644 (file)
@@ -910,7 +910,12 @@ namespace TrilinosWrappers
     n_nonzero_elements() const;
 
     /**
-     * Number of entries in a specific row.
+     * Return the number of entries in the given row.
+     *
+     * In a parallel context, the row in question may of course not be
+     * stored on the current processor, and in that case it is not
+     * possible to query the number of entries in it. In that case,
+     * the returned value is `static_cast<size_type>(-1)`.
      */
     size_type
     row_length(const size_type row) const;
index 6960fc94d7aa3d7a923fe5ea5688b0fd07e6d2b1..7f698138eb9450b2ff5f7c84676a14095e01ce25 100644 (file)
@@ -1020,19 +1020,17 @@ namespace TrilinosWrappers
   {
     Assert(row < n_rows(), ExcInternalError());
 
-    // get a representation of the
-    // present row
-    TrilinosWrappers::types::int_type ncols = -1;
+    // Get a representation of the where the present row is located on
+    // the current processor
     TrilinosWrappers::types::int_type local_row =
       graph->LRID(static_cast<TrilinosWrappers::types::int_type>(row));
 
-    // on the processor who owns this
-    // row, we'll have a non-negative
-    // value.
+    // On the processor who owns this row, we'll have a non-negative
+    // value for `local_row` and can ask for the length of the row.
     if (local_row >= 0)
-      ncols = graph->NumMyIndices(local_row);
-
-    return static_cast<size_type>(ncols);
+      return graph->NumMyIndices(local_row);
+    else
+      return static_cast<size_type>(-1);
   }
 
 

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.