Class ae108::cpppetsc::Vector
template <class Policy>
ClassList > ae108 > cpppetsc > Vector
Classes
| Type | Name | 
|---|---|
| class | Inserter <Mode> Provides element() and elements() access functions to set/add single/multiple elements. These calls can be chained (vector is a Vector object) | 
Public Types
| Type | Name | 
|---|---|
| typedef TaggedEntity< size_type, struct GlobalRowsTag > | GlobalRows | 
| typedef TaggedEntity< size_type, struct LocalRowsTag > | LocalRows | 
| typedef Matrix< Policy > | matrix_type | 
| typedef PetscReal | real_type | 
| typedef PetscInt | size_type | 
| typedef PetscScalar | value_type | 
Public Functions
| Type | Name | 
|---|---|
| Vector (const size_type global_size) Allocates a vector of length global_size. | |
| Vector (const LocalRows localRows, GlobalRows globalRows) Allocates a vector with the provided layout. | |
| Vector (const size_type globalRows, const value_type value) Allocates a vector of length globalRows and initializes the vector to value. | |
| Vector (UniqueEntity< Vec > vec) Wraps the given UniqueEntity in a Vector . | |
| Inserter< ADD_VALUES > | add () Add elements to current elements. See the documentation of the Inserter class for more information on how to use the return value. | 
| void | addAx (const matrix_type & A, const distributed< Vector > & x) Adds A * x to the vector. | 
| Vec | data () const Returns the internal vector. | 
| void | fill (const value_type value) Set all elements of the vector to value. | 
| std::pair< size_type, size_type > | localRowRange () const Returns the local row indices in the format: | 
| size_type | localSize () const Returns the local size of the vector. | 
| auto | localValues () const Returns a loopable range of the local values. | 
| real_type | norm () const Computes the 2-norm of the vector. | 
| value_type | operator() (const size_type index) const Access the element at index. | 
| value_type | operator[] (const size_type index) const Access the element at index. | 
| void | print () const Print the vector to world stdout. | 
| Inserter< INSERT_VALUES > | replace () Replace elements with different elements. See the documentation of the Inserter class for more information on how to use the return value. | 
| void | scale (const value_type factor) Scale the vector by factor. | 
| void | setZero () Replaces all entries by zero. | 
| size_type | size () const Returns the global size of the vector. | 
| void | timesAlphaPlusBetaX (const value_type alpha, const value_type beta, const Vector & x) Sets the vector to alpha * (current value) + beta * x. | 
| void | timesAlphaPlusBetaXPlusGammaY (const value_type alpha, const value_type beta, const Vector & x, const value_type gamma, const Vector & y) Sets the vector to alpha * (current value) + beta * x + gamma * y. | 
Public Static Functions
| Type | Name | 
|---|---|
| global< Vector > | fromDistributed (const distributed< Vector > & vector) Creates a new full sequential copy of the vector. | 
| global< Vector > | fromDistributedInCanonicalOrder (const distributed< Vector > & vector, const Mesh< Policy > & mesh) Creates a new full sequential copy of the vector. | 
| distributed< Vector > | fromGlobalMesh (const Mesh< Policy > & mesh) Creates a global vector with a structure defined by the given mesh. The vector is zero-initialized. | 
| Vector | fromLayoutOf (const Vector & vector) Returns a zero initialized vector with the same layout as the parameter. | 
| Vector | fromList (const std::initializer_list< value_type > list) Constructs a vector with the provided entries. | 
| local< Vector > | fromLocalMesh (const Mesh< Policy > & mesh) Creates a local vector with a structure defined by the given mesh. The vector is zero-initialized. | 
Public Types Documentation
typedef GlobalRows
using ae108::cpppetsc::Vector< Policy >::GlobalRows =  TaggedEntity<size_type, struct GlobalRowsTag>;
typedef LocalRows
using ae108::cpppetsc::Vector< Policy >::LocalRows =  TaggedEntity<size_type, struct LocalRowsTag>;
typedef matrix_type
using ae108::cpppetsc::Vector< Policy >::matrix_type =  Matrix<Policy>;
typedef real_type
using ae108::cpppetsc::Vector< Policy >::real_type =  PetscReal;
typedef size_type
using ae108::cpppetsc::Vector< Policy >::size_type =  PetscInt;
typedef value_type
using ae108::cpppetsc::Vector< Policy >::value_type =  PetscScalar;
Public Functions Documentation
function Vector [1/4]
Allocates a vector of length global_size.
explicit ae108::cpppetsc::Vector::Vector (
    const size_type global_size
) 
Remark:
Does not initialize the vector.
function Vector [2/4]
Allocates a vector with the provided layout.
explicit ae108::cpppetsc::Vector::Vector (
    const LocalRows localRows,
    GlobalRows globalRows
) 
Remark:
Does not initialize the vector.
function Vector [3/4]
Allocates a vector of length globalRows and initializes the vector to value.
explicit ae108::cpppetsc::Vector::Vector (
    const size_type globalRows,
    const value_type value
) 
function Vector [4/4]
Wraps the given UniqueEntity in a Vector .
explicit ae108::cpppetsc::Vector::Vector (
    UniqueEntity< Vec > vec
) 
function add
Add elements to current elements. See the documentation of the Inserter class for more information on how to use the return value.
Inserter < ADD_VALUES > ae108::cpppetsc::Vector::add () 
Remark:
Automatically broadcasts changes. Do not use add and replace Inserters at the same time.
function addAx
Adds A * x to the vector.
void ae108::cpppetsc::Vector::addAx (
    const matrix_type & A,
    const distributed < Vector > & x
) 
function data
Returns the internal vector.
Vec ae108::cpppetsc::Vector::data () const
Remark:
For internal use only.
function fill
Set all elements of the vector to value.
void ae108::cpppetsc::Vector::fill (
    const value_type value
) 
function localRowRange
Returns the local row indices in the format:
std::pair< size_type, size_type > ae108::cpppetsc::Vector::localRowRange () const
(first row index, last row index + 1).
function localSize
Returns the local size of the vector.
size_type ae108::cpppetsc::Vector::localSize () const
function localValues
Returns a loopable range of the local values.
auto ae108::cpppetsc::Vector::localValues () const
function norm
Computes the 2-norm of the vector.
real_type ae108::cpppetsc::Vector::norm () const
function operator()
Access the element at index.
value_type ae108::cpppetsc::Vector::operator() (
    const size_type index
) const
function operator[]
Access the element at index.
value_type ae108::cpppetsc::Vector::operator[] (
    const size_type index
) const
function print
Print the vector to world stdout.
void ae108::cpppetsc::Vector::print () const
function replace
Replace elements with different elements. See the documentation of the Inserter class for more information on how to use the return value.
Inserter < INSERT_VALUES > ae108::cpppetsc::Vector::replace () 
Remark:
Automatically broadcasts changes. Do not use add and replace Inserters at the same time.
function scale
Scale the vector by factor.
void ae108::cpppetsc::Vector::scale (
    const value_type factor
) 
function setZero
Replaces all entries by zero.
void ae108::cpppetsc::Vector::setZero () 
function size
Returns the global size of the vector.
size_type ae108::cpppetsc::Vector::size () const
function timesAlphaPlusBetaX
Sets the vector to alpha * (current value) + beta * x.
void ae108::cpppetsc::Vector::timesAlphaPlusBetaX (
    const value_type alpha,
    const value_type beta,
    const Vector & x
) 
function timesAlphaPlusBetaXPlusGammaY
Sets the vector to alpha * (current value) + beta * x + gamma * y.
void ae108::cpppetsc::Vector::timesAlphaPlusBetaXPlusGammaY (
    const value_type alpha,
    const value_type beta,
    const Vector & x,
    const value_type gamma,
    const Vector & y
) 
Public Static Functions Documentation
function fromDistributed
Creates a new full sequential copy of the vector.
static global < Vector > ae108::cpppetsc::Vector::fromDistributed (
    const distributed < Vector > & vector
) 
function fromDistributedInCanonicalOrder
Creates a new full sequential copy of the vector.
static global < Vector > ae108::cpppetsc::Vector::fromDistributedInCanonicalOrder (
    const distributed < Vector > & vector,
    const Mesh < Policy > & mesh
) 
Precondition:
The vector is in the default "Mesh"-based ordering.
Postcondition:
The vector is in the canonical ordering: [dof 0 for element 0, dof 1 for element 0, ..., dof 0 for element 1, ..., dof 0 for vertex 0, dof 1 for vertex 0, ..., dof 0 for vertex 1, ...]
function fromGlobalMesh
Creates a global vector with a structure defined by the given mesh. The vector is zero-initialized.
static distributed < Vector > ae108::cpppetsc::Vector::fromGlobalMesh (
    const Mesh < Policy > & mesh
) 
function fromLayoutOf
Returns a zero initialized vector with the same layout as the parameter.
static Vector ae108::cpppetsc::Vector::fromLayoutOf (
    const Vector & vector
) 
function fromList
Constructs a vector with the provided entries.
static Vector ae108::cpppetsc::Vector::fromList (
    const std::initializer_list< value_type > list
) 
function fromLocalMesh
Creates a local vector with a structure defined by the given mesh. The vector is zero-initialized.
static local < Vector > ae108::cpppetsc::Vector::fromLocalMesh (
    const Mesh < Policy > & mesh
) 
The documentation for this class was generated from the following file cpppetsc/src/include/ae108/cpppetsc/Vector.h