My Project
Loading...
Searching...
No Matches
PAvgCalculatorCollection.hpp
1/*
2 Copyright 2020, 2023 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef PAVE_CALC_COLLECTIONHPP
21#define PAVE_CALC_COLLECTIONHPP
22
23#include <cstddef>
24#include <functional>
25#include <memory>
26#include <string>
27#include <unordered_map>
28#include <vector>
29
30namespace Opm {
31 class PAvgCalculator;
32} // namespace Opm
33
34namespace Opm {
35
38{
39public:
44 using CalculatorPtr = std::unique_ptr<PAvgCalculator>;
45
56 using ActivePredicate = std::function<
57 std::vector<bool>(const std::vector<std::size_t>&)>;
58
61
64
67
70
73
76
87 std::size_t setCalculator(const std::size_t wellID, CalculatorPtr calculator);
88
99
106 PAvgCalculator& operator[](const std::size_t i);
107
114 const PAvgCalculator& operator[](const std::size_t i) const;
115
117 bool empty() const;
118
120 std::size_t numCalculators() const;
121
126 std::vector<std::size_t> allWBPCells() const;
127
128private:
130 using CalcIndex = std::vector<CalculatorPtr>::size_type;
131
133 std::unordered_map<std::size_t, CalcIndex> index_{};
134
136 std::vector<CalculatorPtr> calculators_{};
137};
138
139} // namespace Opm
140
141#endif // PAVE_CALC_COLLECTIONHPP
Collection of WBPn calculation objects, one for each well.
Definition PAvgCalculatorCollection.hpp:38
void pruneInactiveWBPCells(ActivePredicate isActive)
Discard inactive source locations from all WBPn calculation objects.
Definition PAvgCalculatorCollection.cpp:57
std::size_t setCalculator(const std::size_t wellID, CalculatorPtr calculator)
Assign/register a WBPn calculation object for a single well.
Definition PAvgCalculatorCollection.cpp:38
~PAvgCalculatorCollection()=default
Destructor.
PAvgCalculatorCollection & operator=(const PAvgCalculatorCollection &)=delete
Assignment operator.
std::unique_ptr< PAvgCalculator > CalculatorPtr
Wrapper for a WBPn calclation object.
Definition PAvgCalculatorCollection.hpp:44
std::size_t numCalculators() const
Number of WBPn calculation objects owned by this collection.
Definition PAvgCalculatorCollection.cpp:99
std::vector< std::size_t > allWBPCells() const
Union of all distinct/unique cells/source locations contributing to this complete collection of WBPn ...
Definition PAvgCalculatorCollection.cpp:104
PAvgCalculatorCollection(PAvgCalculatorCollection &&)=default
Move constructor.
std::function< std::vector< bool >(const std::vector< std::size_t > &)> ActivePredicate
Predicate for whether or not a particular source location is active.
Definition PAvgCalculatorCollection.hpp:57
PAvgCalculator & operator[](const std::size_t i)
Access mutable WBPn calculation object.
Definition PAvgCalculatorCollection.cpp:83
PAvgCalculatorCollection(const PAvgCalculatorCollection &)=delete
Copy constructor.
bool empty() const
Whether or not this collection has any WBPn calculation objects.
Definition PAvgCalculatorCollection.cpp:94
PAvgCalculatorCollection()=default
Default constructor.
PAvgCalculatorCollection & operator=(PAvgCalculatorCollection &&)=default
Move-assignment operator.
Facility for deriving well-level pressure values from selected block-averaging procedures.
Definition PAvgCalculator.hpp:49
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30