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  Copyright (C) 2012-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef EWOMS_FRACTURE_MAPPER_HH
26 #define EWOMS_FRACTURE_MAPPER_HH
27 
29 
30 #include <algorithm>
31 #include <set>
32 
33 namespace Ewoms {
34 
39 template <class TypeTag>
41 {
42  struct FractureEdge
43  {
44  FractureEdge(int edgeVertex1Idx, int 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  int i_;
56  int j_;
57  };
58 
59 public:
64  {}
65 
72  void addFractureEdge(int vertexIdx1, int vertexIdx2)
73  {
74  fractureEdges_.insert(FractureEdge(vertexIdx1, vertexIdx2));
75  fractureVertices_.insert(vertexIdx1);
76  fractureVertices_.insert(vertexIdx2);
77  }
78 
84  bool isFractureVertex(unsigned vertexIdx) const
85  { return fractureVertices_.count(vertexIdx) > 0; }
86 
93  bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
94  {
95  FractureEdge tmp(vertex1Idx, vertex2Idx);
96  return fractureEdges_.count(tmp) > 0;
97  }
98 
99 private:
100  std::set<FractureEdge> fractureEdges_;
101  std::set<unsigned> fractureVertices_;
102 };
103 
104 } // namespace Ewoms
105 
106 #endif // EWOMS_FRACTURE_MAPPER_HH
Stores the topology of fractures.
Definition: fracturemapper.hh:40
FractureMapper()
Constructor.
Definition: fracturemapper.hh:63
void addFractureEdge(int vertexIdx1, int vertexIdx2)
Marks an edge as having a fracture.
Definition: fracturemapper.hh:72
Definition: baseauxiliarymodule.hh:35
Provides the magic behind the eWoms property system.
bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
Returns true iff a fracture is associated with a given edge.
Definition: fracturemapper.hh:93
bool isFractureVertex(unsigned vertexIdx) const
Returns true iff a fracture cuts through a given vertex.
Definition: fracturemapper.hh:84