]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
A few changes that make the updated TrilinosWrappers vector classes compatible with...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Sep 2008 09:36:14 +0000 (09:36 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Sep 2008 09:36:14 +0000 (09:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@16831 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/template-arguments.in
deal.II/configure
deal.II/deal.II/include/fe/fe_values.h
deal.II/deal.II/include/numerics/matrices.h
deal.II/deal.II/source/dofs/dof_constraints.cc
deal.II/deal.II/source/fe/fe_values.cc
deal.II/deal.II/source/numerics/error_estimator.cc
deal.II/deal.II/source/numerics/matrices.all_dimensions.cc
deal.II/deal.II/source/numerics/solution_transfer.cc
deal.II/lac/source/trilinos_block_vector.cc

index 588594492192992f9f1059dab7653a2201838bf9..9548b9015d13de75a3c8288c245c7163cfa17e7f 100644 (file)
@@ -14,9 +14,11 @@ SERIAL_VECTORS := { Vector<double>;
                     BlockVector<long double>;
 
                    @DEAL_II_EXPAND_TRILINOS_VECTOR@;
+                   @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@;
                    @DEAL_II_EXPAND_PETSC_VECTOR@;
 
                    @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
+                   @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
                    @DEAL_II_EXPAND_PETSC_BLOCKVECTOR@;
                   }
 
index 3e61f2f770d6b2f44c0bc7804f2de2286b73c0ee..e7312fa5a42cf39aaf446ff85d590d8e01a1680f 100755 (executable)
@@ -722,6 +722,8 @@ DEAL_II_PETSC_MPIUNI_LIB
 DEAL_II_DEFINE_DEAL_II_USE_PETSC
 DEAL_II_EXPAND_TRILINOS_VECTOR
 DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR
+DEAL_II_EXPAND_TRILINOS_MPI_VECTOR
+DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR
 USE_CONTRIB_TRILINOS
 DEAL_II_TRILINOS_DIR
 DEAL_II_TRILINOS_SHARED
@@ -12049,6 +12051,8 @@ echo "$as_me: error: When building deal.II with shared libraries, Trilinos also
 
     DEAL_II_EXPAND_TRILINOS_VECTOR="TrilinosWrappers::Vector"
     DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR="TrilinosWrappers::BlockVector"
+    DEAL_II_EXPAND_TRILINOS_MPI_VECTOR="TrilinosWrappers::MPI::Vector"
+    DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR="TrilinosWrappers::MPI::BlockVector"
 
         if test "x$with_trilinos" = "x" ; then
       with_trilinos="yes"
@@ -14711,6 +14715,8 @@ DEAL_II_PETSC_MPIUNI_LIB!$DEAL_II_PETSC_MPIUNI_LIB$ac_delim
 DEAL_II_DEFINE_DEAL_II_USE_PETSC!$DEAL_II_DEFINE_DEAL_II_USE_PETSC$ac_delim
 DEAL_II_EXPAND_TRILINOS_VECTOR!$DEAL_II_EXPAND_TRILINOS_VECTOR$ac_delim
 DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR!$DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR$ac_delim
+DEAL_II_EXPAND_TRILINOS_MPI_VECTOR!$DEAL_II_EXPAND_TRILINOS_MPI_VECTOR$ac_delim
+DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR!$DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR$ac_delim
 USE_CONTRIB_TRILINOS!$USE_CONTRIB_TRILINOS$ac_delim
 DEAL_II_TRILINOS_DIR!$DEAL_II_TRILINOS_DIR$ac_delim
 DEAL_II_TRILINOS_SHARED!$DEAL_II_TRILINOS_SHARED$ac_delim
@@ -14735,7 +14741,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 29; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 31; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 1116ce6d8264a5a9d1eebe40c94ceaff6e9ec87d..25b540778ea9d9d610e59f9d8ea463f03cf494d1 100644 (file)
@@ -1960,6 +1960,28 @@ class FEValuesBase : protected FEValuesData<dim>,
         void
         get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
                                      Vector<TrilinosScalar>              &out) const = 0;
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+                                     Vector<TrilinosScalar>              &out) const = 0;
+
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+                                     Vector<TrilinosScalar>                   &out) const = 0;
 #endif
     };
 
@@ -2124,6 +2146,28 @@ class FEValuesBase : protected FEValuesData<dim>,
         void
         get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
                                      Vector<TrilinosScalar>              &out) const;
+
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+                                     Vector<TrilinosScalar>              &out) const;
+
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+                                     Vector<TrilinosScalar>                   &out) const;
 #endif
 
       private:
