]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Have reinit() have another argument.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Mar 2004 19:51:35 +0000 (19:51 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Mar 2004 19:51:35 +0000 (19:51 +0000)
git-svn-id: https://svn.dealii.org/trunk@8850 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_vector_base.h
deal.II/lac/source/petsc_vector.cc
deal.II/lac/source/petsc_vector_base.cc

index bebc71cf2dab33ab7d9ab3838f5fb995297f60f4..65b78c85c1d6d5b566fb75cae83b4c74775c2daf 100644 (file)
@@ -210,7 +210,7 @@ namespace PETScWrappers
 
                                        /**
                                         * Change the dimension of the vector
-                                        * to @p{N}. It is unspecified how
+                                        * to @arg N. It is unspecified how
                                         * resizing the vector affects the
                                         * memory allocation of this object;
                                         * i.e., it is not guaranteed that
@@ -220,13 +220,21 @@ namespace PETScWrappers
                                         * the same amount of memory is used
                                         * for less data.
                                         *
-                                        * On @p{fast==false}, the vector is
+                                        * On @arg fast is false, the vector is
                                         * filled by zeros. Otherwise, the
                                         * elements are left an unspecified
                                         * state.
+                                        *
+                                        * For parallel vectors, @arg
+                                        * local_size denotes how many of the
+                                        * @arg N values shall be stored
+                                        * locally on the present process. This
+                                        * argument is ignored for sequantial
+                                        * vectors.
                                         */ 
       void reinit (const unsigned int N,
-                   const bool         fast=false);
+                   const bool         fast=false,
+                   const unsigned int local_size = 0);
     
                                        /**
                                         * Change the dimension to that of the
index 14794f06573ec2347ca1b079656b0552ac4c8c5c..43484710b110c9d32e71aacd628cb11b891e18ef 100644 (file)
@@ -46,8 +46,10 @@ namespace PETScWrappers
   
   void
   Vector::create_vector (const unsigned int n,
-                         const unsigned int /*local_size*/)
+                         const unsigned int local_size)
   {
+    Assert (local_size < n, ExcIndexRange (local_size, 0, n));
+    
     const int ierr
       = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
index bf7919c8aa43ed9323a6cb92c5c30f373fab82d3..b074a01fdbb8072ba6521fda42efd9d98e908226 100644 (file)
@@ -50,11 +50,12 @@ namespace PETScWrappers
 
   void
   VectorBase::reinit (const unsigned int n,
-                      const bool         fast)
+                      const bool         fast,
+                      const unsigned int local_sz)
   {
                                      // only do something if the sizes
                                      // mismatch
-    if (size() != n)
+    if ((size() != n) || (local_size() != local_sz))
       {
                                          // FIXME: I'd like to use this here,
                                          // but somehow it leads to odd errors
@@ -68,7 +69,7 @@ namespace PETScWrappers
         ierr = VecDestroy (vector);
         AssertThrow (ierr == 0, ExcPETScError(ierr));
 
-        create_vector (n);
+        create_vector (n, local_sz);
       }
 
                                      // finally clear the new vector if so

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.