Loading...
Searching...
No Matches
WachspressCoord.hpp
/*
Copyright 2012 SINTEF ICT, Applied Mathematics.
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/>.
*/
#ifndef OPM_WACHSPRESSCOORD_HEADER_INCLUDED
#define OPM_WACHSPRESSCOORD_HEADER_INCLUDED
#include <opm/grid/utility/SparseTable.hpp>
#include <vector>
struct UnstructuredGrid;
namespace Opm
{
class WachspressCoord
{
public:
explicit WachspressCoord(const UnstructuredGrid& grid);
int numCorners(const int cell) const;
void cartToBary(const int cell,
const double* x,
double* xb) const;
// A corner is here defined as a {cell, vertex} pair where the
// vertex is adjacent to the cell.
struct CornerInfo
{
int corner_id; // Unique for each corner.
int vertex; // Shared between corners belonging to different cells.
double volume; // Defined as det(N) where N is the matrix of adjacent face normals.
};
const SparseTable<CornerInfo>& cornerInfo() const;
const std::vector<int>& adjacentFaces() const;
private:
const UnstructuredGrid& grid_;
SparseTable<CornerInfo> corner_info_; // Corner info by cell.
std::vector<int> adj_faces_; // Set of adjacent faces, by corner id. Contains dim face indices per corner.
SparseTable<int> nonadj_faces_; // Set of nonadjacent faces, by corner id.
};
} // namespace Opm
#endif // OPM_WACHSPRESSCOORD_HEADER_INCLUDED
Opm::SparseTable
A SparseTable stores a table with rows of varying size as efficiently as possible.
Definition SparseTable.hpp:55
Opm::WachspressCoord::cartToBary
void cartToBary(const int cell, const double *x, double *xb) const
Compute generalized barycentric coordinates for some point x with respect to the vertices of a grid c...
Definition WachspressCoord.cpp:202
Opm::WachspressCoord::cornerInfo
const SparseTable< CornerInfo > & cornerInfo() const
The class stores some info for each corner, made accessible for user convenience.
Definition WachspressCoord.cpp:179
Opm::WachspressCoord::adjacentFaces
const std::vector< int > & adjacentFaces() const
The class stores adjacent faces for each corner, made accessible for user convenience.
Definition WachspressCoord.cpp:188
Opm::WachspressCoord::WachspressCoord
WachspressCoord(const UnstructuredGrid &grid)
Constructor.
Definition WachspressCoord.cpp:97
Opm::WachspressCoord::numCorners
int numCorners(const int cell) const
Count of vertices adjacent to a call.
Definition WachspressCoord.cpp:171
Opm
Holds the implementation of the CpGrid as a pimple.
Definition CellQuadrature.cpp:68
Opm::WachspressCoord::CornerInfo
Definition WachspressCoord.hpp:62
UnstructuredGrid
Data structure for an unstructured grid, unstructured meaning that any cell may have an arbitrary num...
Definition UnstructuredGrid.h:101