@@ -2333,6 +2377,28 @@ class FEValuesBase : protected FEValuesData<dim>,
         void
         get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
                                      Vector<TrilinosScalar>              &out) const;
+
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+                                     Vector<TrilinosScalar>              &out) const;
+
+                                         /**
+                                          * Call
+                                          * @p get_interpolated_dof_values
+                                          * of the iterator with the
+                                          * given arguments.
+                                          */
+        virtual
+        void
+        get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+                                     Vector<TrilinosScalar>                   &out) const;
 #endif
 
       private:
index 9b8db14cbab205dd7884ae614b92d2c900046fec..540695fcd065688d390cf8e248631246ec639ad7 100644 (file)
@@ -67,6 +67,11 @@ namespace TrilinosWrappers
   class Vector;
   class BlockSparseMatrix;
   class BlockVector;
+  namespace MPI
+  {
+    class Vector;
+    class BlockVector;
+  }
 }
 #endif
 
@@ -1108,43 +1113,103 @@ class MatrixTools : public MatrixCreator
 
 #ifdef DEAL_II_USE_TRILINOS
                                     /**
-                                     * Apply dirichlet boundary conditions to
-                                     * the system matrix and vectors as
-                                     * described in the general
-                                     * documentation. This function works on
-                                     * the classes that are used to wrap
-                                     * Trilinos objects.
+                                     * Apply dirichlet boundary
+                                     * conditions to the system matrix
+                                     * and vectors as described in the
+                                     * general documentation. This
+                                     * function works on the classes
+                                     * that are used to wrap Trilinos
+                                     * objects.
                                      * 
-                                     * Note that this function is not very
-                                     * efficient: it needs to alternatingly
-                                     * read and write into the matrix, a
-                                     * situation that Trilinos does not handle
-                                     * too well. In addition, we only get rid
-                                     * of rows corresponding to boundary
-                                     * nodes, but the corresponding case of
-                                     * deleting the respective columns
-                                     * (i.e. if @p eliminate_columns is @p
-                                     * true) is not presently implemented,
-                                     * and probably will never because it is
-                                     * too expensive without direct access to
-                                     * the Trilinos data structures. (This leads
-                                     * to the situation where the action
-                                     * indicates by the default value of the
-                                     * last argument is actually not
-                                     * implemented; that argument has
-                                     * <code>true</code> as its default value
-                                     * to stay consistent with the other
-                                     * functions of same name in this class.)
-                                     * A third reason against this function
-                                     * is that it doesn't handle the case
-                                     * where the matrix is distributed across
-                                     * an MPI system.
+                                     * Note that this function is not
+                                     * very efficient: it needs to
+                                     * alternatingly read and write
+                                     * into the matrix, a situation
+                                     * that Trilinos does not handle
+                                     * too well. In addition, we only
+                                     * get rid of rows corresponding to
+                                     * boundary nodes, but the
+                                     * corresponding case of deleting
+                                     * the respective columns (i.e. if
+                                     * @p eliminate_columns is @p true)
+                                     * is not presently implemented,
+                                     * and probably will never because
+                                     * it is too expensive without
+                                     * direct access to the Trilinos
+                                     * data structures. (This leads to
+                                     * the situation where the action
+                                     * indicates by the default value
+                                     * of the last argument is actually
+                                     * not implemented; that argument
+                                     * has <code>true</code> as its
+                                     * default value to stay consistent
+                                     * with the other functions of same
+                                     * name in this class.)  A third
+                                     * reason against this function is
+                                     * that it doesn't handle the case
+                                     * where the matrix is distributed
+                                     * across an MPI system.
+                                     */
+    static void
+    apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                          TrilinosWrappers::SparseMatrix  &matrix,
+                          TrilinosWrappers::Vector        &solution,
+                          TrilinosWrappers::Vector        &right_hand_side,
+                          const bool             eliminate_columns = true);
+    
+                                    /**
+                                     * This function does the same as
+                                     * the one above, except now
+                                     * working on block structures.
+                                     */
+    static void
+    apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                          TrilinosWrappers::BlockSparseMatrix  &matrix,
+                          TrilinosWrappers::BlockVector        &solution,
+                          TrilinosWrappers::BlockVector        &right_hand_side,
+                          const bool                eliminate_columns = true);
+
+                                    /**
+                                     * Apply dirichlet boundary
+                                     * conditions to the system matrix
+                                     * and vectors as described in the
+                                     * general documentation. This
+                                     * function works on the classes
+                                     * that are used to wrap Trilinos
+                                     * objects.
+                                     * 
+                                     * Note that this function is not
+                                     * very efficient: it needs to
+                                     * alternatingly read and write
+                                     * into the matrix, a situation
+                                     * that Trilinos does not handle
+                                     * too well. In addition, we only
+                                     * get rid of rows corresponding to
+                                     * boundary nodes, but the
+                                     * corresponding case of deleting
+                                     * the respective columns (i.e. if
+                                     * @p eliminate_columns is @p true)
+                                     * is not presently implemented,
+                                     * and probably will never because
+                                     * it is too expensive without
+                                     * direct access to the Trilinos
+                                     * data structures. (This leads to
+                                     * the situation where the action
+                                     * indicates by the default value
+                                     * of the last argument is actually
+                                     * not implemented; that argument
+                                     * has <code>true</code> as its
+                                     * default value to stay consistent
+                                     * with the other functions of same
+                                     * name in this class.) This
+                                     * function does work on MPI vector
+                                     * types.
                                      */
     static void
     apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
                           TrilinosWrappers::SparseMatrix  &matrix,
