00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: BaseMatrix.hpp,v 1.5 2008/03/30 20:24:24 delpinux Exp $ 00019 00020 #ifndef BASEMATRIX_HPP 00021 #define BASEMATRIX_HPP 00022 00023 #include <BaseVector.hpp> 00024 #include <cstddef> 00025 #include <config.h> 00026 00027 class BaseMatrix 00028 { 00029 public: 00030 enum Type { 00031 doubleHashedMatrix, 00032 sparseMatrix, 00033 #ifdef HAVE_PETSC 00034 petscMatrix, 00035 #endif // HAVE_PETSC 00036 unAssembled 00037 }; 00038 00039 protected: 00040 BaseMatrix::Type __type; 00041 00042 size_t __size; 00043 00044 public: 00049 virtual void reset() = 0; 00050 00052 virtual void getDiagonal(BaseVector& X) const = 0; 00053 00055 virtual void transposedTimesX(const BaseVector& X, 00056 BaseVector& Z) const = 0; 00057 00059 virtual void timesX(const BaseVector& X, 00060 BaseVector& Z) const = 0; 00061 00062 const size_t& size() const 00063 { 00064 return __size; 00065 } 00066 00067 const BaseMatrix::Type& type() const 00068 { 00069 return __type; 00070 } 00071 00072 BaseMatrix(const BaseMatrix::Type t, 00073 const size_t& size = 0) 00074 : __type(t), 00075 __size(size) 00076 { 00077 ; 00078 } 00079 00080 BaseMatrix(const BaseMatrix& B) 00081 : __type(B.__type), 00082 __size(B.__size) 00083 { 00084 ; 00085 } 00086 00087 virtual ~BaseMatrix() 00088 { 00089 ; 00090 } 00091 }; 00092 00093 #endif // BASEMATRIX_HPP 00094
1.5.6