diff --git a/opm/autodiff/GridHelpers.cpp b/opm/autodiff/GridHelpers.cpp index 30cd574f7..29d8ec72f 100644 --- a/opm/autodiff/GridHelpers.cpp +++ b/opm/autodiff/GridHelpers.cpp @@ -196,6 +196,12 @@ double faceArea(const Dune::CpGrid& grid, int 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 namespace AutoDiffGrid diff --git a/opm/autodiff/GridHelpers.hpp b/opm/autodiff/GridHelpers.hpp index 6d95df367..502a3bb2e 100644 --- a/opm/autodiff/GridHelpers.hpp +++ b/opm/autodiff/GridHelpers.hpp @@ -178,8 +178,8 @@ public: { public: iterator(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row, - int index) - : row_(row), index_(index) + int index, int cell_index) + : row_(row), index_(index), cell_index_(cell_index) {} void increment() @@ -210,32 +210,40 @@ public: { return index_==o.index_; } + int getCellIndex()const + { + return cell_index_; + } private: const Dune::cpgrid::OrientedEntityTable<0,1>::row_type* row_; int index_; + int cell_index_; }; typedef iterator const_iterator; - Cell2FacesRow(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row) - : row_(row) + Cell2FacesRow(const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row, + const int cell_index) + : row_(row), cell_index_(cell_index) {} const_iterator begin() const { - return const_iterator(&row_, 0); + return const_iterator(&row_, 0, cell_index_); } const_iterator end() const { - return const_iterator(&row_, row_.size()); + return const_iterator(&row_, row_.size(), cell_index_); } private: const Dune::cpgrid::OrientedEntityTable<0,1>::row_type row_; + const int cell_index_; }; + class Cell2FacesContainer { public: @@ -247,7 +255,8 @@ public: 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. @@ -386,6 +395,13 @@ faceCells(const Dune::CpGrid& grid); const double* faceNormal(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 namespace AutoDiffGrid