NodeAB
NodeAB<T1,T2> is a templated, double-indexed, dynamic storage container which stores only non-zero values of types T1 and T2. It is used as a storage unit in Storage3D container for dynamically changing fields.
The storage unit inside of the NodeAB<T1,T2> container is the DoubleIndexFieldEntry<T1,T2> which contains four members: indexA and indexB which are the integer indices of the stored entries, and the corresponding values value1<T1> and value<T2> of templated types T1 and T2 which are always stored together.
The data inside of the NodeAB container is manipulated using a number of dedicated methods:
Arithmetic operations
cppNodeAB<T1,T2> operator+(const NodeAB<T1,T2>& n);Plus operator, which adds values with identical indices from two contains. The entries with indices existing only in one of the containers are simply copied into the resulting output container. The content of both operands is not changed.
cppNodeAB<T1,T2> operator-(const NodeAB<T1,T2>& n);Minus operator, which subtracts the values with identical indices from two containers. The entries with indices existing only in the leftmost container are simply copied into the resulting output container. The entries with indices existing only in the rightmost container are copied into the resulting container with their signs inverted. The content of both operands is not changed.
cppNodeAB<T1,T2> operator*(const double n);Multiplication operator, which multiplies all values stored in the container by a specified number
nand copies the result into the output container. The content of the input container is not changed.
cppNodeAB<T1,T2>& operator=(const NodeAB<T1,T2>& n);Assignment operator, which copies the content of container
ninto the receiving container. The initial content of the receiving container is erased and all the entries stored in the right-hand-side containernare copied into it. The content of the containernis unchanged.
cppNodeAB<T1,T2>& operator+=(const NodeAB<T1,T2>& n); NodeAB<T1,T2>& operator-=(const NodeAB<T1,T2>& n); NodeAB<T1,T2>& operator*=(const double n);Arithmetic operators similar to the ordinary operators above except they modify the left-hand-side container and return a reference to it instead of returning a new container.
Data access and manipulation
cppvoid set1(const size_t n, const size_t m, const T1 value);The method, which sets
value1to a specified value following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices already exists in the container, itsvalue1is overwitten, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid set2(const size_t n, const size_t m, const T2 value);The method, which sets
value2to a specified value following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices already exists in the container, itsvalue2is overwitten, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue1.
cppT1 get1(const size_t n, const size_t m) const;The method, which returns the
value1following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices exists in the container, itsvalue1is returned, otherwise aT1-type equivalent of zero is returned. The data in the container is unmodified.
cppT2 get2(const size_t n, const size_t m) const;The method, which returns the
value2following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices exists in the container, itsvalue2is returned, otherwise aT2-type equivalent of zero is returned. The data in the container is unmodified.
cppvoid add1(const size_t n, const size_t m, const T1 value);The method, which increments the
value1by a specified value following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices already exists in the container, itsvalue1is incremented by the specified value, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid add2(const size_t n, const size_t m, const T1 value);The method, which increments the
value2by a specified value following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the enetry with the specified indices already exists in the container, itsvalue2is incremented by the specified value, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue2.
cppvoid set_sym1(const size_t n, const size_t m, const T1 value);The method, which sets
value1to a specified value ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entry. If the enetry with the specified indices already exists in the container, itsvalue1is overwitten, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid set_sym2(const size_t n, const size_t m, const T2 value);The method, which sets
value2to a specified value ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entry. If the enetry with the specified indices already exists in the container, itsvalue2is overwitten, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue1.
cppT1 get_sym1(const size_t n, const size_t m) const;The method, which returns the
value1ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entry. If the enetry with the specified indices exists in the container, itsvalue1is returned, otherwise aT1-type equivalent of zero is returned. The data in the container is unmodified.
cppT2 get_sym2(const size_t n, const size_t m) const;The method, which returns the
value2ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entry. If the enetry with the specified indices exists in the container, itsvalue2is returned, otherwise aT2-type equivalent of zero is returned. The data in the container is unmodified.
cppvoid add_sym1(const size_t n, const size_t m, const T1 value);The method, which increments the
value1by a specified value ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entry. If the enetry with the specified indices already exists in the container, itsvalue1is incremented by the specified value, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid add_sym2(const size_t n, const size_t m, const T1 value);The method, which increments the
value2by a specified value ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as single entries. If the enetry with the specified indices already exists in the container, itsvalue2is incremented by the specified value, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue2.
cppvoid set_asym1(const size_t n, const size_t m, const T1 value);The method, which sets
value1to a specified value considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices already exists in the container, itsvalue1is overwitten considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid set_asym2(const size_t n, const size_t m, const T2 value);The method, which sets
value2to a specified value considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices already exists in the container, itsvalue2is overwitten considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue1.
cppT1 get_asym1(const size_t n, const size_t m) const;The method, which returns the
value1considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices exists in the container, itsvalue1is returned considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise aT1-type equivalent of zero is returned. The data in the container is unmodified.
cppT2 get_asym2(const size_t n, const size_t m) const;The method, which returns the
value2considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices exists in the container, itsvalue2is returned considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise aT2-type equivalent of zero is returned. The data in the container is unmodified.
cppvoid add_asym1(const size_t n, const size_t m, const T1 value);The method, which increments
value1by a specified value considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices already exists in the container, itsvalue1is incremented considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue1andT2-type equivalent of zero forvalue2.
cppvoid add_asym2(const size_t n, const size_t m, const T1 value);The method, which increments
value2by a specified value considering strict index order treating entries with(n,m)index order and(m,n)index order as single entry. If the entry with the specified indices already exists in the container, itsvalue2is incremented considering index order, e.g. reversing the sign of the value if index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue2andT1-type equivalent of zero forvalue1.
cppvoid set_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which sets
value1andvalue2to the specified values following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are overwitten, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppvoid add_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which increments the
value1andvalue2by the specified values following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are incremented by the specified values, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppstd::pair<T1,T2> get_pair(const size_t n, const size_t m) const;The method, which returns a pair of
value1andvalue2following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are returned, otherwise an equivalent ofT1-type andT2-type zeros are returned.
cppvoid set_sym_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which sets
value1andvalue2to the specified values ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are overwitten, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppvoid add_sym_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which increments the
value1andvalue2by the specified values ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are incremented by the specified values, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppstd::pair<T1,T2> get_sym_pair(const size_t n, const size_t m) const;The method, which returns a pair of
value1andvalue2ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are returned, otherwise an equivalent ofT1-type andT2-type zeros are returned.
cppvoid set_asym_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which sets
value1andvalue2to the specified values considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are overwitten, considering strict index order, e.g. inversing the sign of teh values if the index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppvoid add_asym_pair(const size_t n, const size_t m, const T1 value1, const T2 value2);The method, which increments
value1andvalue2by the specified values considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are incremented, considering strict index order, e.g. inversing the sign of the values if the index order is reversed, otherwise a new entry is created with the specified indices and the givenvalue1andvalue2.
cppstd::pair<T1,T2> get_asym_pair(const size_t n, const size_t m) const;The method, which returns a pair of
value1andvalue2considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. If the entry with the specified indices already exists in the container, itsvalue1andvalue2are returned, considering strict index order, e.g. inversing the sign of the values if the index order is reversed, otherwise an equivalent ofT1-type andT2-type zeros are returned.
cppvoid add1(const NodeAB<T1,T2>& value);The method, which adds
value1of entries with identical indices from two contains following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. The entries with indices existing only in the incoming container are simply copied into the current container. The content of the current container is modified.
cppvoid add2(const NodeAB<T1,T2>& value);The method, which adds
value2of entries with identical indices from two contains following strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as two independent entries. The entries with indices existing only in the incoming container are simply copied into the current container. The content of the current container is modified.
cppvoid add_sym1(const NodeAB<T1,T2>& value);The method, which adds
value1of entries with identical indices from two contains ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with indices existing only in the incoming container are simply copied into the current container withvalue2set toT2-type equivalent of zero. The content of the current container is modified.
cppvoid add_sym2(const NodeAB<T1,T2>& value);The method, which adds
value2of entries with identical indices from two contains ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with indices existing only in the incoming container are simply copied into the current container withvalue1set toT1-type equivalent of zero. The content of the current container is modified.
cppvoid add_asym1(const NodeAB<T1,T2>& value);The method, which adds
value1of entries with identical indices from two contains considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with reverse order of indices are added with their signs inverted. The entries with indices existing only in the incoming container are simply copied into the current container withvalue2set toT2-type equivalent of zero. The content of the current container is modified.
cppvoid add_asym2(const NodeAB<T1,T2>& value);The method, which adds
value2of entries with identical indices from two contains considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with reverse order of indices are added with their signs inverted. The entries with indices existing only in the incoming container are simply copied into the current container withvalue1set toT1-type equivalent of zero. The content of the current container is modified.
cppvoid add_sym_pairs(const NodeAB<T1,T2>& value);The method, which adds
value1andvalue2of entries with identical indices from two contains ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with indices existing only in the incoming container are simply copied into the current container. The content of the current container is modified.
cppvoid add_asym_pairs(const NodeAB<T1,T2>& value);The method, which adds
value1andvalue2of entries with identical indices from two contains considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with reverse order of indices are added with their signs inverted. The entries with indices existing only in the incoming container are simply copied into the current container. The content of the current container is modified.
cppvoid add_sym1_exist(const NodeAB<T1,T2>& value);The method, which adds
value1of entries with identical indices existing in both contains ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with indices existing only in one of the containers are erased from the current container. The content of the current container is modified.
cppvoid add_sym2_exist(const NodeAB<T1,T2>& value);The method, which adds
value2of entries with identical indices existing in both contains ignoring strict index order, e.g. treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with indices existing only in one of the containers are erased from the current container. The content of the current container is modified.
cppvoid add_asym1_exist(const NodeAB<T1,T2>& value);The method, which adds
value1of entries with identical indices existing in both contains considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with reverse order of indices are added with their signs inverted. The entries with indices existing only in one of the containers are erased from the current container. The content of the current container is modified.
cppvoid add_asym2_exist(const NodeAB<T1,T2>& value);The method, which adds
value2of entries with identical indices existing in both contains considering strict index order treating entries with(n,m)index order and(m,n)index order as a single entry. The entries with reverse order of indices are added with their signs inverted. The entries with indices existing only in one of the containers are erased from teh current container. The content of the current container is modified.
cppDoubleIndexFieldEntry<T1,T2>& front(void);The method, which returns reference to the first entry in the underlying
std::vector<>container.
cppconst DoubleIndexFieldEntry<T1,T2>& front(void);The method, which returns constant reference to first entry in the underlying
std::vector<>container.
cppvoid clear()The method, which clears the container erasing all entries.
cppbool present(const size_t idxA, const size_t idxB) const;Returns true if the field with the given indices is present in the node, false otherwise.
Iterators
cppiterator begin();Iterator to the begin of the underlying
std::vector<>container which storesDoubleIndexFieldEntry<T1,T2>entries.
cppiterator end();Iterator to the end of the underlying
std::vector<>container which storesDoubleIndexFieldEntry<T1,T2>entries.
cppconst_iterator cbegin();Constant iterator to the begin of the underlying
std::vector<>container which storesDoubleIndexFieldEntry<T1,T2>entries.
cppconst_iterator cend();Constant iterator to the end of the underlying
std::vector<>container which storesDoubleIndexFieldEntry<T1,T2>entries.
cppiterator erase(iterator it);The method which erases the entry pointed to by the iterator it. It returns the next iterator following the erazed one. The storage is modified and its size is reduced.
Container properties
cppsize_t size();The method which returns the size of the underlying
std::vector<>container. It is equivalent to the number of stored entries.
cppsize_t capacity();The method which returns the capacity of the underlying
std::vector<>container. It is equivalent to the number of stored entries.
MPI communication methods
cppvoid pack(std::vector<double>& buffer);The method, which packs the content of the current
NodeABobject into the MPI communication buffer.
cppvoid unpack(std::vector<double>& buffer, size_t& it);The method, which unpacks (reads) the content of the current
NodeABobject from the MPI communication buffer. The existing data in the container is overwritten.
Read/write methods
cppvoid read(std::istream& inp);The method, which reads the content of the current
NodeABobject from the input stream.
cppvoid write(std::ostream& outp) const;The method, which writes the content of the current
NodeABobject into the output stream.