fracturemapper.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
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 2 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 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef EWOMS_FRACTURE_MAPPER_HH
28#define EWOMS_FRACTURE_MAPPER_HH
29
30#include <algorithm>
31#include <set>
32
33namespace Opm {
34
39template <class TypeTag>
41{
42 struct FractureEdge
43 {
44 FractureEdge(unsigned edgeVertex1Idx, unsigned edgeVertex2Idx)
45 : i_(std::min(edgeVertex1Idx, edgeVertex2Idx)),
46 j_(std::max(edgeVertex1Idx, edgeVertex2Idx))
47 {}
48
49 bool operator<(const FractureEdge& e) const
50 { return i_ < e.i_ || (i_ == e.i_ && j_ < e.j_); }
51
52 bool operator==(const FractureEdge& e) const
53 { return i_ == e.i_ && j_ == e.j_; }
54
55 unsigned i_;
56 unsigned j_;
57 };
58
59public:
66 void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
67 {
68 fractureEdges_.insert(FractureEdge(vertexIdx1, vertexIdx2));
69 fractureVertices_.insert(vertexIdx1);
70 fractureVertices_.insert(vertexIdx2);
71 }
72
78 bool isFractureVertex(unsigned vertexIdx) const
79 { return fractureVertices_.count(vertexIdx) > 0; }
80
87 bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
88 {
89 FractureEdge tmp(vertex1Idx, vertex2Idx);
90 return fractureEdges_.count(tmp) > 0;
91 }
92
93private:
94 std::set<FractureEdge> fractureEdges_;
95 std::set<unsigned> fractureVertices_;
96};
97
98} // namespace Opm
99
100#endif // EWOMS_FRACTURE_MAPPER_HH
Stores the topology of fractures.
Definition: fracturemapper.hh:41
bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
Returns true iff a fracture is associated with a given edge.
Definition: fracturemapper.hh:87
bool isFractureVertex(unsigned vertexIdx) const
Returns true iff a fracture cuts through a given vertex.
Definition: fracturemapper.hh:78
void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
Marks an edge as having a fracture.
Definition: fracturemapper.hh:66
Definition: blackoilboundaryratevector.hh:39
bool operator<(const ParallelWellInfo< Scalar > &well1, const ParallelWellInfo< Scalar > &well2)
bool operator==(const aligned_allocator< T1, Alignment > &, const aligned_allocator< T2, Alignment > &) noexcept
Definition: alignedallocator.hh:200