sum_shell_matrix.C
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 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 // Local includes 00021 #include "libmesh/sum_shell_matrix.h" 00022 #include "libmesh/numeric_vector.h" 00023 00024 namespace libMesh 00025 { 00026 00027 template <typename T> 00028 numeric_index_type SumShellMatrix<T>::m () const 00029 { 00030 libmesh_assert(!matrices.empty()); 00031 const numeric_index_type result = matrices[0]->m(); 00032 for(numeric_index_type i=matrices.size(); i-->1; ) 00033 { 00034 libmesh_assert_equal_to (matrices[i]->m(), result); 00035 } 00036 return result; 00037 } 00038 00039 00040 00041 template <typename T> 00042 numeric_index_type SumShellMatrix<T>::n () const 00043 { 00044 libmesh_assert(!matrices.empty()); 00045 const numeric_index_type result = matrices[0]->n(); 00046 for(numeric_index_type i=matrices.size(); i-->1; ) 00047 { 00048 libmesh_assert_equal_to (matrices[i]->n(), result); 00049 } 00050 return result; 00051 } 00052 00053 00054 00055 template <typename T> 00056 void SumShellMatrix<T>::vector_mult (NumericVector<T>& dest, 00057 const NumericVector<T>& arg) const 00058 { 00059 dest.zero(); 00060 this->vector_mult_add(dest,arg); 00061 } 00062 00063 00064 00065 template <typename T> 00066 void SumShellMatrix<T>::vector_mult_add (NumericVector<T>& dest, 00067 const NumericVector<T>& arg) const 00068 { 00069 for(numeric_index_type i=matrices.size(); i-->0; ) 00070 { 00071 matrices[i]->vector_mult_add(dest,arg); 00072 } 00073 } 00074 00075 00076 00077 template <typename T> 00078 void SumShellMatrix<T>::get_diagonal (NumericVector<T>& dest) const 00079 { 00080 AutoPtr<NumericVector<T> > a = dest.clone(); 00081 dest.zero(); 00082 for(numeric_index_type i=matrices.size(); i-->0; ) 00083 { 00084 matrices[i]->get_diagonal(*a); 00085 dest += *a; 00086 } 00087 } 00088 00089 00090 00091 //------------------------------------------------------------------ 00092 // Explicit instantiations 00093 template class SumShellMatrix<Number>; 00094 00095 } // namespace libMesh 00096
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: