waLBerla 7.2
Loading...
Searching...
No Matches
walberla::cell::CellVector Class Reference

Detailed Description

A vector of cells.

#include <CellVector.h>

Public Types

Standard container typedefs
using iterator = std::vector<Cell>::iterator
 
using const_iterator = std::vector<Cell>::const_iterator
 
using size_type = std::vector<Cell>::size_type
 
using reference = std::vector<Cell>::reference
 
using const_reference = std::vector<Cell>::const_reference
 
using difference_type = std::vector<Cell>::difference_type
 
using value_type = Cell
 

Public Member Functions

Constructors
 CellVector ()=default
 
 CellVector (size_type n, const Cell &value=Cell())
 
template<class InputIterator >
 CellVector (InputIterator first, InputIterator last)
 
Vector functions

see documentation of std::vector

iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
reference operator[] (size_type n)
 
const_reference operator[] (size_type n) const
 
reference at (size_type n)
 
const_reference at (size_type n) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void reserve (size_type n)
 
void resize (size_type n, const Cell &value=Cell())
 
size_type size () const
 
bool empty () const
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
void push_back (const Cell &x)
 
void pop_back ()
 
iterator erase (iterator position)
 
iterator erase (iterator first, iterator last)
 
iterator insert (iterator position, const Cell &cell)
 
void insert (iterator position, size_type n, const Cell &cell)
 
template<class InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
 
void swap (CellVector &rhs)
 
void clear ()
 

Utility functions

std::vector< Cellcells_
 The vector the contained cells are stored in.
 
void push_back (const cell_idx_t x, const cell_idx_t y, const cell_idx_t z)
 push_back( Cell(x,y,z) )
 
void push_back (const uint_t x, const uint_t y, const uint_t z)
 push_back( Cell(x,y,z) )
 
difference_type removeDuplicates ()
 Removes duplicate entries.
 
CellInterval boundingBox () const
 Calculates the axis-aligned bounding box of the cell vector.
 
bool contains (const cell_idx_t x, const cell_idx_t y, const cell_idx_t z) const
 Return if cell (x,y,z) is contained in cell vector.
 
bool contains (const uint_t x, const uint_t y, const uint_t z) const
 for documentation see "contains( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z )"
 
void sort ()
 
bool operator== (const CellVector &lhs, const CellVector &rhs)
 compares the content of two CellVectors
 
bool operator!= (const CellVector &lhs, const CellVector &rhs)
 compares the content of two CellVectors
 

Member Typedef Documentation

◆ const_iterator

using walberla::cell::CellVector::const_iterator = std::vector<Cell>::const_iterator

◆ const_reference

using walberla::cell::CellVector::const_reference = std::vector<Cell>::const_reference

◆ difference_type

using walberla::cell::CellVector::difference_type = std::vector<Cell>::difference_type

◆ iterator

using walberla::cell::CellVector::iterator = std::vector<Cell>::iterator

◆ reference

using walberla::cell::CellVector::reference = std::vector<Cell>::reference

◆ size_type

using walberla::cell::CellVector::size_type = std::vector<Cell>::size_type

◆ value_type

Constructor & Destructor Documentation

◆ CellVector() [1/3]

walberla::cell::CellVector::CellVector ( )
default

◆ CellVector() [2/3]

walberla::cell::CellVector::CellVector ( size_type n,
const Cell & value = Cell() )
inline

◆ CellVector() [3/3]

template<class InputIterator >
walberla::cell::CellVector::CellVector ( InputIterator first,
InputIterator last )
inline

Member Function Documentation

◆ assign()

template<class InputIterator >
void walberla::cell::CellVector::assign ( InputIterator first,
InputIterator last )
inline

◆ at() [1/2]

reference walberla::cell::CellVector::at ( size_type n)
inline

◆ at() [2/2]

const_reference walberla::cell::CellVector::at ( size_type n) const
inline

◆ back() [1/2]

reference walberla::cell::CellVector::back ( )
inline

◆ back() [2/2]

const_reference walberla::cell::CellVector::back ( ) const
inline

◆ begin() [1/2]

iterator walberla::cell::CellVector::begin ( )
inline

◆ begin() [2/2]

