SU2
Public Member Functions | Friends | List of all members
CSysVector Class Reference

Class for holding and manipulating vectors needed by linear solvers. More...

#include <vector_structure.hpp>

Public Member Functions

 CSysVector (void)
 default constructor of the class.
 
 CSysVector (const unsigned long &size, const su2double &val=0.0)
 constructor of the class. More...
 
 CSysVector (const unsigned long &numBlk, const unsigned long &numBlkDomain, const unsigned short &numVar, const su2double &val=0.0)
 constructor of the class. More...
 
 CSysVector (const CSysVector &u)
 copy constructor of the class. More...
 
void SetValZero (void)
 Sets to zero all the entries of the vector.
 
 CSysVector (const unsigned long &size, const su2double *u_array)
 constructor from array More...
 
 CSysVector (const unsigned long &numBlk, const unsigned long &numBlkDomain, const unsigned short &numVar, const su2double *u_array)
 constructor from array More...
 
virtual ~CSysVector ()
 class destructor
 
void Initialize (const unsigned long &numBlk, const unsigned long &numBlkDomain, const unsigned short &numVar, const su2double &val=0.0)
 Initialize the class. More...
 
unsigned long GetLocSize () const
 return the number of local elements in the CSysVector
 
unsigned long GetSize () const
 return the size of the CSysVector (over all processors)
 
unsigned short GetNVar () const
 return the number of variables at each block (typically number per node)
 
unsigned long GetNBlk () const
 return the number of blocks (typically number of nodes locally)
 
unsigned long GetNBlkDomain () const
 return the number of blocks (typically number of nodes locally)
 
void Equals_AX (const su2double &a, CSysVector &x)
 set calling CSysVector to scaling of another CSysVector More...
 
void Plus_AX (const su2double &a, CSysVector &x)
 adds a scaled CSysVector to calling CSysVector More...
 
void Equals_AX_Plus_BY (const su2double &a, CSysVector &x, const su2double &b, CSysVector &y)
 general linear combination of two CSysVectors More...
 
CSysVectoroperator= (const CSysVector &u)
 assignment operator with deep copy More...
 
CSysVectoroperator= (const su2double &val)
 CSysVector=su2double assignment operator. More...
 
CSysVector operator+ (const CSysVector &u) const
 addition operator More...
 
CSysVectoroperator+= (const CSysVector &u)
 compound addition-assignment operator More...
 
CSysVector operator- (const CSysVector &u) const
 subtraction operator More...
 
CSysVectoroperator-= (const CSysVector &u)
 compound subtraction-assignment operator More...
 
CSysVector operator* (const su2double &val) const
 vector * scalar multiplication operator More...
 
CSysVectoroperator*= (const su2double &val)
 compound scalar multiplication-assignment operator More...
 
CSysVector operator/ (const su2double &val) const
 vector-scalar division operator (no scalar/vector operator) More...
 
CSysVectoroperator/= (const su2double &val)
 compound scalar division-assignment operator More...
 
su2double & operator[] (const unsigned long &i)
 indexing operator with assignment permitted More...
 
const su2double & operator[] (const unsigned long &i) const
 indexing operator with assignment not permitted More...
 
su2double norm () const
 the L2 norm of the CSysVector More...
 
void CopyToArray (su2double *u_array)
 copies the contents of the calling CSysVector into an array More...
 
void SubtractBlock (unsigned long val_ipoint, su2double *val_residual)
 Subtract val_residual to the residual. More...
 
void AddBlock (unsigned long val_ipoint, su2double *val_residual)
 Add val_residual to the residual. More...
 
void SetBlock (unsigned long val_ipoint, unsigned short val_var, su2double val_residual)
 Set val_residual to the residual. More...
 
void SetBlock (unsigned long val_ipoint, su2double *val_residual)
 Set val_residual to the residual. More...
 
void SetBlock_Zero (unsigned long val_ipoint)
 Set the residual to zero. More...
 
void SetBlock_Zero (unsigned long val_ipoint, unsigned short val_var)
 Set the velocity residual to zero. More...
 
su2double * GetBlock (unsigned long val_ipoint)
 Get the value of the residual. More...
 
su2double GetBlock (unsigned long val_ipoint, unsigned short val_var)
 Get the value of the residual. More...
 

Friends

