mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Adds free function to access the face tag to UgGridHelpers.
It uses the iterator over the cell faces to identify the face tag in constant time.
This commit is contained in:
parent
18fa00b542
commit
4a0fbafbcc
@ -196,6 +196,12 @@ double faceArea(const Dune::CpGrid& grid, int face_index)
|
|||||||
{
|
{
|
||||||
return grid.faceArea(face_index);
|
return grid.faceArea(face_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int faceTag(const Dune::CpGrid& grid,
|
||||||
|
const Opm::AutoDiffGrid::Cell2FacesRow::iterator& cell_face)
|
||||||
|
{
|
||||||
|
return grid.faceTag(cell_face);
|
||||||
|
}
|
||||||
} // end namespace UgGridHelpers
|
} // end namespace UgGridHelpers
|
||||||
|
|
||||||
namespace AutoDiffGrid
|
namespace AutoDiffGrid
|
||||||
|
@ -178,8 +178,8 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
iterator(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row,
|
iterator(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row,
|
||||||
int index)
|
int index, int cell_index)
|
||||||
: row_(row), index_(index)
|
: row_(row), index_(index), cell_index_(cell_index)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void increment()
|
void increment()
|
||||||
@ -210,32 +210,40 @@ public:
|
|||||||
{
|
{
|
||||||
return index_==o.index_;
|
return index_==o.index_;
|
||||||
}
|
}
|
||||||
|
int getCellIndex()const
|
||||||
|
{
|
||||||
|
return cell_index_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row_;
|
const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row_;
|
||||||
int index_;
|
int index_;
|
||||||
|
int cell_index_;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef iterator const_iterator;
|
typedef iterator const_iterator;
|
||||||
|
|
||||||
Cell2FacesRow(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row)
|
Cell2FacesRow(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row,
|
||||||
: row_(row)
|
const int cell_index)
|
||||||
|
: row_(row), cell_index_(cell_index)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const_iterator begin() const
|
const_iterator begin() const
|
||||||
{
|
{
|
||||||
return const_iterator(&row_, 0);
|
return const_iterator(&row_, 0, cell_index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator end() const
|
const_iterator end() const
|
||||||
{
|
{
|
||||||
return const_iterator(&row_, row_.size());
|
return const_iterator(&row_, row_.size(), cell_index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row_;
|
const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row_;
|
||||||
|
const int cell_index_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Cell2FacesContainer
|
class Cell2FacesContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -247,7 +255,8 @@ public:
|
|||||||
|
|
||||||
Cell2FacesRow operator[](int cell_index) const
|
Cell2FacesRow operator[](int cell_index) const
|
||||||
{
|
{
|
||||||
return Cell2FacesRow(grid_->cellFaceRow(cell_index));
|
auto& row=grid_->cellFaceRow(cell_index);
|
||||||
|
return Cell2FacesRow(row, cell_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get the number of non-zero entries.
|
/// \brief Get the number of non-zero entries.
|
||||||
@ -386,6 +395,13 @@ faceCells(const Dune::CpGrid& grid);
|
|||||||
const double* faceNormal(const Dune::CpGrid& grid, int face_index);
|
const double* faceNormal(const Dune::CpGrid& grid, int face_index);
|
||||||
|
|
||||||
double faceArea(const Dune::CpGrid& grid, int face_index);
|
double faceArea(const Dune::CpGrid& grid, int face_index);
|
||||||
|
|
||||||
|
/// \brief Get Eclipse Cartesian tag of a face
|
||||||
|
/// \param grid The grid that the face is part of.
|
||||||
|
/// \param cell_face The face attached to a cell. Usually obtained from face2Cells.
|
||||||
|
/// \return 0, 1, 2, 3, 4, 5 for I-, I+, J-, J+, K-, K+
|
||||||
|
int faceTag(const Dune::CpGrid& grid,
|
||||||
|
const Opm::AutoDiffGrid::Cell2FacesRow::iterator& cell_face);
|
||||||
} // end namespace UgGridHelperHelpers
|
} // end namespace UgGridHelperHelpers
|
||||||
|
|
||||||
namespace AutoDiffGrid
|
namespace AutoDiffGrid
|
||||||
|
Loading…
Reference in New Issue
Block a user