SU2
vector_structure.hpp
Go to the documentation of this file.
1 
35 #pragma once
36 
37 #include "./mpi_structure.hpp"
38 
39 #include <climits>
40 #include <cmath>
41 #include <vector>
42 #include <iostream>
43 #include <iomanip>
44 #include <string>
45 #include <cstdlib>
46 
47 using namespace std;
48 
60 class CSysVector {
61 
62 private:
63 
64  unsigned long nElm;
65  unsigned long nElmDomain;
66 #ifdef HAVE_MPI
67  unsigned long nElmGlobal;
68 #endif
69  unsigned short nVar;
70  unsigned long nBlk;
71  unsigned long nBlkDomain;
72  su2double* vec_val;
74 public:
75 
79  CSysVector(void);
80 
86  CSysVector(const unsigned long & size, const su2double & val = 0.0);
87 
95  CSysVector(const unsigned long & numBlk, const unsigned long & numBlkDomain, const unsigned short & numVar, const su2double & val = 0.0);
96 
101  CSysVector(const CSysVector & u);
102 
106  void SetValZero(void);
107 
113  explicit CSysVector(const unsigned long & size, const su2double* u_array);
114 
122  explicit CSysVector(const unsigned long & numBlk, const unsigned long & numBlkDomain, const unsigned short & numVar,
123  const su2double* u_array);
124 
128  virtual ~CSysVector();
129 
137  void Initialize(const unsigned long & numBlk, const unsigned long & numBlkDomain, const unsigned short & numVar, const su2double & val = 0.0);
138 
142  unsigned long GetLocSize() const;
143 
147  unsigned long GetSize() const;
148 
152  unsigned short GetNVar() const;
153 
157  unsigned long GetNBlk() const;
158 
162  unsigned long GetNBlkDomain() const;
163 
169  void Equals_AX(const su2double & a, CSysVector & x);
170 
176  void Plus_AX(const su2double & a, CSysVector & x);
177 
185  void Equals_AX_Plus_BY(const su2double & a, CSysVector & x, const su2double & b, CSysVector & y);
186 
191  CSysVector & operator=(const CSysVector & u);
192 
197  CSysVector & operator=(const su2double & val);
198 
203  CSysVector operator+(const CSysVector & u) const;
204 
209  CSysVector & operator+=(const CSysVector & u);
210 
215  CSysVector operator-(const CSysVector & u) const;
216 
221  CSysVector & operator-=(const CSysVector & u);
222 
227  CSysVector operator*(const su2double & val) const;
228 
234  friend CSysVector operator*(const su2double & val, const CSysVector & u);
235 
240  CSysVector & operator*=(const su2double & val);
241 
246  CSysVector operator/(const su2double & val) const;
247 
252  CSysVector & operator/=(const su2double & val);
253 
258  su2double & operator[](const unsigned long & i);
259 
264  const su2double & operator[](const unsigned long & i) const;
265 
270  su2double norm() const;
271 
277  void CopyToArray(su2double* u_array);
278 
284  void SubtractBlock(unsigned long val_ipoint, su2double *val_residual);
285 
291  void AddBlock(unsigned long val_ipoint, su2double *val_residual);
292 
299  void SetBlock(unsigned long val_ipoint, unsigned short val_var, su2double val_residual);
300 
306  void SetBlock(unsigned long val_ipoint, su2double *val_residual);
307 
312  void SetBlock_Zero(unsigned long val_ipoint);
313 
319  void SetBlock_Zero(unsigned long val_ipoint, unsigned short val_var);
320 
326  su2double *GetBlock(unsigned long val_ipoint);
327 
334  su2double GetBlock(unsigned long val_ipoint, unsigned short val_var);
335 
336 
342  friend su2double dotProd(const CSysVector & u, const CSysVector & v);
343 
344 };
345 
364 public:
365  virtual ~CMatrixVectorProduct() = 0;
366  virtual void operator()(const CSysVector & u, CSysVector & v)
367  const = 0;
368 };
370 
381 public:
382  virtual ~CPreconditioner() = 0;
383  virtual void operator()(const CSysVector & u, CSysVector & v)
384  const = 0;
385 };
387 
388 #include "vector_structure.inl"
CSysVector operator*(const su2double &val, const CSysVector &u)
Definition: vector_structure.cpp:303
su2double dotProd(const CSysVector &u, const CSysVector &v)
Definition: vector_structure.cpp:397
Headers of the mpi interface for generalized datatypes. The subroutines and functions are in the mpi_...
abstract base class for defining matrix-vector products
Definition: vector_structure.hpp:363
abstract base class for defining preconditioning operation
Definition: vector_structure.hpp:380
virtual ~CPreconditioner()=0
class destructor
Definition: vector_structure.hpp:386
inline subroutines of the vector_structure.hpp file.
virtual ~CMatrixVectorProduct()=0
class destructor
Definition: vector_structure.hpp:369
Class for holding and manipulating vectors needed by linear solvers.
Definition: vector_structure.hpp:60