MFEM v2.0
sparsesmoothers.cpp
Go to the documentation of this file.
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
00003 // reserved. See file COPYRIGHT for details.
00004 //
00005 // This file is part of the MFEM library. For more information and source code
00006 // availability see http://mfem.googlecode.com.
00007 //
00008 // MFEM is free software; you can redistribute it and/or modify it under the
00009 // terms of the GNU Lesser General Public License (as published by the Free
00010 // Software Foundation) version 2.1 dated February 1999.
00011 
00012 // Implementation of data types for sparse matrix smoothers
00013 
00014 #include <iostream>
00015 #include "vector.hpp"
00016 #include "matrix.hpp"
00017 #include "sparsemat.hpp"
00018 #include "sparsesmoothers.hpp"
00019 
00021 GSSmoother::GSSmoother(const SparseMatrix & a) : MatrixInverse(a)
00022 {}
00023 
00025 void GSSmoother::Mult(const Vector &x, Vector &y) const
00026 {
00027    y = 0.;
00028 
00029    ((const SparseMatrix *)a)->Gauss_Seidel_forw(x, y);
00030    ((const SparseMatrix *)a)->Gauss_Seidel_back(x, y);
00031 }
00032 
00034 GSSmoother::~GSSmoother()
00035 {}
00036 
00038 DSmoother::DSmoother(const SparseMatrix &a, double s) : MatrixInverse(a)
00039 {
00040    scale = s;
00041 }
00042 
00044 void DSmoother::Mult(const Vector &x, Vector &y) const
00045 {
00046    for (int i = 0; i < x.Size(); i++)
00047       y(i) = scale * x(i) / a->Elem(i, i);
00048 }
00049 
00051 DSmoother::~DSmoother()
00052 {}
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines