finitediff
SNelement.h
Go to the documentation of this file.
1 /*
2 Copyright 2017 Laurent Claessens
3 contact : laurent@claessens-donadello.eu
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 #ifndef __SNELEMENT_H__145452__
21 #define __SNELEMENT_H__145452__
22 
23 /*
24 This class describes a matrix element from a matrix of type 'SNmatrix'.
25 
26 An element contains
27 - line and column
28 - its value
29 */
30 
31 // THE CLASS HEADER -----------------------------------------
32 
33 
39 template <class T,unsigned int tp_size>
40 class SNelement
41 {
42  private:
43  const T value;
44  public :
45  SNelement(const unsigned int line,const unsigned int column,const T v);
46 
48 
49  const unsigned int line;
50  const unsigned int column;
51 
52  // return the value of the matrix element
53  T getValue() const;
54 };
55 
56 // CONSTRUCTOR, ASSIGNATION, ... -------------------------------------------
57 
58 template <class T,unsigned int tp_size>
59 SNelement<T,tp_size>::SNelement(const unsigned int l,const unsigned int c, const T v) :
60  value(v),
61  line(l),
62  column(c)
63 {}
64 
65 // OTHER FUNCTIONALITIES -------------------------------------------
66 
67 template <class T,unsigned int tp_size>
69 {
70  return value;
71 }
72 
73 #endif
SNelement< T, tp_size > operator=(const SNelement< T, tp_size > &other)
SNelement(const unsigned int line, const unsigned int column, const T v)
Definition: SNelement.h:59
const T value
Definition: SNelement.h:43
const unsigned int column
Definition: SNelement.h:50
const unsigned int line
Definition: SNelement.h:49
This is a template class that represent an element of a SNmatrix.
Definition: SNelement.h:40
T getValue() const
Definition: SNelement.h:68