CSysVector operator* (const su2double &val, const CSysVector &u)
 scalar * vector multiplication operator More...
 
su2double dotProd (const CSysVector &u, const CSysVector &v)
 dot-product between two CSysVectors More...
 

Detailed Description

Class for holding and manipulating vectors needed by linear solvers.

Author
J. Hicken.
Version
5.0.0 "Raven"

We could use the STL vector as a base class here, but this gives us more flexibility with the underlying data (e.g. we may decide to use a block storage scheme rather than a continuous storage scheme).

Constructor & Destructor Documentation

§ CSysVector() [1/5]

CSysVector::CSysVector ( const unsigned long &  size,
const su2double &  val = 0.0 
)

constructor of the class.

Parameters
[in]size- number of elements locally
[in]val- default value for elements

§ CSysVector() [2/5]

CSysVector::CSysVector ( const unsigned long &  numBlk,
const unsigned long &  numBlkDomain,
const unsigned short &  numVar,
const su2double &  val = 0.0 
)

constructor of the class.

Parameters
[in]numBlk- number of blocks locally
[in]numBlkDomain
[in]numVar- number of variables in each block
[in]val- default value for elements

§ CSysVector() [3/5]

CSysVector::CSysVector ( const CSysVector u)

copy constructor of the class.

Parameters
[in]u- CSysVector that is being copied

§ CSysVector() [4/5]

CSysVector::CSysVector ( const unsigned long &  size,
const su2double *  u_array 
)
explicit

constructor from array

Parameters
[in]size- number of elements locally
[in]u_array- vector stored as array being copied

§ CSysVector() [5/5]

CSysVector::CSysVector ( const unsigned long &  numBlk,
const unsigned long &  numBlkDomain,
const unsigned short &  numVar,
const su2double *  u_array 
)
explicit

constructor from array

Parameters
[in]numBlk- number of blocks locally
[in]numBlkDomain- number of blocks locally (without g cells)
[in]numVar- number of variables in each block
[in]u_array- vector stored as array being copied

Member Function Documentation

§ AddBlock()

void CSysVector::AddBlock ( unsigned long  val_ipoint,
su2double *  val_residual 
)

Add val_residual to the residual.

Parameters
[in]val_ipoint- index of the point where add the residual.
[in]val_residual- Value to add to the residual.

§ CopyToArray()

void CSysVector::CopyToArray ( su2double *  u_array)

copies the contents of the calling CSysVector into an array

Parameters
[out]u_array- array into which information is being copied
Precondition
u_array must be allocated and have the same size as CSysVector

§ Equals_AX()

void CSysVector::Equals_AX ( const su2double &  a,
CSysVector x 
)

set calling CSysVector to scaling of another CSysVector

Parameters
[in]a- scalar factor for x
[in]x- CSysVector that is being scaled

§ Equals_AX_Plus_BY()

void CSysVector::Equals_AX_Plus_BY ( const su2double &  a,
CSysVector x,
const su2double &  b,
CSysVector y 
)

general linear combination of two CSysVectors

Parameters
[in]a- scalar factor for x
[in]x- first CSysVector in linear combination
[in]b- scalar factor for y
[in]y- second CSysVector in linear combination

§ GetBlock() [1/2]

su2double * CSysVector::GetBlock ( unsigned long  val_ipoint)

Get the value of the residual.

Parameters
[in]val_ipoint- index of the point where set the residual.
Returns
Pointer to the residual.

§ GetBlock() [2/2]

su2double CSysVector::GetBlock ( unsigned long  val_ipoint,
unsigned short  val_var 
)

Get the value of the residual.

Parameters
[in]val_ipoint- index of the point where set the residual.
[in]val_var- inde of the residual to be set.
Returns
Value of the residual.

§ Initialize()

void CSysVector::Initialize ( const unsigned long &  numBlk,
const unsigned long &  numBlkDomain,
const unsigned short &  numVar,
const su2double &  val = 0.0 
)

Initialize the class.

Parameters
[in]numBlk- number of blocks locally
[in]numBlkDomain
[in]numVar- number of variables in each block
[in]val- default value for elements

§ norm()

su2double CSysVector::norm ( ) const

the L2 norm of the CSysVector

Returns
the L2 norm

§ operator*()

CSysVector CSysVector::operator* ( const su2double &  val) const

vector * scalar multiplication operator

Parameters
[in]val- value to multiply *this by

§ operator*=()

CSysVector & CSysVector::operator*= ( const su2double &  val)

compound scalar multiplication-assignment operator

Parameters
[in]val- value to multiply calling object by

§ operator+()

CSysVector CSysVector::operator+ ( const CSysVector u) const

addition operator

Parameters
[in]u- CSysVector being added to *this

§ operator+=()

CSysVector & CSysVector::operator+= ( const CSysVector u)

compound addition-assignment operator

Parameters
[in]u- CSysVector being added to calling object

§ operator-()

CSysVector CSysVector::operator- ( const CSysVector u) const

subtraction operator

Parameters
[in]u- CSysVector being subtracted from *this

§ operator-=()

CSysVector & CSysVector::operator-= ( const CSysVector u)

compound subtraction-assignment operator

Parameters
[in]u- CSysVector being subtracted from calling object

§ operator/()

CSysVector CSysVector::operator/ ( const su2double &  val) const

vector-scalar division operator (no scalar/vector operator)

Parameters
[in]val- value to divide elements of *this by

§ operator/=()

CSysVector & CSysVector::operator/= ( const su2double &  val)

compound scalar division-assignment operator

Parameters
[in]val- value to divide elements of calling object by

§ operator=() [1/2]

CSysVector & CSysVector::operator= ( const CSysVector u)

assignment operator with deep copy

Parameters
[in]u- CSysVector whose values are being assigned

§ operator=() [2/2]

CSysVector & CSysVector::operator= ( const su2double &  val)

CSysVector=su2double assignment operator.

Parameters
[in]val- value assigned to each element of CSysVector

§ operator[]() [1/2]

su2double & CSysVector::operator[] ( const unsigned long &  i)
inline

indexing operator with assignment permitted

Parameters
[in]i= local index to access

§ operator[]() [2/2]

const su2double & CSysVector::operator[] ( const unsigned long &  i) const
inline

indexing operator with assignment not permitted

Parameters
[in]i= local index to access

§ Plus_AX()

void CSysVector::Plus_AX ( const su2double &  a,
CSysVector x 
)

adds a scaled CSysVector to calling CSysVector

Parameters
[in]a- scalar factor for x
[in]x- CSysVector that is being scaled

§ SetBlock() [1/2]

void CSysVector::SetBlock ( unsigned long  val_ipoint,
unsigned short  val_var,
su2double  val_residual 
)

Set val_residual to the residual.

Parameters
[in]val_ipoint- index of the point where set the residual.
[in]val_var- inde of the residual to be set.
[in]val_residual- Value to set to the residual.

§ SetBlock() [2/2]

void CSysVector::SetBlock ( unsigned long  val_ipoint,
su2double *  val_residual 
)

Set val_residual to the residual.

Parameters
[in]val_ipoint- index of the point where set the residual.
[in]val_residual- Value to set to the residual.

§ SetBlock_Zero() [1/2]

void CSysVector::SetBlock_Zero ( unsigned long  val_ipoint)

Set the residual to zero.

Parameters
[in]val_ipoint- index of the point where set the residual.

§ SetBlock_Zero() [2/2]

void CSysVector::SetBlock_Zero ( unsigned long  val_ipoint,
unsigned short  val_var 
)

Set the velocity residual to zero.

Parameters
[in]val_ipoint- index of the point where set the residual.
[in]val_var- inde of the residual to be set.

§ SubtractBlock()

void CSysVector::SubtractBlock ( unsigned long  val_ipoint,
su2double *  val_residual 
)

Subtract val_residual to the residual.

Parameters
[in]val_ipoint- index of the point where subtract the residual.
[in]val_residual- Value to subtract to the residual.

Friends And Related Function Documentation

§ dotProd

su2double dotProd ( const CSysVector u,
const CSysVector v 
)
friend

dot-product between two CSysVectors

Parameters
[in]u- first CSysVector in dot product
[in]v- second CSysVector in dot product

§ operator*

CSysVector operator* ( const su2double &  val,
const CSysVector u 
)
friend

scalar * vector multiplication operator

Parameters
[in]val- scalar value to multiply by
[in]u- CSysVector having its elements scaled

The documentation for this class was generated from the following files: