From: heister Date: Wed, 31 Oct 2012 20:22:19 +0000 (+0000) Subject: introduce two namespaces for abstract linear algebra. try it out in step-40 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=968a3e5db85401b84e3dd31c6e96357a589c691a;p=dealii-svn.git introduce two namespaces for abstract linear algebra. try it out in step-40 git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27270 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index 3b201990e5..a9d9c35b4e 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -20,6 +20,16 @@ // friends: #include #include + +#include + +namespace LA +{ + using namespace dealii::LinearAlgebraPETSc; +// using namespace dealii::LinearAlgebraTrilinos; +} + + #include #include #include @@ -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 void LaplaceProblem::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 index 0000000000..ff207a1b27 --- /dev/null +++ b/deal.II/include/deal.II/lac/parallel_linear_algebra.h @@ -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 + + +#ifdef DEAL_II_USE_PETSC + +#include +#include +#include +#include +#include + +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 +#include +#include +#include + +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