sum_shell_matrix.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 // Local includes
22 #include "libmesh/numeric_vector.h"
23 
24 namespace libMesh
25 {
26 
27 template <typename T>
29 {
30  libmesh_assert(!matrices.empty());
31  const numeric_index_type result = matrices[0]->m();
32  for(numeric_index_type i=matrices.size(); i-->1; )
33  {
34  libmesh_assert_equal_to (matrices[i]->m(), result);
35  }
36  return result;
37 }
38 
39 
40 
41 template <typename T>
43 {
44  libmesh_assert(!matrices.empty());
45  const numeric_index_type result = matrices[0]->n();
46  for(numeric_index_type i=matrices.size(); i-->1; )
47  {
48  libmesh_assert_equal_to (matrices[i]->n(), result);
49  }
50  return result;
51 }
52 
53 
54 
55 template <typename T>
57  const NumericVector<T>& arg) const
58 {
59  dest.zero();
60  this->vector_mult_add(dest,arg);
61 }
62 
63 
64 
65 template <typename T>
67  const NumericVector<T>& arg) const
68 {
69  for(numeric_index_type i=matrices.size(); i-->0; )
70  {
71  matrices[i]->vector_mult_add(dest,arg);
72  }
73 }
74 
75 
76 
77 template <typename T>
79 {
80  AutoPtr<NumericVector<T> > a = dest.clone();
81  dest.zero();
82  for(numeric_index_type i=matrices.size(); i-->0; )
83  {
84  matrices[i]->get_diagonal(*a);
85  dest += *a;
86  }
87 }
88 
89 
90 
91 //------------------------------------------------------------------
92 // Explicit instantiations
93 template class SumShellMatrix<Number>;
94 
95 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo