INMOST
A toolkit for distributed mathematical modeling
INMOST::Sparse::Vector Class Reference

Distributed vector class. More...

#include <inmost_sparse.h>

Public Types

typedef interval< INMOST_DATA_ENUM_TYPE, INMOST_DATA_REAL_TYPE > Entries
 Type for representation of the local array of values.
 
typedef Entries::iterator iterator
 Type for the iterator over vector of the values.
 
typedef Entries::const_iterator const_iterator
 Type for the iterator over vector of the constant values.
 

Public Member Functions

 Vector (std::string _name="", INMOST_DATA_ENUM_TYPE start=0, INMOST_DATA_ENUM_TYPE end=0, INMOST_MPI_Comm _comm=INMOST_MPI_COMM_WORLD)
 Main constructor of the Vector class. More...
 
 Vector (const Vector &other)
 Copy constructor. More...
 
Vectoroperator= (Vector const &other)
 Assignment operator. More...
 
 ~Vector ()
 Delete data of the vector.
 
INMOST_DATA_REAL_TYPE & operator[] (INMOST_DATA_ENUM_TYPE i)
 Return reference to i-th element of the vector.
 
INMOST_DATA_REAL_TYPE operator[] (INMOST_DATA_ENUM_TYPE i) const
 Return i-th element of the vector.
 
INMOST::Matrix< INMOST_DATA_REAL_TYPE > operator[] (const INMOST::AbstractMatrix< INMOST_DATA_INTEGER_TYPE > &rows) const
 Return a block of elements.
 
INMOST::Matrix< value_referenceoperator[] (const INMOST::AbstractMatrix< INMOST_DATA_INTEGER_TYPE > &rows)
 Return a block of elements.
 
INMOST_DATA_ENUM_TYPE Size () const
 Return the global size of the vector.
 
iterator Begin ()
 Iterator pointing to the first value of the vector.
 
const_iterator Begin () const
 Iterator pointing to the first constant value of the vector.
 
iterator End ()
 Iterator pointing behind the last value of the vector.
 
const_iterator End () const
 Iterator pointing behind the last constant value of the vector.
 
bool Empty () const
 Test is there any data in the vector.
 
void SetInterval (INMOST_DATA_ENUM_TYPE start, INMOST_DATA_ENUM_TYPE end)
 Set the start and the end of the distributed vector interval. More...
 
void GetInterval (INMOST_DATA_ENUM_TYPE &start, INMOST_DATA_ENUM_TYPE &end) const
 Get the start and the end of the distributed vector interval. More...
 
void ShiftInterval (INMOST_DATA_ENUM_TYPE shift)
 Move starting position of local indexes. More...
 
INMOST_DATA_ENUM_TYPE GetFirstIndex () const
 Get the first index of the distributed vector interval.
 
INMOST_DATA_ENUM_TYPE GetLastIndex () const
 Get the last index of the distributed vector interval.
 
INMOST_MPI_Comm GetCommunicator () const
 Get the communicator which the vector is associated with.
 
void Swap (Vector &other)
 Exchange all the data with another vector. More...
 
void Save (std::string file)
 Save the distributed vector to a single data file using parallel MPI I/O.
 
void Load (std::string file, INMOST_DATA_ENUM_TYPE mbeg=ENUMUNDEF, INMOST_DATA_ENUM_TYPE mend=ENUMUNDEF, std::string file_ord="")
 Load the vector from a single data file using the specified interval. More...
 
bool & isParallel ()
 Test whether the vector was assigned an extended range of values via OrderInfo class.
 
std::string GetName ()
 Get the vector name specified in the main constructor.
 
void Clear ()
 Clear all data of the current vector.
 

Detailed Description

Distributed vector class.

This class can be used to store both local and distributed dense data of real type. For example, to form the right-hand side or initial guess to the solution.

See also
Solve

Definition at line 74 of file inmost_sparse.h.

Constructor & Destructor Documentation

◆ Vector() [1/2]

INMOST::Sparse::Vector::Vector ( std::string  _name = "",
INMOST_DATA_ENUM_TYPE  start = 0,
INMOST_DATA_ENUM_TYPE  end = 0,
INMOST_MPI_Comm  _comm = INMOST_MPI_COMM_WORLD 
)

Main constructor of the Vector class.

Parameters
_nameName of the vector, empty string by default.
startStart of the local data interval.
endEnd of the local data interval.
_commCommunicator for parallel data exchanges, MPI_COMM_WORLD by default.

◆ Vector() [2/2]

INMOST::Sparse::Vector::Vector ( const Vector other)

Copy constructor.

Parameters
otherAnother vector.

Member Function Documentation

◆ GetInterval()

void INMOST::Sparse::Vector::GetInterval ( INMOST_DATA_ENUM_TYPE &  start,
INMOST_DATA_ENUM_TYPE &  end 
) const
inline

Get the start and the end of the distributed vector interval.

Parameters
startRecord the first index of the local part of the vector into this variable.
endRecord the last index of the local part of the vector into this variable.

Definition at line 129 of file inmost_sparse.h.

◆ Load()

void INMOST::Sparse::Vector::Load ( std::string  file,
INMOST_DATA_ENUM_TYPE  mbeg = ENUMUNDEF,
INMOST_DATA_ENUM_TYPE  mend = ENUMUNDEF,
std::string  file_ord = "" 
)

Load the vector from a single data file using the specified interval.

If interval is not specified, then it will be automatically constructed, with the about equal block size (the last block may has larger dimension).

◆ operator=()

Vector& INMOST::Sparse::Vector::operator= ( Vector const &  other)

Assignment operator.

Parameters
otherAnother vector.

◆ SetInterval()

void INMOST::Sparse::Vector::SetInterval ( INMOST_DATA_ENUM_TYPE  start,
INMOST_DATA_ENUM_TYPE  end 
)
inline

Set the start and the end of the distributed vector interval.

Parameters
startThe first index of the local part of the vector.
endThe last index of the local part of the vector.

Definition at line 125 of file inmost_sparse.h.

◆ ShiftInterval()

void INMOST::Sparse::Vector::ShiftInterval ( INMOST_DATA_ENUM_TYPE  shift)
inline

Move starting position of local indexes.

Parameters
shiftNumber of positions to shift indices.

Definition at line 132 of file inmost_sparse.h.

◆ Swap()

void INMOST::Sparse::Vector::Swap ( Vector other)
inline

Exchange all the data with another vector.

Parameters
otherAnother vector.

Definition at line 141 of file inmost_sparse.h.


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