const_iterator walberla::cell::CellVector::begin ( ) const
inline

◆ boundingBox()

CellInterval walberla::cell::CellVector::boundingBox ( ) const

Calculates the axis-aligned bounding box of the cell vector.

Complexity is O(N), where N == this->size()

Exceptions
std::domain_errorThrown when the CellVector is empty.
Returns
CellInterval that stores the bounding box.

◆ cbegin()

const_iterator walberla::cell::CellVector::cbegin ( ) const
inline

◆ cend()

const_iterator walberla::cell::CellVector::cend ( ) const
inline

◆ clear()

void walberla::cell::CellVector::clear ( )
inline

◆ contains() [1/2]

bool walberla::cell::CellVector::contains ( const cell_idx_t x,
const cell_idx_t y,
const cell_idx_t z ) const
inline

Return if cell (x,y,z) is contained in cell vector.

Complexity is O(N), where N == this->size(). If you need a data structure for storing cells that provides an contains method that runs in O(logN) use a CellSet, not a CellVector.

Returns
true, if cell is contained

◆ contains() [2/2]

bool walberla::cell::CellVector::contains ( const uint_t x,
const uint_t y,
const uint_t z ) const
inline

for documentation see "contains( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z )"

◆ empty()

bool walberla::cell::CellVector::empty ( ) const
inline

◆ end() [1/2]

iterator walberla::cell::CellVector::end ( )
inline

◆ end() [2/2]

const_iterator walberla::cell::CellVector::end ( ) const
inline

◆ erase() [1/2]

iterator walberla::cell::CellVector::erase ( iterator first,
iterator last )
inline

◆ erase() [2/2]

iterator walberla::cell::CellVector::erase ( iterator position)
inline

◆ front() [1/2]

reference walberla::cell::CellVector::front ( )
inline

◆ front() [2/2]

const_reference walberla::cell::CellVector::front ( ) const
inline

◆ insert() [1/3]

iterator walberla::cell::CellVector::insert ( iterator position,
const Cell & cell )
inline

◆ insert() [2/3]

template<class InputIterator >
void walberla::cell::CellVector::insert ( iterator position,
InputIterator first,
InputIterator last )
inline

◆ insert() [3/3]

void walberla::cell::CellVector::insert ( iterator position,
size_type n,
const Cell & cell )
inline

◆ operator[]() [1/2]

reference walberla::cell::CellVector::operator[] ( size_type n)
inline

◆ operator[]() [2/2]

const_reference walberla::cell::CellVector::operator[] ( size_type n) const
inline

◆ pop_back()

void walberla::cell::CellVector::pop_back ( )
inline

◆ push_back() [1/3]

void walberla::cell::CellVector::push_back ( const Cell & x)
inline

◆ push_back() [2/3]

void walberla::cell::CellVector::push_back ( const cell_idx_t x,
const cell_idx_t y,
const cell_idx_t z )
inline

push_back( Cell(x,y,z) )

◆ push_back() [3/3]

void walberla::cell::CellVector::push_back ( const uint_t x,
const uint_t y,
const uint_t z )
inline

push_back( Cell(x,y,z) )

◆ removeDuplicates()

CellVector::difference_type walberla::cell::CellVector::removeDuplicates ( )

Removes duplicate entries.

During the operation the CellVector is sorted. Iterators get invalidated.

Returns
The number of duplicate entries removed.

◆ reserve()

void walberla::cell::CellVector::reserve ( size_type n)
inline

◆ resize()

void walberla::cell::CellVector::resize ( size_type n,
const Cell & value = Cell() )
inline

◆ size()

size_type walberla::cell::CellVector::size ( ) const
inline

◆ sort()

void walberla::cell::CellVector::sort ( )
inline

◆ swap()

void walberla::cell::CellVector::swap ( CellVector & rhs)
inline

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const CellVector & lhs,
const CellVector & rhs )
friend

compares the content of two CellVectors

◆ operator==

bool operator== ( const CellVector & lhs,
const CellVector & rhs )
friend

compares the content of two CellVectors

Member Data Documentation

◆ cells_

std::vector<Cell> walberla::cell::CellVector::cells_
protected

The vector the contained cells are stored in.


The documentation for this class was generated from the following files: