]> https://gitweb.dealii.org/ - dealii.git/commitdiff
PETScWrappers::MPI::BlockVector Add missing conversion operator for const
authorStefano Zampini <stefano.zampini@gmail.com>
Sun, 27 Nov 2022 06:15:54 +0000 (09:15 +0300)
committerStefano Zampini <stefano.zampini@gmail.com>
Sun, 22 Jan 2023 11:03:03 +0000 (14:03 +0300)
include/deal.II/lac/petsc_block_vector.h
source/lac/petsc_parallel_block_vector.cc

index 71d95890531a3132021cea74c7713f36c1d21db2..670f2061d4585800d46ee1aa369e4b3f1f46ead4 100644 (file)
@@ -272,6 +272,15 @@ namespace PETScWrappers
       const MPI_Comm &
       get_mpi_communicator() const;
 
+      /**
+       * Conversion operator to gain access to the underlying PETSc type. If you
+       * do this, you cut this class off some information it may need, so this
+       * conversion operator should only be used if you know what you do. In
+       * particular, it should only be used for read-only operations into the
+       * vector.
+       */
+      operator const Vec &() const;
+
       /**
        * Return a reference to the underlying PETSc type. It can be used to
        * modify the underlying data, so use it only when you know what you
index c00e9dbdcdfbb970230bef0d25d8dd029251ec88..88360c6d8188f3bfb2cb91a7024dcd3dc2fd38d0 100644 (file)
@@ -93,6 +93,11 @@ namespace PETScWrappers
       return petsc_nest_vector;
     }
 
+    BlockVector::operator const Vec &() const
+    {
+      return petsc_nest_vector;
+    }
+
     void
     BlockVector::collect_sizes()
     {

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.