Loading...
Searching...
No Matches
fracturemapper.hh
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_FRACTURE_MAPPER_HH
#define EWOMS_FRACTURE_MAPPER_HH
#include <algorithm>
#include <set>
namespace Opm {
template <class TypeTag>
class FractureMapper
{
struct FractureEdge
{
FractureEdge(unsigned edgeVertex1Idx, unsigned edgeVertex2Idx)
: i_(std::min(edgeVertex1Idx, edgeVertex2Idx)),
j_(std::max(edgeVertex1Idx, edgeVertex2Idx))
{}
bool operator<(const FractureEdge& e) const
{ return i_ < e.i_ || (i_ == e.i_ && j_ < e.j_); }
bool operator==(const FractureEdge& e) const
{ return i_ == e.i_ && j_ == e.j_; }
unsigned i_;
unsigned j_;
};
public:
void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
{
fractureEdges_.insert(FractureEdge(vertexIdx1, vertexIdx2));
fractureVertices_.insert(vertexIdx1);
fractureVertices_.insert(vertexIdx2);
}
bool isFractureVertex(unsigned vertexIdx) const
{ return fractureVertices_.count(vertexIdx) > 0; }
bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
{
FractureEdge tmp(vertex1Idx, vertex2Idx);
return fractureEdges_.count(tmp) > 0;
}
private:
std::set<FractureEdge> fractureEdges_;
std::set<unsigned> fractureVertices_;
};
} // namespace Opm
#endif // EWOMS_FRACTURE_MAPPER_HH
Opm::FractureMapper
Stores the topology of fractures.
Definition fracturemapper.hh:41
Opm::FractureMapper::isFractureEdge
bool isFractureEdge(unsigned vertex1Idx, unsigned vertex2Idx) const
Returns true iff a fracture is associated with a given edge.
Definition fracturemapper.hh:87
Opm::FractureMapper::isFractureVertex
bool isFractureVertex(unsigned vertexIdx) const
Returns true iff a fracture cuts through a given vertex.
Definition fracturemapper.hh:78
Opm::FractureMapper::addFractureEdge
void addFractureEdge(unsigned vertexIdx1, unsigned vertexIdx2)
Marks an edge as having a fracture.
Definition fracturemapper.hh:66
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43