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
vectorvalue.hpp
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: 2005-11-13
7 
8  Copyright (C) 2005,2006 EPFL
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 __VectorValue_H
30 #define __VectorValue_H 1
31 
32 #include <set>
33 
34 #include <boost/numeric/ublas/vector.hpp>
35 
36 
37 namespace Feel
38 {
50 template<typename T>
52 {
53 public:
54 
55 
59 
60  typedef T value_type;
61 
62  typedef value_type vector_type;
63 
65 
69 
70  VectorValue( value_type acc = value_type( 0 ) )
71  :
72  M_vec( acc )
73  {}
74  VectorValue( VectorValue const & m )
75  :
76  M_vec( m.M_vec )
77  {}
78 
79  ~VectorValue()
80  {
81  }
82 
84 
88 
92  value_type& operator()( size_type /*i*/ )
93  {
94  return M_vec;
95  }
96 
98 
102 
107  unsigned int size () const
108  {
109  return 1;
110  }
111 
116  unsigned int rowStart () const
117  {
118  return 0;
119  }
120 
125  unsigned int rowStop () const
126  {
127  return 0;
128  }
129 
133  bool isInitialized() const
134  {
135  return true;
136  }
137 
142  void close () const;
143 
144 
149  bool closed() const
150  {
151  return true;
152  }
153 
154 
158  vector_type const& vec () const
159  {
160  return M_vec;
161  }
162 
166  vector_type & vec ()
167  {
168  return M_vec;
169  }
170 
172 
176 
177 
179 
183 
190  void clear ()
191  {
192  M_vec = 0;
193  }
194 
199  void zero ()
200  {
201  M_vec = 0;
202  }
203 
204  void zero ( size_type /*start1*/, size_type /*stop1*/ )
205  {
206  M_vec = 0;
207  }
208 
212  void add ( const unsigned int /*i*/,
213  const value_type value )
214  {
215  M_vec += value;
216  }
217 
221  void set ( const unsigned int /*i*/,
222  const value_type value )
223  {
224  M_vec = value;
225  }
226 
227 
228 
235  void printMatlab( const std::string name="NULL", bool renumber = false ) const;
236 
237 
239 
240 
241 
242 protected:
243 
244 private:
245 
249  mutable vector_type M_vec;
250 
251 };
252 
253 template<typename T>
254 void
256 {
257 }
258 
259 template<typename T>
260 void
261 VectorValue<T>::printMatlab( const std::string /*filename*/, bool renumber ) const
262 {
263 }
264 
265 } // Feel
266 #endif /* __VectorValue_H */

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