]> https://gitweb.dealii.org/ - dealii.git/commitdiff
introduce two namespaces for abstract linear algebra. try it out in step-40
authorTimo Heister <timo.heister@gmail.com>
Wed, 31 Oct 2012 20:22:19 +0000 (20:22 +0000)
committerTimo Heister <timo.heister@gmail.com>
Wed, 31 Oct 2012 20:22:19 +0000 (20:22 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27270 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-40/step-40.cc
deal.II/include/deal.II/lac/parallel_linear_algebra.h [new file with mode: 0644]

index 3b201990e59ac87f63d5a01e3c3e6f457fd31a27..a9d9c35b4ea9714f012cd344f8da3a28ce5b292c 100644 (file)
                                  // friends:
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/base/function.h>
+
+#include <deal.II/lac/parallel_linear_algebra.h>
+
+namespace LA
+{
+  using namespace dealii::LinearAlgebraPETSc;
+//  using namespace dealii::LinearAlgebraTrilinos;
+}
+
+
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/full_matrix.h>
 #include <deal.II/lac/solver_cg.h>
@@ -199,9 +209,9 @@ namespace Step40
 
       ConstraintMatrix     constraints;
 
-      PETScWrappers::MPI::SparseMatrix system_matrix;
-      PETScWrappers::MPI::Vector locally_relevant_solution;
-      PETScWrappers::MPI::Vector system_rhs;
+      LA::SparseMatrix system_matrix;
+      LA::Vector locally_relevant_solution;
+      LA::Vector system_rhs;
 
       ConditionalOStream                pcout;
   };
@@ -591,7 +601,7 @@ namespace Step40
   template <int dim>
   void LaplaceProblem<dim>::solve ()
   {
-    PETScWrappers::MPI::Vector
+    LA::Vector
       completely_distributed_solution (mpi_communicator,
                                        dof_handler.n_dofs(),
                                        dof_handler.n_locally_owned_dofs());
@@ -603,7 +613,7 @@ namespace Step40
                                      // Ask for a symmetric preconditioner by
                                      // setting the first parameter in
                                      // AdditionalData to true.
-    PETScWrappers::PreconditionBoomerAMG
+    LA::PreconditionAMG
       preconditioner(system_matrix,
                      PETScWrappers::PreconditionBoomerAMG::AdditionalData(true));
 
diff --git a/deal.II/include/deal.II/lac/parallel_linear_algebra.h b/deal.II/include/deal.II/lac/parallel_linear_algebra.h
new file mode 100644 (file)
index 0000000..ff207a1
--- /dev/null
@@ -0,0 +1,138 @@
+//---------------------------------------------------------------------------
+//    $Id: linear_algebra.h 27260 2012-10-31 14:38:43Z heister $
+//
+//    Copyright (C) 2008, 2009, 2010, 2012 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+#ifndef __deal2__parallel_linear_algebra_h
+#define __deal2__parallel_linear_algebra_h
+
+#include <deal.II/base/config.h>
+
+
+#ifdef DEAL_II_USE_PETSC
+
+#include <deal.II/lac/petsc_vector.h>
+#include <deal.II/lac/petsc_block_vector.h>
+#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
+#include <deal.II/lac/petsc_parallel_block_sparse_matrix.h>
+#include <deal.II/lac/petsc_precondition.h>
+
+DEAL_II_NAMESPACE_OPEN
+
+  namespace LinearAlgebraPETSc
+  {
+    using namespace dealii;
+
+    /**
+     * Typedef for the vector type used.
+     */
+    typedef PETScWrappers::MPI::Vector Vector;
+
+    /**
+     * Typedef for the type used to describe vectors that
+     * consist of multiple blocks.
+     */
+    typedef PETScWrappers::MPI::BlockVector BlockVector;
+
+    /**
+     * Typedef for the sparse matrix type used.
+     */
+    typedef PETScWrappers::MPI::SparseMatrix SparseMatrix;
+
+    /**
+     * Typedef for the type used to describe sparse matrices that
+     * consist of multiple blocks.
+     */
+    typedef PETScWrappers::MPI::BlockSparseMatrix BlockSparseMatrix;
+
+    /**
+     * Typedef for the AMG preconditioner type used for the
+     * top left block of the Stokes matrix.
+     */
+    typedef PETScWrappers::PreconditionBoomerAMG PreconditionAMG;
+
+    /**
+     * Typedef for the Incomplete Cholesky preconditioner used
+     * for other blocks of the system matrix.
+     */
+    typedef PETScWrappers::PreconditionICC PreconditionIC;
+
+    /**
+     * Typedef for the Incomplete LU decomposition preconditioner used
+     * for other blocks of the system matrix.
+     */
+    typedef PETScWrappers::PreconditionILU PreconditionILU;
+  }
+DEAL_II_NAMESPACE_CLOSE
+
+
+#endif // DEAL_II_USE_PETSC
+
+#ifdef DEAL_II_USE_TRILINOS
+
+#include <deal.II/lac/trilinos_vector.h>
+#include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/trilinos_sparse_matrix.h>
+#include <deal.II/lac/trilinos_precondition.h>
+
+DEAL_II_NAMESPACE_OPEN
+
+  namespace LinearAlgebraTrilinos
+  {
+    using namespace dealii;
+
+    /**
+     * Typedef for the vector type used.
+     */
+    typedef TrilinosWrappers::MPI::Vector Vector;
+
+    /**
+     * Typedef for the type used to describe vectors that
+     * consist of multiple blocks.
+     */
+    typedef TrilinosWrappers::MPI::BlockVector BlockVector;
+
+    /**
+     * Typedef for the sparse matrix type used.
+     */
+    typedef TrilinosWrappers::SparseMatrix SparseMatrix;
+
+    /**
+     * Typedef for the type used to describe sparse matrices that
+     * consist of multiple blocks.
+     */
+    typedef TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix;
+
+    /**
+     * Typedef for the AMG preconditioner type used for the
+     * top left block of the Stokes matrix.
+     */
+    typedef TrilinosWrappers::PreconditionAMG PreconditionAMG;
+
+    /**
+     * Typedef for the Incomplete Cholesky preconditioner used
+     * for other blocks of the system matrix.
+     */
+    typedef TrilinosWrappers::PreconditionIC PreconditionIC;
+
+    /**
+     * Typedef for the Incomplete LU decomposition preconditioner used
+     * for other blocks of the system matrix.
+     */
+    typedef TrilinosWrappers::PreconditionILU PreconditionILU;
+  }
+
+DEAL_II_NAMESPACE_CLOSE
+
+
+#endif // DEAL_II_USE_TRILINOS
+
+
+
+#endif

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.