From c10cc446babb93ad3f80596046b3cdf956d7b937 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 14 Jan 1999 16:37:24 +0000 Subject: [PATCH] A first step to multigrid git-svn-id: https://svn.dealii.org/trunk@735 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/multigrid/multigrid.h | 44 +++++++++++++++++++ deal.II/deal.II/include/numerics/multigrid.h | 44 +++++++++++++++++++ deal.II/deal.II/source/multigrid/multigrid.cc | 38 ++++++++++++++++ deal.II/deal.II/source/numerics/multigrid.cc | 38 ++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 deal.II/deal.II/include/multigrid/multigrid.h create mode 100644 deal.II/deal.II/include/numerics/multigrid.h create mode 100644 deal.II/deal.II/source/multigrid/multigrid.cc create mode 100644 deal.II/deal.II/source/numerics/multigrid.cc diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h new file mode 100644 index 0000000000..d3951e87d9 --- /dev/null +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -0,0 +1,44 @@ +/*---------------------------- multigrid.h ---------------------------*/ +/* $Id$ */ +#ifndef __multigrid_H +#define __multigrid_H +/*---------------------------- multigrid.h ---------------------------*/ + +/** + * Basic matrix class for multigrid preconditioning. + * + * This matrix may be used in the iterative methods of LAC, where the + * functions #vmult# and #precondition# and possibly their transposed + * versions are needed. + * + * The function #precondition# is the actual multigrid method and + * makes use of several operations to be implemented in derived + * classes... + * + */ +class MGMatrix +{ + MGMatrix(const MGMatrix&); + operator=(const MGMatrix&); +public: + /** Matrix-vector multiplication. + * + * The global, non-multigrid + * matrix-vector multiplication + * used to compute the residual in + * the outer iteration. + * + */ + void vmult(dVector& dst, const dVector& src) const; + /** Multigrid preconditioning. + */ + void precondition(dVector& dst, const dVector& src) const; +}; + + + + +/*---------------------------- multigrid.h ---------------------------*/ +/* end of #ifndef __multigrid_H */ +#endif +/*---------------------------- multigrid.h ---------------------------*/ diff --git a/deal.II/deal.II/include/numerics/multigrid.h b/deal.II/deal.II/include/numerics/multigrid.h new file mode 100644 index 0000000000..d3951e87d9 --- /dev/null +++ b/deal.II/deal.II/include/numerics/multigrid.h @@ -0,0 +1,44 @@ +/*---------------------------- multigrid.h ---------------------------*/ +/* $Id$ */ +#ifndef __multigrid_H +#define __multigrid_H +/*---------------------------- multigrid.h ---------------------------*/ + +/** + * Basic matrix class for multigrid preconditioning. + * + * This matrix may be used in the iterative methods of LAC, where the + * functions #vmult# and #precondition# and possibly their transposed + * versions are needed. + * + * The function #precondition# is the actual multigrid method and + * makes use of several operations to be implemented in derived + * classes... + * + */ +class MGMatrix +{ + MGMatrix(const MGMatrix&); + operator=(const MGMatrix&); +public: + /** Matrix-vector multiplication. + * + * The global, non-multigrid + * matrix-vector multiplication + * used to compute the residual in + * the outer iteration. + * + */ + void vmult(dVector& dst, const dVector& src) const; + /** Multigrid preconditioning. + */ + void precondition(dVector& dst, const dVector& src) const; +}; + + + + +/*---------------------------- multigrid.h ---------------------------*/ +/* end of #ifndef __multigrid_H */ +#endif +/*---------------------------- multigrid.h ---------------------------*/ diff --git a/deal.II/deal.II/source/multigrid/multigrid.cc b/deal.II/deal.II/source/multigrid/multigrid.cc new file mode 100644 index 0000000000..08646d86be --- /dev/null +++ b/deal.II/deal.II/source/multigrid/multigrid.cc @@ -0,0 +1,38 @@ +// $Id$ +// Copyright Guido Kanschat, Universitaet Heidelberg, 1999 + +#include + +void +MGMatrix::vmult(dVector& dst, const dVector& src) const +{ + dst = 0.; + + copy_to_mg(s,src); + + for (int l=0;l + +void +MGMatrix::vmult(dVector& dst, const dVector& src) const +{ + dst = 0.; + + copy_to_mg(s,src); + + for (int l=0;l