ESyS-Particle  2.3.4
nt_slab.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
12 
13 #ifndef __NT_SLAB_H
14 #define __NT_SLAB_H
15 
16 //--- project includes ---
17 #include "nts_iter.h"
18 #include "ntable.h"
19 #include "dslice.h"
20 
21 //--- forward decls ---
22 template <typename T>
23 class NTSlab;
24 
25 template <typename T> bool operator==(const NTSlab<T>&,const NTSlab<T>&);
26 template <typename T> bool operator!=(const NTSlab<T>&,const NTSlab<T>&);
27 template <typename T> ostream& operator<<(ostream &, const NTSlab<T> &);
28 
33 template <typename T>
34 class NTSlab
35 {
36  public: // types
38  typedef NTSlab_iter<T> const_iterator; // dodgy
39  typedef T value_type;
40 
41  private:
44 
45 
46  public:
47  NTSlab();
49 
50  unsigned int slab_size()const {return m_sl.size();}
51  unsigned int size()const;
52 
53  // begin and end iterators
54  iterator begin();
55  iterator end();
56 
57  iterator rbegin();
58  iterator rend();
59 
61  unsigned int nparts_at_gridpoint(unsigned int idx) const {return m_table->nparts_at_gridpoint(m_sl[idx]);};
62 
63  // access ops
64  T* ptr(typename NeighborTable<T>::indextype);
65  T& ref(typename NeighborTable<T>::indextype);
66 
67  // insert ops
68  void insert(iterator,const T&);
69 
70  // erase ops
71  void erase(iterator);
73 
74  //comparison
75  friend bool operator== <>(const NTSlab&,const NTSlab&);
76  friend bool operator!= <>(const NTSlab&,const NTSlab&);
77 
78  friend ostream& operator<< <>(ostream &, const NTSlab &);
79 };
80 
81 #include "nt_slab.hpp"
82 
83 #endif //__NT_SLAB_H
NTSlab::m_table
NeighborTable< T > * m_table
Definition: nt_slab.h:42
NTSlab::rbegin
iterator rbegin()
Definition: nt_slab.hpp:90
nts_iter.h
ntable.h
NTSlab::insert
void insert(iterator, const T &)
Definition: nt_slab.hpp:163
operator<<
ostream & operator<<(ostream &, const NTSlab< T > &)
Definition: nt_slab.hpp:225
NTSlab::iterator
NTSlab_iter< T > iterator
Definition: nt_slab.h:37
NTSlab::ptr
T * ptr(typename NeighborTable< T >::indextype)
Definition: nt_slab.hpp:130
NTSlab::value_type
T value_type
Definition: nt_slab.h:39
NTSlab::erase
void erase(iterator, iterator)
NTSlab::rend
iterator rend()
number of particles at a given gridpoint
Definition: nt_slab.hpp:114
NTSlab::slab_size
unsigned int slab_size() const
Definition: nt_slab.h:50
NTSlab::erase
void erase(iterator)
dslice.h
NeighborTable::indextype
pair< int, int > indextype
Definition: ntable.h:72
operator==
bool operator==(const NTSlab< T > &, const NTSlab< T > &)
Definition: nt_slab.hpp:207
NTSlab::nparts_at_gridpoint
unsigned int nparts_at_gridpoint(unsigned int idx) const
Definition: nt_slab.h:61
NTSlab
representation of a slab of the search array of a NeigborTable
Definition: nt_slab.h:35
NTSlab::NTSlab
NTSlab()
Definition: nt_slab.hpp:17
NTSlab::ref
T & ref(typename NeighborTable< T >::indextype)
Definition: nt_slab.hpp:146
NeighborTable
class for neighbor search
Definition: ntable.h:68
NTSlab::size
unsigned int size() const
Definition: nt_slab.hpp:38
NTSlab_iter
iterator for a NTSlab
Definition: nts_iter.h:39
NTSlab::begin
iterator begin()
Definition: nt_slab.hpp:54
NTSlab::const_iterator
NTSlab_iter< T > const_iterator
Definition: nt_slab.h:38
nt_slab.hpp
DSlice
Definition: dslice.h:22
NTSlab::m_sl
DSlice m_sl
Definition: nt_slab.h:43
DSlice::size
unsigned int size() const
Definition: dslice.h:33
NTSlab::end
iterator end()
Definition: nt_slab.hpp:76
operator!=
bool operator!=(const NTSlab< T > &, const NTSlab< T > &)
Definition: nt_slab.hpp:213