Class AmiVectorArray

Class Documentation

class AmiVectorArray

AmiVectorArray class.

Provides a generic interface to arrays of NVector_Serial structs

Public Functions

AmiVectorArray() = default

Default constructor.

AmiVectorArray(long int length_inner, long int length_outer)

empty constructor

Creates an std::vector<realype> and attaches the data pointer to a newly created N_VectorArray using CloneVectorArrayEmpty ensures that the N_Vector module does not try to deallocate the data vector when calling N_VDestroyVectorArray_Serial

Parameters:
  • length_inner – length of vectors

  • length_outer – number of vectors

AmiVectorArray(AmiVectorArray const &vaold)

copy constructor

Parameters:

vaold – object to copy from

~AmiVectorArray() = default
AmiVectorArray &operator=(AmiVectorArray const &other)

copy assignment operator

Parameters:

other – right hand side

Returns:

left hand side

realtype *data(int pos)

accessor to data of AmiVector elements

Parameters:

pos – index of AmiVector

Returns:

pointer to data array

realtype const *data(int pos) const

const accessor to data of AmiVector elements

Parameters:

pos – index of AmiVector

Returns:

const pointer to data array

realtype &at(int ipos, int jpos)

accessor to elements of AmiVector elements

Parameters:
Returns:

element

realtype const &at(int ipos, int jpos) const

const accessor to elements of AmiVector elements

Parameters:
Returns:

element

N_Vector *getNVectorArray()

accessor to NVectorArray

Returns:

N_VectorArray

N_Vector getNVector(int pos)

accessor to NVector element

Parameters:

pos – index of corresponding AmiVector

Returns:

N_Vector

const_N_Vector getNVector(int pos) const

const accessor to NVector element

Parameters:

pos – index of corresponding AmiVector

Returns:

N_Vector

AmiVector &operator[](int pos)

accessor to AmiVector elements

Parameters:

pos – index of AmiVector

Returns:

AmiVector

AmiVector const &operator[](int pos) const

const accessor to AmiVector elements

Parameters:

pos – index of AmiVector

Returns:

const AmiVector

int getLength() const

length of AmiVectorArray

Returns:

length

void zero()

set every AmiVector in AmiVectorArray to zero

void flatten_to_vector(std::vector<realtype> &vec) const

flattens the AmiVectorArray to a vector in row-major format

Parameters:

vec – vector into which the AmiVectorArray will be flattened. Must have length equal to number of elements.

void copy(AmiVectorArray const &other)

copies data from another AmiVectorArray

Parameters:

other – data source