-                          TrilinosWrappers::Vector  &solution,
-                          TrilinosWrappers::Vector  &right_hand_side,
+                          TrilinosWrappers::MPI::Vector   &solution,
+                          TrilinosWrappers::MPI::Vector   &right_hand_side,
                           const bool             eliminate_columns = true);
     
                                     /**
@@ -1155,8 +1220,8 @@ class MatrixTools : public MatrixCreator
     static void
     apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
                           TrilinosWrappers::BlockSparseMatrix  &matrix,
-                          TrilinosWrappers::BlockVector  &solution,
-                          TrilinosWrappers::BlockVector  &right_hand_side,
+                          TrilinosWrappers::MPI::BlockVector   &solution,
+                          TrilinosWrappers::MPI::BlockVector   &right_hand_side,
                           const bool                eliminate_columns = true);
 #endif
     
index 342d9ff716bc3afef25628d0b1561e7008cf0a2d..348d11b0518b31c50866da590c532e4ff6c1b53b 100644 (file)
@@ -1741,6 +1741,8 @@ VECTOR_FUNCTIONS(PETScWrappers::MPI::BlockVector);
 #ifdef DEAL_II_USE_TRILINOS
 VECTOR_FUNCTIONS(TrilinosWrappers::Vector);
 VECTOR_FUNCTIONS(TrilinosWrappers::BlockVector);
+VECTOR_FUNCTIONS(TrilinosWrappers::MPI::Vector);
+VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector);
 #endif
 
 
index 670e31b5a1e10aee7c8b733e3452557135edf5a4..dc37d675e74d042bba3dab479855164f79ff82cb 100644 (file)
@@ -188,6 +188,30 @@ get_interpolated_dof_values (const TrilinosWrappers::BlockVector &in,
   cell->get_interpolated_dof_values (in, out);
 }
 
+
+
+template <int dim>
+template <typename CI>
+void
+FEValuesBase<dim>::CellIterator<CI>::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &in,
+                             Vector<TrilinosScalar>              &out) const
+{
+  cell->get_interpolated_dof_values (in, out);
+}
+
+
+
+template <int dim>
+template <typename CI>
+void
+FEValuesBase<dim>::CellIterator<CI>::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &in,
+                             Vector<TrilinosScalar>                   &out) const
+{
+  cell->get_interpolated_dof_values (in, out);
+}
+
 #endif
 
 
@@ -340,6 +364,28 @@ get_interpolated_dof_values (const TrilinosWrappers::BlockVector &,
   Assert (false, ExcMessage (message_string));
 }
 
+
+
+template <int dim>
+void
+FEValuesBase<dim>::TriaCellIterator::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::Vector &,
+                             Vector<TrilinosScalar>              &) const
+{
+  Assert (false, ExcMessage (message_string));
+}
+
+
+
+template <int dim>
+void
+FEValuesBase<dim>::TriaCellIterator::
+get_interpolated_dof_values (const TrilinosWrappers::MPI::BlockVector &,
+                             Vector<TrilinosScalar>                   &) const
+{
+  Assert (false, ExcMessage (message_string));
+}
+
 #endif
 
 
index 89ec089838a135e87c5d35278a93fb7dfffd45f7..4abda8a0d8aaee0c039d4e6ba8b72b26f3a621ac 100644 (file)
@@ -1675,6 +1675,12 @@ INSTANTIATE(TrilinosWrappers::BlockVector,DoFHandler<deal_II_dimension>);
 
 INSTANTIATE(TrilinosWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
 INSTANTIATE(TrilinosWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,hp::DoFHandler<deal_II_dimension>);
 #endif
 
 #undef INSTANTIATE
index 9fcf748c6ce69c493cf4ffebe33c834044d5acbc..869ad7104fa1b795b0efcd41f186417bfc58b1a7 100644 (file)
@@ -695,7 +695,7 @@ namespace TrilinosWrappers
                          TrilinosMatrix      &matrix,
                          TrilinosVector      &solution,
                          TrilinosVector      &right_hand_side,
-                         const bool        eliminate_columns)
+                         const bool           eliminate_columns)
   {
     Assert (eliminate_columns == false, ExcNotImplemented());
 
@@ -796,6 +796,85 @@ namespace TrilinosWrappers
     solution.compress ();
     right_hand_side.compress ();
   }
+
+
+
+  template <typename TrilinosMatrix, typename TrilinosBlockVector>
+  void
+  apply_block_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                              TrilinosMatrix      &matrix,
+                              TrilinosBlockVector &solution,
+                              TrilinosBlockVector &right_hand_side,
+                              const bool          eliminate_columns)
+  {
+    Assert (matrix.n() == right_hand_side.size(),
+           ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+    Assert (matrix.n() == solution.size(),
+           ExcDimensionMismatch(matrix.n(), solution.size()));
+    Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+           ExcNotQuadratic());
+  
+    const unsigned int n_blocks = matrix.n_block_rows();
+
+    matrix.compress();
+
+                                  // We need to find the subdivision
+                                  // into blocks for the boundary values.
+                                  // To this end, generate a vector of
+                                  // maps with the respective indices.
+    std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
+    {
+      int offset = 0, block=0;
+      for (std::map<unsigned int,double>::const_iterator
+            dof  = boundary_values.begin();
+          dof != boundary_values.end();
+          ++dof)
+       {
+         if (dof->first >= matrix.block(block,0).m() + offset)
+           {
+             offset += matrix.block(block,0).m();
+             block++;
+           }
+         const unsigned int index = dof->first - offset;
+         block_boundary_values[block].insert(
+            std::pair<unsigned int, double> (index,dof->second));
+       }
+    }
+  
+                                  // Now call the non-block variants on
+                                  // the diagonal subblocks and the
+                                  // solution/rhs.
+    for (unsigned int block=0; block<n_blocks; ++block)
+      TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
+                                             matrix.block(block,block),
+                                             solution.block(block),
+                                             right_hand_side.block(block),
+                                             eliminate_columns);
+  
+                                  // Finally, we need to do something 
+                                  // about the off-diagonal matrices. This
+                                  // is luckily not difficult. Just clear
+                                  // the whole row.
+    for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
+      {
+       const std::pair<unsigned int, unsigned int> local_range
+         = matrix.block(block_m,0).local_range();
+      
+       std::vector<unsigned int> constrained_rows;
+       for (std::map<unsigned int,double>::const_iterator
+              dof  = block_boundary_values[block_m].begin();
+            dof != block_boundary_values[block_m].end();
+            ++dof)
+         if ((dof->first >= local_range.first) &&
+             (dof->first < local_range.second))
+           constrained_rows.push_back (dof->first);
+  
+       for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
+         if (block_m != block_n)
+           matrix.block(block_m,block_n).clear_rows(constrained_rows);
+      }
+  }
+
 }
 
 
@@ -804,8 +883,8 @@ void
 MatrixTools::
 apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
                        TrilinosWrappers::SparseMatrix   &matrix,
-                       TrilinosWrappers::Vector   &solution,
-                       TrilinosWrappers::Vector   &right_hand_side,
+                       TrilinosWrappers::Vector         &solution,
+                       TrilinosWrappers::Vector         &right_hand_side,
                        const bool        eliminate_columns)
 {
                                    // simply redirect to the generic function
@@ -814,6 +893,24 @@ apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
                                         right_hand_side, eliminate_columns);
 }
 
+
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                       TrilinosWrappers::SparseMatrix   &matrix,
+                       TrilinosWrappers::MPI::Vector    &solution,
+                       TrilinosWrappers::MPI::Vector    &right_hand_side,
+                       const bool        eliminate_columns)
+{
+                                   // simply redirect to the generic function
+                                   // used for both trilinos matrix types
+  TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
+                                          right_hand_side, eliminate_columns);
+}
+
+
+
 void
 MatrixTools::
 apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
@@ -822,71 +919,24 @@ apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
                        TrilinosWrappers::BlockVector        &right_hand_side,
                        const bool                            eliminate_columns)
 {
-  Assert (matrix.n() == right_hand_side.size(),
-         ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-  Assert (matrix.n() == solution.size(),
-         ExcDimensionMismatch(matrix.n(), solution.size()));
-  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
-         ExcNotQuadratic());
-  
-  const unsigned int n_blocks = matrix.n_block_rows();
+  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
+                                                solution, right_hand_side, 
+                                                eliminate_columns);
+}
 
-  matrix.compress();
 
-                                  // We need to find the subdivision
-                                  // into blocks for the boundary values.
-                                  // To this end, generate a vector of
-                                  // maps with the respective indices.
-  std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
-  {
-    int offset = 0, block=0;
-    for (std::map<unsigned int,double>::const_iterator
-           dof  = boundary_values.begin();
-         dof != boundary_values.end();
-         ++dof)
-      {
-       if (dof->first >= matrix.block(block,0).m() + offset)
-         {
-           offset += matrix.block(block,0).m();
-           block++;
-         }
-       const unsigned int index = dof->first - offset;
-       block_boundary_values[block].insert(std::pair<unsigned int, double> (index,dof->second));
-      }
-  }
-  
-                                  // Now call the non-block variants on
-                                  // the diagonal subblocks and the
-                                  // solution/rhs.
-  for (unsigned int block=0; block<n_blocks; ++block)
-    TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
-                                           matrix.block(block,block),
-                                           solution.block(block),
-                                           right_hand_side.block(block),
-                                           eliminate_columns);
-  
-                                  // Finally, we need to do something 
-                                  // about the off-diagonal matrices. This
-                                  // is luckily not difficult. Just clear
-                                  // the whole row.
-  for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
-    {
-      const std::pair<unsigned int, unsigned int> local_range
-       = matrix.block(block_m,0).local_range();
-      
-      std::vector<unsigned int> constrained_rows;
-      for (std::map<unsigned int,double>::const_iterator
-           dof  = block_boundary_values[block_m].begin();
-         dof != block_boundary_values[block_m].end();
-         ++dof)
-       if ((dof->first >= local_range.first) &&
-           (dof->first < local_range.second))
-         constrained_rows.push_back (dof->first);
-  
-      for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
-       if (block_m != block_n)
-         matrix.block(block_m,block_n).clear_rows(constrained_rows);
-    }
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
+                       TrilinosWrappers::BlockSparseMatrix  &matrix,
+                       TrilinosWrappers::MPI::BlockVector   &solution,
+                       TrilinosWrappers::MPI::BlockVector   &right_hand_side,
+                       const bool                            eliminate_columns)
+{
+  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
+                                                solution, right_hand_side, 
+                                                eliminate_columns);
 }
 
 #endif
index 35660fb7e9b542a6840d35dedd7f00f050563539..3cf0eef08798ed229b3cb6fd37b29cf5e30cf817 100644 (file)
@@ -465,6 +465,12 @@ template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, hp:
 
 template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
 template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, hp::DoFHandler<deal_II_dimension> >;
 #endif
 
 /*----------------------------   solution_transfer.cc     ----------------------*/
