Public Types | |
typedef Allocator::value_type | value_type |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
typedef PETScSeq | storage |
Public Member Functions | |
Vector () | |
Default constructor. | |
Vector (int i, MPI_Comm mpi_communicator=MPI_COMM_WORLD) | |
Main constructor. | |
Vector (Vec &petsc_vector) | |
Copy constructor. | |
Vector (const Vector< T, PETScSeq, Allocator > &A) | |
Copy constructor. | |
~Vector () | |
Destructor. | |
void | Copy (const Vector< T, PETScSeq, Allocator > &X) |
Duplicates a vector. | |
void | Copy (const Vec &petsc_vector) |
Duplicates a vector. | |
void | Reallocate (int i) |
Vector reallocation. | |
Vector< T, PETScSeq, Allocator > & | operator= (const Vector< T, PETScSeq, Allocator > &X) |
Duplicates a vector (assignment operator). | |
template<class T0 > | |
Vector< T, PETScSeq, Allocator > & | operator= (const T0 &X) |
Fills the vector with a given value. | |
template<class T0 > | |
Vector< T, PETScSeq, Allocator > & | operator*= (const T0 &X) |
Multiplies a vector by a scalar. | |
void | Print () const |
Displays the vector. | |
void | Write (string FileName, bool with_size=true) const |
Writes the vector in a file. | |
void | Write (ostream &FileStream, bool with_size=true) const |
Writes the vector in a file stream. | |
void | WriteText (string FileName) const |
Writes the vector in a file. | |
void | WriteText (ostream &FileStream) const |
Writes the vector in a file stream. | |
void | Read (string FileName, bool with_size=true) |
Sets the vector from a file. | |
void | Read (istream &FileStream, bool with_size=true) |
Sets the vector from a file stream. | |
void | ReadText (string FileName) |
Sets the vector from a file. | |
void | ReadText (istream &FileStream) |
Sets the vector from a file stream. | |
Vec & | GetPetscVector () |
Returns a reference on the inner petsc vector. | |
const Vec & | GetPetscVector () const |
Returns a const reference on the inner petsc vector. | |
void | SetCommunicator (MPI_Comm mpi_communicator) |
Sets the MPI communicator. | |
void | Clear () |
Clears the vector. | |
void | Resize (int i) |
Changes the length of the vector, and keeps previous values. | |
void | SetData (int i, pointer data) |
void | Nullify () |
Clears the vector without releasing memory. | |
value_type | operator() (int i) const |
Access operator. | |
void | SetBuffer (int i, T value, InsertMode insert_mode=INSERT_VALUES) |
Inserts or adds values into certain locations of a vector. | |
void | Flush () |
Assembles the PETSc vector. | |
void | GetProcessorRange (int &i, int &j) const |
Returns the range of indices owned by this processor. | |
void | Copy (const PETScVector< T, Allocator > &X) |
Duplicates a vector. | |
void | Append (const T &x) |
Appends an element to the vector. | |
int | GetDataSize () const |
Returns the number of elements stored. | |
int | GetLocalM () const |
Returns the number of elements stored. | |
void | Zero () |
Sets all elements to zero. | |
void | Fill () |
Fills the vector with 0, 1, 2, ... | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the vector with a given value. | |
void | FillRand () |
Fills the vector randomly. | |
value_type | GetNormInf () const |
Returns the infinite norm. | |
int | GetNormInfIndex () const |
Returns the index of the highest absolute value. | |
int | GetM () const |
Returns the number of elements. | |
int | GetLength () const |
Returns the number of elements. | |
int | GetSize () const |
Returns the number of elements stored. | |
pointer | GetData () const |
Returns a pointer to data_ (stored data). | |
const_pointer | GetDataConst () const |
Returns a const pointer to data_ (stored data). | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array (data_). | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array (data_). | |
Public Attributes | |
Vec | petsc_vector_ |
Encapsulated PETSc vector. | |
MPI_Comm | mpi_communicator_ |
The MPI communicator to use. | |
bool | petsc_vector_deallocated_ |
Boolean to indicate if the inner PETSc vector is destroyed or not. | |
Protected Attributes | |
int | m_ |
pointer | data_ |
Static Protected Attributes | |
static Allocator | vect_allocator_ |
Definition at line 105 of file PetscVector.hxx.
Seldon::Vector< T, PETScSeq, Allocator >::Vector | ( | ) | [explicit] |
Seldon::Vector< T, PETScSeq, Allocator >::Vector | ( | int | i, | |
MPI_Comm | mpi_communicator = MPI_COMM_WORLD | |||
) | [explicit] |
Main constructor.
Builds a vector of a given size.
[in] | i | length of the vector. |
[in] | mpi_communicator | MPI communicator to use. |
Definition at line 500 of file PetscVector.cxx.
Seldon::Vector< T, PETScSeq, Allocator >::Vector | ( | Vec & | petsc_vector | ) |
Copy constructor.
Builds a copy of a vector.
] | petsc_vector vector to be copied. |
Definition at line 520 of file PetscVector.cxx.
Seldon::Vector< T, PETScSeq, Allocator >::Vector | ( | const Vector< T, PETScSeq, Allocator > & | V | ) |
Copy constructor.
Builds a copy of a vector.
V | vector to be copied. |
Definition at line 531 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Append | ( | const T & | x | ) | [inline, inherited] |
Appends an element to the vector.
x | element to be appended. |
Definition at line 332 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Clear | ( | ) | [inline, inherited] |
Clears the vector.
Destructs the vector.
Definition at line 142 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Copy | ( | const Vector< T, PETScSeq, Allocator > & | X | ) |
Duplicates a vector.
X | vector to be copied. |
Definition at line 557 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Copy | ( | const Vec & | X | ) |
Duplicates a vector.
X | vector to be copied. |
Reimplemented from Seldon::PETScVector< T, Allocator >.
Definition at line 571 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Copy | ( | const PETScVector< T, Allocator > & | X | ) | [inline, inherited] |
Duplicates a vector.
X | vector to be copied. |
Definition at line 293 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Fill | ( | const T0 & | x | ) | [inherited] |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 408 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::FillRand | ( | ) | [inherited] |
Fills the vector randomly.
Definition at line 422 of file PetscVector.cxx.
Vector_Base< T, Allocator >::pointer Seldon::Vector_Base< T, Allocator >::GetData | ( | ) | const [inherited] |
Returns a pointer to data_ (stored data).
Definition at line 156 of file Vector.cxx.
Vector_Base< T, Allocator >::const_pointer Seldon::Vector_Base< T, Allocator >::GetDataConst | ( | ) | const [inherited] |
Returns a const pointer to data_ (stored data).
Definition at line 168 of file Vector.cxx.
const void * Seldon::Vector_Base< T, Allocator >::GetDataConstVoid | ( | ) | const [inherited] |
Returns a pointer of type "const void*" to the data array (data_).
Definition at line 191 of file Vector.cxx.
int Seldon::PETScVector< T, Allocator >::GetDataSize | ( | ) | const [inherited] |
Returns the number of elements stored.
Definition at line 348 of file PetscVector.cxx.
void * Seldon::Vector_Base< T, Allocator >::GetDataVoid | ( | ) | const [inherited] |
Returns a pointer of type "void*" to the data array (data_).
Definition at line 180 of file Vector.cxx.
int Seldon::Vector_Base< T, Allocator >::GetLength | ( | ) | const [inherited] |
Returns the number of elements.
Reimplemented in Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >, and Seldon::Vector< T, Collection, Allocator >.
Definition at line 133 of file Vector.cxx.
int Seldon::PETScVector< T, Allocator >::GetLocalM | ( | ) | const [inherited] |
Returns the number of elements stored.
Definition at line 359 of file PetscVector.cxx.
int Seldon::Vector_Base< T, Allocator >::GetM | ( | ) | const [inherited] |
Returns the number of elements.
Reimplemented in Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >, and Seldon::Vector< T, Collection, Allocator >.
Definition at line 122 of file Vector.cxx.
PETScVector< T, Allocator >::value_type Seldon::PETScVector< T, Allocator >::GetNormInf | ( | ) | const [inherited] |
Returns the infinite norm.
Definition at line 447 of file PetscVector.cxx.
int Seldon::PETScVector< T, Allocator >::GetNormInfIndex | ( | ) | const [inherited] |
Returns the index of the highest absolute value.
Definition at line 462 of file PetscVector.cxx.
const Vec & Seldon::PETScVector< T, Allocator >::GetPetscVector | ( | ) | const [inherited] |
Returns a const reference on the inner petsc vector.
Definition at line 114 of file PetscVector.cxx.
Vec & Seldon::PETScVector< T, Allocator >::GetPetscVector | ( | ) | [inherited] |
Returns a reference on the inner petsc vector.
Definition at line 103 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::GetProcessorRange | ( | int & | i, | |
int & | j | |||
) | const [inline, inherited] |
Returns the range of indices owned by this processor.
The vectors are laid out with the first elements on the first processor, next elements on the second, etc. If the current processor is , this method returns in i and in j. If i is set to PETSC_NULL on entry, it is not modified by this function. Same is true for j.
[in,out] | i | the index of the first local element. |
[in,out] | j | the index of the last local element, plus 1. |
Definition at line 277 of file PetscVector.cxx.
int Seldon::Vector_Base< T, Allocator >::GetSize | ( | ) | const [inherited] |
Returns the number of elements stored.
Definition at line 144 of file Vector.cxx.
void Seldon::PETScVector< T, Allocator >::Nullify | ( | ) | [inherited] |
Clears the vector without releasing memory.
On exit, the vector is empty and the memory has not been released. It is useful for low level manipulations on a Vector instance.
Definition at line 195 of file PetscVector.cxx.
PETScVector< T, Allocator >::value_type Seldon::PETScVector< T, Allocator >::operator() | ( | int | i | ) | const [inline, inherited] |
Access operator.
i | index. |
Definition at line 213 of file PetscVector.cxx.
Vector< T, PETScSeq, Allocator > & Seldon::Vector< T, PETScSeq, Allocator >::operator*= | ( | const T0 & | alpha | ) | [inline] |
Multiplies a vector by a scalar.
alpha | scalar. |
Definition at line 635 of file PetscVector.cxx.
Vector< T, PETScSeq, Allocator > & Seldon::Vector< T, PETScSeq, Allocator >::operator= | ( | const Vector< T, PETScSeq, Allocator > & | X | ) | [inline] |
Duplicates a vector (assignment operator).
X | vector to be copied. |
Definition at line 607 of file PetscVector.cxx.
Vector< T, PETScSeq, Allocator > & Seldon::Vector< T, PETScSeq, Allocator >::operator= | ( | const T0 & | x | ) |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 621 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Read | ( | string | FileName, | |
bool | with_size = true | |||
) |
Sets the vector from a file.
Sets the vector according to a binary file that stores the length of the vector (integer) and all elements.
FileName | file name. | |
with_size | if set to 'false', the length of the vector is not available in the file. In this case, the current size N of the vector is unchanged, and N elements are read in the file. |
Definition at line 740 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Read | ( | istream & | FileStream, | |
bool | with_size = true | |||
) |
Sets the vector from a file stream.
Sets the vector according to a binary file stream that stores the length of the vector (integer) and all elements.
FileStream | file stream. | |
with_size | if set to 'false', the length of the vector is not available in the stream. In this case, the current size N of the vector is unchanged, and N elements are read in the stream. |
Definition at line 766 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::ReadText | ( | istream & | FileStream | ) |
Sets the vector from a file stream.
Sets all elements of the vector according to a text format. The length is not stored.
FileStream | file stream. |
Definition at line 794 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::ReadText | ( | string | FileName | ) |
Sets the vector from a file.
Sets all elements of the vector according to a text format. The length is not stored.
FileName | file name. |
Definition at line 780 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Reallocate | ( | int | i | ) | [inline] |
Vector reallocation.
The vector is resized.
i | new length of the vector. |
Definition at line 586 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Resize | ( | int | n | ) | [inline, inherited] |
Changes the length of the vector, and keeps previous values.
Reallocates the vector to size i. Previous values are kept.
[in] | n | new length of the vector. |
Definition at line 159 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::SetBuffer | ( | int | i, | |
T | value, | |||
InsertMode | insert_mode = INSERT_VALUES | |||
) | [inline, inherited] |
Inserts or adds values into certain locations of a vector.
[in] | i | index where to insert the value. |
[in] | value | the value to insert. |
[in] | insert_mode | either INSERT_VALUES or ADD_VALUES, where ADD_VALUES adds the value to the entry, and INSERT_VALUES replaces existing entry with new value. |
Definition at line 242 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::SetCommunicator | ( | MPI_Comm | mpi_communicator | ) | [inherited] |
Sets the MPI communicator.
[in] | mpi_communicator | the mpi communicator to be set. |
Definition at line 125 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Write | ( | ostream & | FileStream, | |
bool | with_size = true | |||
) | const |
Writes the vector in a file stream.
The length of the vector (integer) and all elements of the vector are stored in binary format.
FileStream | file stream. | |
with_size | if set to 'false', the length of the vector is not saved. |
Definition at line 683 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::Write | ( | string | FileName, | |
bool | with_size = true | |||
) | const |
Writes the vector in a file.
The length of the vector (integer) and all elements of the vector are stored in binary format.
FileName | file name. | |
with_size | if set to 'false', the length of the vector is not saved. |
Definition at line 667 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::WriteText | ( | string | FileName | ) | const |
Writes the vector in a file.
All elements of the vector are stored in text format. The length is not stored.
FileName | file name. |
Definition at line 697 of file PetscVector.cxx.
void Seldon::Vector< T, PETScSeq, Allocator >::WriteText | ( | ostream & | FileStream | ) | const |
Writes the vector in a file stream.
All elements of the vector are stored in text format. The length is not stored.
FileStream | file stream. |
Definition at line 722 of file PetscVector.cxx.
void Seldon::PETScVector< T, Allocator >::Zero | ( | ) | [inherited] |
Sets all elements to zero.
Definition at line 378 of file PetscVector.cxx.