ESyS-Particle  2.3
nt_slab.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 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.opensource.org/licenses/osl-3.0.php //
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);
72  void erase(iterator,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
T & ref(typename NeighborTable< T >::indextype)
Definition: nt_slab.hpp:146
NTSlab()
Definition: nt_slab.hpp:17
unsigned int slab_size() const
Definition: nt_slab.h:50
unsigned int nparts_at_gridpoint(unsigned int idx) const
Definition: nt_slab.h:61
iterator for a NTSlab
Definition: ntable.h:60
void erase(iterator)
T * ptr(typename NeighborTable< T >::indextype)
Definition: nt_slab.hpp:130
pair< int, int > indextype
Definition: ntable.h:72
unsigned int size() const
Definition: nt_slab.hpp:38
DSlice m_sl
Definition: nt_slab.h:43
iterator end()
Definition: nt_slab.hpp:76
unsigned int size() const
Definition: dslice.h:33
unsigned int nparts_at_gridpoint(unsigned int idx) const
number of particles at a given gridpoint
Definition: ntable.h:128
iterator rbegin()
Definition: nt_slab.hpp:90
NTSlab_iter< T > iterator
Definition: nt_slab.h:37
T value_type
Definition: nt_slab.h:39
class for neighbor search
Definition: ntable.h:67
representation of a slab of the search array of a NeigborTable
Definition: nt_slab.h:23
void insert(iterator, const T &)
Definition: nt_slab.hpp:163
bool operator!=(const NTSlab< T > &, const NTSlab< T > &)
Definition: nt_slab.hpp:213
NTSlab_iter< T > const_iterator
Definition: nt_slab.h:38
NeighborTable< T > * m_table
Definition: nt_slab.h:42
Definition: dslice.h:21
bool operator==(const NTSlab< T > &, const NTSlab< T > &)
Definition: nt_slab.hpp:207
iterator rend()
number of particles at a given gridpoint
Definition: nt_slab.hpp:114
iterator begin()
Definition: nt_slab.hpp:54