1/*
2 * Vector.hpp
3 *
4 * Created on: Nov 27, 2015
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_NUMERICS_SRC_VECTOR_VECTOR_HPP_
9#define OPENFPM_NUMERICS_SRC_VECTOR_VECTOR_HPP_
10
11#include "config/config.h"
12#include "util/linalgebra_lib.hpp"
13
14/*! \brief It store one row value of a vector
15 *
16 * Given a row, store a value
17 *
18 *
19 */
20template<typename T, unsigned int impl>
21class rval
22{
23};
24
25
26// Eigen::Matrix<T, Eigen::Dynamic, 1>
27
28#ifdef HAVE_EIGEN
29#include <Eigen/Sparse>
30#define DEFAULT_VECTOR = EIGEN_BASE
31#else
32#define DEFAULT_VECTOR = 0
33#endif
34
35/*! \brief Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support
36 *
37 */
38template<typename T,unsigned int impl DEFAULT_VECTOR >
39class Vector
40{
41 //! stub
42 T stub;
43
44 //! stub
45 int stub_i;
46
47public:
48
49 /*! \brief stub copy constructor
50 *
51 * \param v stub
52 *
53 */
54 Vector(const Vector<T> & v)
55 :stub(0),stub_i(0)
56 {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
57
58 /*! \brief stub copy constructor
59 *
60 * \param v vector to copy
61 *
62 */
63 Vector(Vector<T> && v)
64 :stub(0),stub_i(0)
65 {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
66
67 /*! \brief stub constructor from number of rows
68 *
69 * \param n stub
70 *
71 */
72 Vector(size_t n)
73 :stub(0),stub_i(0)
74 {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
75
76 //! stub default constructor
77 Vector()
78 :stub(0),stub_i(0)
79 {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
80
81 /*! \brief stub constructor
82 *
83 * \param n global number of row
84 * \param n_row_local local number of rows
85 *
86 */
87 Vector(size_t n, size_t n_row_local)
88 :stub(0),stub_i(0)
89 {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
90
91 /*! \brief stub resize
92 *
93 * \param row stub
94 * \param row_n stub
95 *
96 */
97 void resize(size_t row, size_t row_n) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
98
99 /*! \brief stub insert
100 *
101 * \param i stub
102 * \param val stub
103 *
104 */
105 void insert(size_t i, T val) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
106
107 /*! \brief stub insert
108 *
109 * \param i stub
110 *
111 * \return stub
112 *
113 */
114 inline T & insert(size_t i) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
115
116 /*! \brief stub insert
117 *
118 * \param i stub
119 *
120 */
121 inline const T & insert(size_t i) const {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return stub;}
122
123 /*! \brief stub
124 *
125 * \param i stub
126 *
127 * \return stub
128 *
129 */
130 const T & operator()(size_t i) const {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
131
132 /*! \brief stub
133 *
134 * \param i stub
135 *
136 * \return stub
137 *
138 */
139 T & operator()(size_t i) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
140
141 /*! \brief scatter
142 *
143 */
144 void scatter() {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
145
146 /*! \brief fromFile
147 *
148 * \param file stub
149 *
150 */
151 void fromFile(std::string file) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
152
153
154 /*! \brief stub operator=
155 *
156 * \param v stub
157 *
158 * \return itself
159 *
160 */
161 Vector<T> & operator=(const Vector<T> & v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return *this;}
162
163 /*! \brief stub operator=
164 *
165 * \param v stub
166 *
167 * \return itself
168 *
169 */
170 Vector<T> & operator=(Vector<T> && v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return *this;}
171
172 /*! \brief stub getVec
173 *
174 * \return stub
175 *
176 */
177 int & getVec() {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return stub_i;}
178};
179
180#ifdef HAVE_EIGEN
181#include "Vector_eigen.hpp"
182#endif
183
184#ifdef HAVE_PETSC
185#include "Vector_petsc.hpp"
186#endif
187
188#endif /* OPENFPM_NUMERICS_SRC_VECTOR_VECTOR_HPP_ */
189