index b54adda76d65d90c5b29d9b605e683beb59af836..864f0b40dee1b724d141687c38ae1cba4531497f 100644 (file)
@@ -199,11 +199,11 @@ namespace TrilinosWrappers
   BlockVector::reinit (const unsigned int num_blocks)
   {
     std::vector<unsigned int> block_sizes (num_blocks, 0);
-    this->block_indices.reinit (block_sizes);
-    if (this->components.size() != this->n_blocks())
-      this->components.resize(this->n_blocks());
+    block_indices.reinit (block_sizes);
+    if (components.size() != n_blocks())
+      components.resize(n_blocks());
   
-    for (unsigned int i=0;i<this->n_blocks();++i)
+    for (unsigned int i=0;i<n_blocks();++i)
       block(i).clear();
   }
 
@@ -238,12 +238,19 @@ namespace TrilinosWrappers
   BlockVector &
   BlockVector::operator = (const BlockVector &v)
   {
-    Assert (n_blocks() == v.n_blocks(),
-           ExcDimensionMismatch(n_blocks(),v.n_blocks()));
+    if (n_blocks() != v.n_blocks())
+      {
+       std::vector<unsigned int> block_sizes (v.n_blocks(), 0);
+       block_indices.reinit (block_sizes);
+       if (components.size() != n_blocks())
+         components.resize(n_blocks());
+      }
 
     for (unsigned int i=0; i<this->n_blocks(); ++i)
       this->components[i] = v.block(i);
 
+    collect_sizes();
+
     return *this;
   }
  

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.