$extrastylesheet
sum_shell_matrix.h
Go to the documentation of this file.
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_SUM_SHELL_MATRIX_H
00021 #define LIBMESH_SUM_SHELL_MATRIX_H
00022 
00023 // Local includes
00024 #include "libmesh/libmesh_common.h"
00025 #include "libmesh/reference_counted_object.h"
00026 #include "libmesh/libmesh.h"
00027 #include "libmesh/shell_matrix.h"
00028 
00029 // C++ includes
00030 #include <vector>
00031 
00032 namespace libMesh
00033 {
00034 
00035 
00036 
00044 template <typename T>
00045 class SumShellMatrix : public ShellMatrix<T>
00046 {
00047 public:
00054   SumShellMatrix (const Parallel::Communicator &comm_in
00055                   LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
00056 
00060   explicit
00061   SumShellMatrix (const std::vector<ShellMatrix<T>*>& mat,
00062                   const Parallel::Communicator &comm_in
00063                   LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
00064 
00068   virtual ~SumShellMatrix ();
00069 
00074   virtual numeric_index_type m () const;
00075 
00080   virtual numeric_index_type n () const;
00081 
00086   virtual void vector_mult (NumericVector<T>& dest,
00087                             const NumericVector<T>& arg) const;
00088 
00092   virtual void vector_mult_add (NumericVector<T>& dest,
00093                                 const NumericVector<T>& arg) const;
00094 
00098   virtual void get_diagonal (NumericVector<T>& dest) const;
00099 
00103   std::vector<ShellMatrix<T>*> matrices;
00104 
00105 };
00106 
00107 
00108 
00109 //-----------------------------------------------------------------------
00110 // SumShellMatrix inline members
00111 template <typename T>
00112 inline
00113 SumShellMatrix<T>::SumShellMatrix (const Parallel::Communicator &comm_in):
00114   ShellMatrix<T>(comm_in),
00115   matrices()
00116 {}
00117 
00118 
00119 
00120 template <typename T>
00121 inline
00122 SumShellMatrix<T>::SumShellMatrix (const std::vector<ShellMatrix<T>*>& mat,
00123                                    const Parallel::Communicator &comm_in):
00124   ShellMatrix<T>(comm_in),
00125   matrices(mat)
00126 {}
00127 
00128 
00129 
00130 template <typename T>
00131 inline
00132 SumShellMatrix<T>::~SumShellMatrix ()
00133 {}
00134 
00135 
00136 } // namespace libMesh
00137 
00138 
00139 #endif // LIBMESH_SUM_SHELL_MATRIX_H