Class AmiVector
Defined in File vector.h
Class Documentation
-
class AmiVector
AmiVector class provides a generic interface to the NVector_Serial struct
Public Functions
-
AmiVector() = default
Default constructor.
-
inline explicit AmiVector(long int const length)
empty constructor
Creates an std::vector<realtype> and attaches the data pointer to a newly created N_Vector_Serial. Using N_VMake_Serial ensures that the N_Vector module does not try to deallocate the data vector when calling N_VDestroy_Serial
- Parameters:
length – number of elements in vector
-
inline explicit AmiVector(std::vector<realtype> rvec)
constructor from std::vector,
Moves data from std::vector and constructs an nvec that points to the data
- Parameters:
rvec – vector from which the data will be moved
-
inline explicit AmiVector(gsl::span<realtype const> rvec)
constructor from gsl::span,
Copy data from gsl::span and constructs a vector
- Parameters:
rvec – vector from which the data will be copied
-
inline AmiVector(AmiVector const &vold)
copy constructor
- Parameters:
vold – vector from which the data will be copied
-
inline AmiVector(AmiVector &&other) noexcept
move constructor
- Parameters:
other – vector from which the data will be moved
-
~AmiVector()
destructor
-
AmiVector &operator=(AmiVector const &other)
copy assignment operator
- Parameters:
other – right hand side
- Returns:
left hand side
-
inline AmiVector &operator*=(AmiVector const &multiplier)
operator *= (element-wise multiplication)
- Parameters:
multiplier – multiplier
- Returns:
result
-
inline AmiVector &operator/=(AmiVector const &divisor)
operator /= (element-wise division)
- Parameters:
divisor – divisor
- Returns:
result
-
inline auto begin()
Returns an iterator that points to the first element of the vector.
- Returns:
iterator that points to the first element
-
inline auto end()
Returns an iterator that points to one element after the last element of the vector.
- Returns:
iterator that points to one element after the last element
-
N_Vector getNVector()
N_Vector accessor.
- Returns:
N_Vector
-
const_N_Vector getNVector() const
N_Vector accessor.
- Returns:
N_Vector
-
int getLength() const
returns the length of the vector
- Returns:
length
-
void zero()
fills vector with zero values
-
void minus()
changes the sign of data elements
-
void set(realtype val)
sets all data elements to a specific value
- Parameters:
val – value for data elements
-
realtype &operator[](int pos)
accessor to data elements of the vector
- Parameters:
pos – index of element
- Returns:
element
-
realtype &at(int pos)
accessor to data elements of the vector
- Parameters:
pos – index of element
- Returns:
element
-
realtype const &at(int pos) const
accessor to data elements of the vector
- Parameters:
pos – index of element
- Returns:
element
-
void copy(AmiVector const &other)
copies data from another AmiVector
- Parameters:
other – data source
-
inline void abs()
Take absolute value (in-place)
-
AmiVector() = default