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 
31 
32 #include <algorithm>
33 #include <set>
34 
35 namespace Ewoms {
36 
41 template <class TypeTag>
43 {
44  struct FractureEdge
45  {
46  FractureEdge(unsigned edgeVertex1Idx, unsigned edgeVertex2Idx)
47  : i_(std::min(edgeVertex1Idx, edgeVertex2Idx)),
48  j_(std::max(edgeVertex1Idx, edgeVertex2Idx))
49  {}
50 
51  bool operator<(const FractureEdge& e) const
52  { return i_ < e.i_ || (i_ == e.i_ && j_ < e.j_); }
53 
54  bool operator==(const FractureEdge& e) const
55  { return i_ == e.i_ && j_ == e.j_; }
56 
57  unsigned i_;
58  unsigned j_;
59  };
60 
61 public:
66  {}
67 
74  void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
75  {
76  fractureEdges_.insert(FractureEdge(vertexIdx1, vertexIdx2));
77  fractureVertices_.insert(vertexIdx1);
78  fractureVertices_.insert(vertexIdx2);
79  }
80 
86  bool isFractureVertex(unsigned vertexIdx) const
87  { return fractureVertices_.count(vertexIdx) > 0; }
88 
95  bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
96  {
97  FractureEdge tmp(vertex1Idx, vertex2Idx);
98  return fractureEdges_.count(tmp) > 0;
99  }
100 
101 private:
102  std::set<FractureEdge> fractureEdges_;
103  std::set<unsigned> fractureVertices_;
104 };
105 
106 } // namespace Ewoms
107 
108 #endif // EWOMS_FRACTURE_MAPPER_HH
bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
Returns true iff a fracture is associated with a given edge.
Definition: fracturemapper.hh:95
Definition: baseauxiliarymodule.hh:37
Stores the topology of fractures.
Definition: fracturemapper.hh:42
bool isFractureVertex(unsigned vertexIdx) const
Returns true iff a fracture cuts through a given vertex.
Definition: fracturemapper.hh:86
void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
Marks an edge as having a fracture.
Definition: fracturemapper.hh:74
Provides the magic behind the eWoms property system.
FractureMapper()
Constructor.
Definition: fracturemapper.hh:65