Adds funcionality to access the vertices of the faces and their coordinates.
This is needed for a grid agnostic implementation of EQUIL.
This commit is contained in:
parent
735c4a7819
commit
7cebb3905b
@ -1,3 +1,23 @@
|
||||
/*
|
||||
Copyright 2014, 2015 Dr. Markus Blatt - HPC-Simulation-Software & Services.
|
||||
Copyright 2014 Statoil AS
|
||||
Copyright 2015 NTNU
|
||||
|
||||
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 3 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/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
namespace Opm
|
||||
@ -74,6 +94,16 @@ SparseTableView cell2Faces(const UnstructuredGrid& grid)
|
||||
return SparseTableView(grid.cell_faces, grid.cell_facepos, numCells(grid));
|
||||
}
|
||||
|
||||
SparseTableView face2Vertices(const UnstructuredGrid& grid)
|
||||
{
|
||||
return SparseTableView(grid.face_nodes, grid.face_nodepos, numFaces(grid));
|
||||
}
|
||||
|
||||
const double* vertexCoordinates(const UnstructuredGrid& grid, int index)
|
||||
{
|
||||
return grid.node_coordinates+dimensions(grid)*index;
|
||||
}
|
||||
|
||||
double cellVolume(const UnstructuredGrid& grid, int cell_index)
|
||||
{
|
||||
return grid.cell_volumes[cell_index];
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Copyright 2014 Dr. Markus Blatt - HPC-Simulation-Software & Services
|
||||
Copyright 2014, 2015 Dr. Markus Blatt - HPC-Simulation-Software & Services
|
||||
Copyright 2014 Statoil AS
|
||||
Copyright 2015
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@ -202,10 +203,34 @@ struct Cell2FacesTraits<UnstructuredGrid>
|
||||
typedef SparseTableView Type;
|
||||
};
|
||||
|
||||
/// \brief Maps the grid type to the associated type of the face to vertices mapping.
|
||||
///
|
||||
/// Provides a type named Type.
|
||||
/// \tparam T The type of the grid.
|
||||
template<class T>
|
||||
struct Face2VerticesTraits
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Face2VerticesTraits<UnstructuredGrid>
|
||||
{
|
||||
typedef SparseTableView Type;
|
||||
};
|
||||
|
||||
/// \brief Get the cell to faces mapping of a grid.
|
||||
Cell2FacesTraits<UnstructuredGrid>::Type
|
||||
cell2Faces(const UnstructuredGrid& grid);
|
||||
|
||||
/// \brief Get the face to vertices mapping of a grid.
|
||||
Face2VerticesTraits<UnstructuredGrid>::Type
|
||||
face2Vertices(const UnstructuredGrid& grid);
|
||||
|
||||
/// \brief Get the coordinates of a vertex of the grid.
|
||||
/// \param grid The grid the vertex is part of.
|
||||
/// \param index The index identifying the vertex.
|
||||
const double* vertexCoordinates(const UnstructuredGrid& grid, int index);
|
||||
|
||||
class FaceCellsProxy
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user