CellSet.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 Statoil ASA.
3 Copyright 2016 SINTEF ICT, Applied Mathematics.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef OPM_CELLSET_HEADER_INCLUDED
22#define OPM_CELLSET_HEADER_INCLUDED
23
24#include <string>
25#include <unordered_set>
26#include <vector>
27
28namespace Opm
29{
30namespace FlowDiagnostics
31{
32
33
35 {
36 public:
38
40
41 explicit CellSetID(Repr id);
42
44
45 bool operator<(const CellSetID& other) const;
46
47 private:
48 Repr id_;
49 };
50
51
52
53
54 class CellSet
55 {
56 private:
57 using IndexSet = std::unordered_set<int>;
58
59 public:
61 explicit CellSet(CellSetID id);
62
64 CellSet(CellSetID id, const std::vector<int>& cells);
65
66 const CellSetID& id() const;
67
68 void insert(const int cell);
69
70 using const_iterator = IndexSet::const_iterator;
73
74 private:
75 CellSetID id_;
76 IndexSet iset_;
77 };
78
79
80} // namespace FlowDiagnostics
81} // namespace Opm
82
83#endif // OPM_CELLSET_HEADER_INCLUDED
const char *const string
Definition: cJSON.h:170
Definition: CellSet.hpp:35
std::string to_string() const
std::string Repr
Definition: CellSet.hpp:37
bool operator<(const CellSetID &other) const
Definition: CellSet.hpp:55
IndexSet::const_iterator const_iterator
Definition: CellSet.hpp:70
const_iterator begin() const
CellSet(CellSetID id, const std::vector< int > &cells)
Construct non-empty cell set.
CellSet(CellSetID id)
Contruct empty cell set, use insert() to populate.
void insert(const int cell)
const CellSetID & id() const
const_iterator end() const
Definition: A.hpp:4