Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
systemimplicitlinear.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2009-01-04
7 
8  Copyright (C) 2009 Université Joseph Fourier (Grenoble I)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 3.0 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __SystemImplicitLinear_H
30 #define __SystemImplicitLinear_H 1
31 
32 #include <feel/feelalg/backend.hpp>
34 
35 namespace Feel
36 {
44 template<typename SpaceType>
45 class SystemImplicitLinear : public SystemImplicit<SpaceType>
46 {
48 public:
49 
50 
54 
56 
60 
62 
63  typedef typename super::value_type value_type;
64  typedef typename super::functionspace_type functionspace_type;
65  typedef typename super::functionspace_type functionspace_ptrtype;
66  typedef typename super::element_type element_type;
67 
68  typedef typename super::backend_type backend_type;
69  typedef typename super::backend_ptrtype backend_ptrtype;
70  typedef typename super::sparse_matrix_type sparse_matrix_type;
71  typedef typename super::sparse_matrix_ptrtype sparse_matrix_ptrtype;
72  typedef typename super::vector_type vector_type;
73  typedef typename super::vector_ptrtype vector_ptrtype;
74 
76 
80 
81  SystemImplicitLinear( functionspace_ptrtype const& Xh, po::variables_map const& vm );
84 
86 
90 
91  SystemImplicitLinear& operator=( SystemImplicitLinear const & o )
92  {
93  if ( this != &o )
94  {
95  super::operator=( o );
96 
97 
98  M_lhs = o.M_lhs;
99  M_rhs = o.M_rhs;
100  }
101 
102  return *this;
103  }
105 
109 
111  sparse_matrix_ptrtype const& lhs() const
112  {
113  return M_lhs;
114  }
115 
117  sparse_matrix_ptrtype& lhs()
118  {
119  return M_lhs;
120  }
121 
123  vector_ptrtype const& rhs() const
124  {
125  return M_rhs;
126  }
127 
129  vector_ptrtype& rhs()
130  {
131  return M_rhs;
132  }
133 
134 
136 
140 
141 
143 
147 
151  void solve( element_type& u )
152  {
153  vector_ptrtype U( this->backend->newVector( _test=this->functionSpace() ) );
154  this->backend->solve( M_lhs, M_lhs, U, M_rhs );
155  u = *U;
156  }
157 
159 
160 
161 
162 protected:
163 
164  sparse_matrix_ptrtype M_lhs;
165  vector_ptrtype M_rhs;
166 
167 private:
168 
169 
170 
171 };
172 template<typename SpaceType>
173 SystemImplicitLinear<SpaceType>::SystemImplicitLinear( functionspace_ptrtype const& Xh,
174  po::variables_map const& vm )
175  :
176  super( Xh, vm ),
177  M_lhs( this->backend()->newMatrix( Xh, Xh ) ),
178  M_rhs( this->backend()->newVector( Xh ) )
179 {}
180 template<typename SpaceType>
181 SystemImplicitLinear<SpaceType>::SystemImplicitLinear( SystemImplicitLinear const& sil )
182  :
183  super( sil ),
184  M_lhs( sil.M_lhs ),
185  M_rhs( sil.M_rhs )
186 {}
187 
188 
189 }
190 #endif /* __SystemImplicitLinear_H */

Generated on Sun Oct 20 2013 08:25:05 for Feel++ by doxygen 1.8.4