Class BaseState

template<class T>
class BaseState

Public Functions

inline BaseState() noexcept
explicit BaseState(const int num_levs, const int length = 1, const int ncomp = 1, const T val = T())
BaseState(const amrex::Gpu::ManagedVector<T> &src, const int num_levs, const int length = 1, const int ncomp = 1)

create a BaseState object from an existing Fortran-friendly base state

BaseState(const amrex::Vector<T> &src, const int num_levs, const int length = 1, const int ncomp = 1)
BaseState(const BaseState<T> &src)

copy constructor. This makes a deep copy of the src.

~BaseState() = default
BaseState &operator=(const BaseState<T> &src) = delete
BaseState(BaseState<T> &&src) = default
BaseState &operator=(BaseState<T> &&src) = delete
inline AMREX_FORCE_INLINE BaseStateArray< T const  > array () const noexcept

return a BaseStateArray object to allow for accessing the underlying data

inline AMREX_FORCE_INLINE BaseStateArray< T > array () noexcept

return a BaseStateArray object to allow for accessing the underlying data

inline AMREX_FORCE_INLINE BaseStateArray< const T > const_array () const noexcept
inline AMREX_FORCE_INLINE T array (const int i) noexcept

return ith element of underlying data array

void define(const int num_levs, const int length = 1, const int ncomp = 1, const T val = T())

allocate memory for the BaseState

void resize(const int num_levs, const int length = 1, const int ncomp = 1, const T val = T())
void setVal(const T &val)

set to some scalar value

void setVal(const int comp, const T &val)

set the comp’th component to some scalar value

inline AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nLevels () const noexcept

number of levels in base

inline AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int length () const noexcept

number of cells in base

inline AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nComp () const noexcept

number of components

void copy(const BaseState<T> &src)

deep copy

void copy(const BaseStateArray<T> src)
void copy(const amrex::Gpu::ManagedVector<T> &src)
void copy(const amrex::Vector<T> &src)
void toVector(amrex::Vector<T> &vec) const
void toVector(amrex::Gpu::ManagedVector<T> &vec) const
void swap(BaseState<T> &src) noexcept

swap the data with src

inline T *dataPtr() noexcept
inline AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * dataPtr () const noexcept
BaseState<T> &operator+=(const T val)
BaseState<T> &operator+=(const BaseState<T> &rhs)
BaseState<T> &operator-=(const T val)
BaseState<T> &operator-=(const BaseState<T> &rhs)
BaseState<T> &operator*=(const T val)
BaseState<T> &operator*=(const BaseState<T> &rhs)
BaseState<T> operator/(const T val)
BaseState<T> &operator/=(const T val)
BaseState<T> operator/(const T val) const noexcept
BaseState<T> &operator/=(const BaseState<T> &rhs)
BaseState(const int, const int, const int, const bool) = delete

make sure that this class is never instantiated with bool

Protected Attributes

amrex::Gpu::ManagedVector<T> base_data
int nlev
int len
int nvar

Friends

template<class U>
friend BaseState<U> operator+(const U val, const BaseState<U> &p)

scalar addition to the whole base state

template<class U>
friend BaseState<U> operator+(const BaseState<U> &lhs, const BaseState<U> &rhs)

element-wise addition

template<class U>
friend BaseState<U> operator-(const U val, const BaseState<U> &p)

scalar subtraction from the whole base state

template<class U>
friend BaseState<U> operator-(const BaseState<U> &lhs, const BaseState<U> &rhs)

element-wise subtraction

template<class U>
friend BaseState<U> operator*(const U val, const BaseState<U> &p)

scalar multiplication of the whole base state

template<class U>
friend BaseState<U> operator*(const BaseState<U> &lhs, const BaseState<U> &rhs)

element-wise multiplication

template<class U>
friend BaseState<U> operator/(const U val, const BaseState<U> &p)

scalar division of the whole base state

template<class U>
friend BaseState<U> operator/(const BaseState<U> &lhs, const BaseState<U> &rhs)

element-wise division

template<class U>
friend bool operator==(const BaseState<U> &lhs, const BaseState<U> &rhs)

comparison operator

template<class U>
friend bool operator!=(const BaseState<U> &lhs, const BaseState<U> &rhs)

comparison operator