Dune Core Modules (2.3.1)

localindex.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// $Id$
4
5#ifndef DUNE_COMMON_LOCALINDEX_HH
6#define DUNE_COMMON_LOCALINDEX_HH
7
8#include <cstddef>
9
10namespace Dune
11{
12
13
27 enum LocalIndexState {VALID, DELETED};
28
29
34 {
35 public:
41 localIndex_(0), state_(VALID){}
42
43
48 LocalIndex(std::size_t index) :
49 localIndex_(index), state_(VALID){}
54 inline const std::size_t& local() const;
55
59 inline operator std::size_t() const;
60
66 inline LocalIndex& operator=(std::size_t index);
67
72 inline LocalIndexState state() const;
73
78 inline void setState(LocalIndexState state);
79
80 private:
82 std::size_t localIndex_;
83
90 char state_;
91
92 };
93
94
95
96 inline const std::size_t& LocalIndex::local() const {
97 return localIndex_;
98 }
99
100 inline LocalIndex::operator std::size_t() const {
101 return localIndex_;
102 }
103
104 inline LocalIndex& LocalIndex::operator=(std::size_t index){
105 localIndex_ = index;
106 return *this;
107 }
108
110 return static_cast<LocalIndexState>(state_);
111 }
112
114 state_ = static_cast<char>(state);
115 }
116
119} // namespace Dune
120
121#endif
An index present on the local process.
Definition: localindex.hh:34
LocalIndex()
Constructor. known to other processes.
Definition: localindex.hh:40
LocalIndex(std::size_t index)
Constructor.
Definition: localindex.hh:48
LocalIndexState
The states avaiable for the local indices.
Definition: localindex.hh:27
LocalIndex & operator=(std::size_t index)
Assign a new local index.
Definition: localindex.hh:104
LocalIndexState state() const
Get the state.
Definition: localindex.hh:109
const std::size_t & local() const
get the local index.
Definition: localindex.hh:96
void setState(LocalIndexState state)
Set the state.
Definition: localindex.hh:113
Dune namespace.
Definition: alignment.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)