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 PETScPar | storage |
typedef Allocator | allocator |
Public Member Functions | |
Vector () | |
Default constructor. More... | |
Vector (int i, MPI_Comm mpi_communicator=MPI_COMM_WORLD) | |
Main constructor. More... | |
Vector (int i, int Nlocal, MPI_Comm mpi_communicator) | |
Main constructor. More... | |
Vector (Vec &petsc_vector) | |
Copy constructor. More... | |
Vector (const Vector< T, PETScPar, Allocator > &A) | |
Copy constructor. More... | |
~Vector () | |
Destructor. | |
void | Copy (const Vector< T, PETScPar, Allocator > &X) |
Duplicates a vector. More... | |
void | Copy (const Vec &petsc_vector) |
Duplicates a vector. More... | |
void | Reallocate (int i, int local_size=PETSC_DECIDE) |
Vector reallocation. More... | |
Vector< T, PETScPar, Allocator > & | operator= (const Vector< T, PETScPar, Allocator > &X) |
Duplicates a vector (assignment operator). More... | |
template<class T0 > | |
Vector< T, PETScPar, Allocator > & | operator= (const T0 &X) |
Fills the vector with a given value. More... | |
template<class T0 > | |
Vector< T, PETScPar, Allocator > & | operator*= (const T0 &X) |
Multiplies a vector by a scalar. More... | |
void | Print () const |
Displays the vector. | |
void | Write (string FileName, bool with_size=true) const |
Writes the vector in a file. More... | |
void | Write (ostream &FileStream, bool with_size=true) const |
Writes the vector in a file stream. More... | |
void | WriteText (string FileName) const |
Writes the vector in a file. More... | |
void | WriteText (ostream &FileStream) const |
Writes the vector in a file stream. More... | |
void | Read (string FileName, bool with_size=true) |
Sets the vector from a file. More... | |
void | Read (istream &FileStream, bool with_size=true) |
Sets the vector from a file stream. More... | |
void | ReadText (string FileName) |
Sets the vector from a file. More... | |
void | ReadText (istream &FileStream) |
Sets the vector from a file stream. More... | |
Vec & | GetPetscVector () |
Returns a reference on the inner petsc vector. More... | |
const Vec & | GetPetscVector () const |
void | SetCommunicator (MPI_Comm mpi_communicator) |
Sets the MPI communicator. More... | |
void | Clear () |
Clears the vector. More... | |
void | Resize (int i) |
Changes the length of the vector, and keeps previous values. More... | |
void | SetData (int i, pointer data) |
Changes the length of the vector and sets its data array (low level method). More... | |
void | Nullify () |
Clears the vector without releasing memory. More... | |
value_type | operator() (int i) const |
Access operator. More... | |
void | SetBuffer (int i, T value, InsertMode insert_mode=INSERT_VALUES) |
Inserts or adds values into certain locations of a vector. More... | |
void | Flush () |
Assembles the PETSc vector. | |
void | GetProcessorRange (int &i, int &j) const |
Returns the range of indices owned by this processor. More... | |
void | Copy (const PETScVector< T, Allocator > &X) |
Duplicates a vector. More... | |
void | Append (const T &x) |
Appends an element to the vector. More... | |
int | GetDataSize () const |
Returns the number of elements stored. More... | |
int | GetLocalM () const |
Returns the number of elements stored. More... | |
void | Zero () |
Sets all elements to zero. More... | |
void | Fill () |
Fills the vector with 0, 1, 2, ... | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the vector with a given value. More... | |
void | FillRand () |
Fills the vector randomly. More... | |
value_type | GetNormInf () const |
Returns the infinite norm. More... | |
int | GetNormInfIndex () const |
Returns the index of the highest absolute value. More... | |
long | GetM () const |
Returns the number of elements. More... | |
size_t | GetLength () const |
Returns the number of elements. More... | |
size_t | GetSize () const |
Returns the number of elements stored. More... | |
size_t | GetMemorySize () const |
Returns the memory used by the object in bytes. More... | |
pointer | GetData () const |
Returns a pointer to data_ (stored data). More... | |
const_pointer | GetDataConst () const |
Returns a const pointer to data_ (stored data). More... | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array (data_). More... | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array (data_). More... | |
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 | |
size_t | m_ |
pointer | data_ |
Definition at line 162 of file PetscVector.hxx.
|
inlineexplicit |
Default constructor.
On exit, the vector is empty.
Definition at line 544 of file PetscVectorInline.cxx.
|
inlineexplicit |
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 561 of file PetscVectorInline.cxx.
|
inlineexplicit |
Main constructor.
Builds a vector of a given size.
[in] | i | length of the vector. |
[in] | Nlocal | size of local vector. |
[in] | mpi_communicator | MPI communicator to use. |
Definition at line 582 of file PetscVectorInline.cxx.
|
inline |
Copy constructor.
Builds a copy of a vector.
[in] | petsc_vector | vector to be copied. |
Definition at line 603 of file PetscVectorInline.cxx.
|
inline |
Copy constructor.
Builds a copy of a vector.
[in] | V | vector to be copied. |
Definition at line 614 of file PetscVectorInline.cxx.
|
inlineinherited |
Appends an element to the vector.
x | element to be appended. |
Definition at line 309 of file PetscVectorInline.cxx.
|
inlineinherited |
Clears the vector.
Destructs the vector.
Definition at line 145 of file PetscVectorInline.cxx.
|
inlineinherited |
Duplicates a vector.
X | vector to be copied. |
Definition at line 296 of file PetscVectorInline.cxx.
|
inline |
Duplicates a vector.
X | vector to be copied. |
Definition at line 655 of file PetscVectorInline.cxx.
|
inline |
Duplicates a vector.
X | vector to be copied. |
Definition at line 640 of file PetscVectorInline.cxx.
|
inherited |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 97 of file PetscVector.cxx.
|
inherited |
Fills the vector randomly.
Definition at line 111 of file PetscVector.cxx.
|
inlineinherited |
Returns a pointer to data_ (stored data).
Definition at line 177 of file VectorInline.cxx.
|
inlineinherited |
Returns a const pointer to data_ (stored data).
Definition at line 189 of file VectorInline.cxx.
|
inlineinherited |
Returns a pointer of type "const void*" to the data array (data_).
Definition at line 212 of file VectorInline.cxx.
|
inlineinherited |
Returns the number of elements stored.
Definition at line 325 of file PetscVectorInline.cxx.
|
inlineinherited |
Returns a pointer of type "void*" to the data array (data_).
Definition at line 201 of file VectorInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 142 of file VectorInline.cxx.
|
inlineinherited |
Returns the number of elements stored.
Definition at line 336 of file PetscVectorInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 131 of file VectorInline.cxx.
|
inlineinherited |
Returns the memory used by the object in bytes.
In this method, the type T is assumed to be "static" such that sizeof(T) provides the correct size
Definition at line 165 of file VectorInline.cxx.
|
inherited |
Returns the infinite norm.
Definition at line 136 of file PetscVector.cxx.
|
inherited |
Returns the index of the highest absolute value.
Definition at line 151 of file PetscVector.cxx.
|
inlineinherited |
Returns a reference on the inner petsc vector.
Returns a const reference on the inner petsc vector.
Definition at line 106 of file PetscVectorInline.cxx.
|
inlineinherited |
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 280 of file PetscVectorInline.cxx.
|
inlineinherited |
Returns the number of elements stored.
Definition at line 153 of file VectorInline.cxx.
|
inlineinherited |
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 198 of file PetscVectorInline.cxx.
|
inlineinherited |
Access operator.
i | index. |
Definition at line 216 of file PetscVectorInline.cxx.
|
inline |
Multiplies a vector by a scalar.
alpha | scalar. |
Definition at line 697 of file PetscVectorInline.cxx.
Vector< T, PETScPar, Allocator > & Seldon::Vector< T, PETScPar, Allocator >::operator= | ( | const T0 & | x | ) |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 683 of file PetscVectorInline.cxx.
|
inline |
Duplicates a vector (assignment operator).
X | vector to be copied. |
Definition at line 669 of file PetscVectorInline.cxx.
void Seldon::Vector< T, PETScPar, 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 470 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 444 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 498 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 484 of file PetscVector.cxx.
|
inline |
Vector reallocation.
The vector is resized.
i | new length of the vector. |
Definition at line 724 of file PetscVectorInline.cxx.
|
inlineinherited |
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 162 of file PetscVectorInline.cxx.
|
inlineinherited |
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 245 of file PetscVectorInline.cxx.
|
inlineinherited |
Sets the MPI communicator.
[in] | mpi_communicator | the mpi communicator to be set. |
Definition at line 128 of file PetscVectorInline.cxx.
|
inlineinherited |
Changes the length of the vector and sets its data array (low level method).
Reallocates a vector and sets the new data array. It is useful to create a vector from pre-existing data.
[in] | i | new length of the vector. |
[in] | data | the new data array. 'data' contains the new elements of the vector and must therefore contain 'i' elements. |
Definition at line 184 of file PetscVectorInline.cxx.
void Seldon::Vector< T, PETScPar, 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 364 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 348 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 415 of file PetscVector.cxx.
void Seldon::Vector< T, PETScPar, 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 389 of file PetscVector.cxx.
|
inherited |
Sets all elements to zero.
Definition at line 67 of file PetscVector.cxx.