$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library 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 GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_SPARSE_SHELL_MATRIX_H 00021 #define LIBMESH_SPARSE_SHELL_MATRIX_H 00022 00023 00024 // Local includes 00025 #include "libmesh/libmesh_common.h" 00026 #include "libmesh/reference_counted_object.h" 00027 #include "libmesh/libmesh.h" 00028 #include "libmesh/shell_matrix.h" 00029 #include "libmesh/sparse_matrix.h" 00030 00031 namespace libMesh 00032 { 00033 00034 00041 template <typename T> 00042 class SparseShellMatrix : public ShellMatrix<T> 00043 { 00044 public: 00049 explicit 00050 SparseShellMatrix (const SparseMatrix<T>& new_m); 00051 00055 virtual ~SparseShellMatrix (); 00056 00061 virtual numeric_index_type m () const; 00062 00067 virtual numeric_index_type n () const; 00068 00073 virtual void vector_mult (NumericVector<T>& dest, 00074 const NumericVector<T>& arg) const; 00075 00079 virtual void vector_mult_add (NumericVector<T>& dest, 00080 const NumericVector<T>& arg) const; 00081 00085 virtual void get_diagonal (NumericVector<T>& dest) const; 00086 00087 protected: 00091 const SparseMatrix<T>& _m; 00092 00093 }; 00094 00095 00096 00097 //----------------------------------------------------------------------- 00098 // SparseShellMatrix inline members 00099 template <typename T> 00100 inline 00101 SparseShellMatrix<T>::SparseShellMatrix (const SparseMatrix<T>& new_m): 00102 ShellMatrix<T>(new_m.comm()), 00103 _m(new_m) 00104 {} 00105 00106 00107 00108 template <typename T> 00109 inline 00110 SparseShellMatrix<T>::~SparseShellMatrix () 00111 {} 00112 00113 00114 00115 template <typename T> 00116 inline 00117 numeric_index_type SparseShellMatrix<T>::m () const 00118 { 00119 return _m.m(); 00120 } 00121 00122 00123 00124 template <typename T> 00125 inline 00126 numeric_index_type SparseShellMatrix<T>::n () const 00127 { 00128 return _m.n(); 00129 } 00130 00131 00132 00133 template <typename T> 00134 inline 00135 void SparseShellMatrix<T>::get_diagonal(NumericVector<T>& dest) const 00136 { 00137 _m.get_diagonal(dest); 00138 } 00139 00140 00141 } // namespace libMesh 00142 00143 00144 #endif // LIBMESH_SPARSE_SHELL_MATRIX_H