Dune Core Modules (2.6.0)

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
4#ifndef DUNE_COMMON_LOCALINDEX_HH
5#define DUNE_COMMON_LOCALINDEX_HH
6
7#include <cstddef>
8
9namespace Dune
10{
11
12
26 enum LocalIndexState {VALID, DELETED};
27
28
33 {
34 public:
40 localIndex_(0), state_(VALID){}
41
42
47 LocalIndex(std::size_t index) :
48 localIndex_(index), state_(VALID){}
53 inline const std::size_t& local() const;
54
58 inline operator std::size_t() const;
59
65 inline LocalIndex& operator=(std::size_t index);
66
71 inline LocalIndexState state() const;
72
77 inline void setState(LocalIndexState state);
78
79 private:
81 std::size_t localIndex_;
82
89 char state_;
90
91 };
92
93
94
95 inline const std::size_t& LocalIndex::local() const {
96 return localIndex_;
97 }
98
99 inline LocalIndex::operator std::size_t() const {
100 return localIndex_;
101 }
102
103 inline LocalIndex& LocalIndex::operator=(std::size_t index){
104 localIndex_ = index;
105 return *this;
106 }
107
109 return static_cast<LocalIndexState>(state_);
110 }
111
113 state_ = static_cast<char>(state);
114 }
115
118} // namespace Dune
119
120#endif
An index present on the local process.
Definition: localindex.hh:33
LocalIndex()
Constructor. known to other processes.
Definition: localindex.hh:39
LocalIndex(std::size_t index)
Constructor.
Definition: localindex.hh:47
LocalIndexState
The states avaiable for the local indices.
Definition: localindex.hh:26
LocalIndex & operator=(std::size_t index)
Assign a new local index.
Definition: localindex.hh:103
LocalIndexState state() const
Get the state.
Definition: localindex.hh:108
const std::size_t & local() const
get the local index.
Definition: localindex.hh:95
void setState(LocalIndexState state)
Set the state.
Definition: localindex.hh:112
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)