ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Bond storage. More...
#include <BondList.hpp>
Classes | |
class | Iterator |
Public Types | |
using | storage_type = Utils::compact_vector< int > |
using | value_type = BondView |
using | reference = std::add_lvalue_reference_t< BondView > |
using | const_reference = std::add_const_t< reference > |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
using | iterator = Iterator |
using | const_iterator = Iterator |
Public Member Functions | |
BondList ()=default | |
BondList (BondList const &)=default | |
BondList (BondList &&)=default | |
BondList & | operator= (BondList const &rhs) |
BondList & | operator= (BondList &&rhs) noexcept |
const_iterator | begin () const |
Iterator to the beginning of the range of bonds in the list. | |
const_iterator | end () const |
Iterator past the end of the range of bonds in the list. | |
void | insert (BondView const &bond) |
Add a bond to the list. | |
const_iterator | erase (const_iterator pos) |
Erase a bond from the list. | |
auto | size () const |
Number of bonds. | |
void | clear () |
Erase all bonds from the list. | |
bool | empty () const |
Check if the are any bonds in the list. | |
Friends | |
void | swap (BondList &lhs, BondList &rhs) |
Bond storage.
This holds the bonds of a particle.
Implementation notes: Internally the bond list is represented as a sequence of integers. For each bond, first the ids of the bond partners are stored (which are positive numbers), then the negative of the value of the id of the bond plus one (which also is positive) is stored. This way we can use the sign bit of the int as a delimiter, every time a negative number is encountered one bond ends, and a new one starts. This mechanism allows us to efficiently store bonds of different numbers of partners in contiguous memory.
This is hidden from the client by providing access to the bonds only thru iterators that restore the semantic meanings of the entries, and know how to proceed to the next bond.
Definition at line 84 of file BondList.hpp.
using BondList::const_iterator = Iterator |
Definition at line 154 of file BondList.hpp.
using BondList::const_reference = std::add_const_t<reference> |
Definition at line 150 of file BondList.hpp.
using BondList::difference_type = std::ptrdiff_t |
Definition at line 152 of file BondList.hpp.
using BondList::iterator = Iterator |
Definition at line 153 of file BondList.hpp.
using BondList::reference = std::add_lvalue_reference_t<BondView> |
Definition at line 149 of file BondList.hpp.
using BondList::size_type = std::size_t |
Definition at line 151 of file BondList.hpp.
using BondList::storage_type = Utils::compact_vector<int> |
Definition at line 86 of file BondList.hpp.
using BondList::value_type = BondView |
Definition at line 148 of file BondList.hpp.
|
default |
|
default |
|
default |
|
inline |
Iterator to the beginning of the range of bonds in the list.
Definition at line 178 of file BondList.hpp.
Referenced by pair_bond_exists_on(), and size().
|
inline |
Erase all bonds from the list.
Definition at line 215 of file BondList.hpp.
|
inline |
Check if the are any bonds in the list.
Definition at line 220 of file BondList.hpp.
|
inline |
Iterator past the end of the range of bonds in the list.
Definition at line 182 of file BondList.hpp.
Referenced by pair_bond_exists_on(), and size().
|
inline |
Erase a bond from the list.
pos | Iterator pointing to element to erase. |
Definition at line 200 of file BondList.hpp.
|
inline |
Add a bond to the list.
bond | Bond to add. |
Definition at line 189 of file BondList.hpp.
References BondView::bond_id(), and BondView::partner_ids().
Definition at line 167 of file BondList.hpp.
Definition at line 159 of file BondList.hpp.
|
inline |
Number of bonds.
Definition at line 208 of file BondList.hpp.
Definition at line 223 of file BondList.hpp.