common/CartesianIndexMapper.hpp
Go to the documentation of this file.
1#ifndef OPM_CARTESIANINDEXMAPPER_HEADER
2#define OPM_CARTESIANINDEXMAPPER_HEADER
3
4#include <array>
5#include <cassert>
6
7#include <dune/common/exceptions.hh>
8
9namespace Dune
10{
14 template< class Grid >
16 {
17 public:
19 static const int dimension = Grid :: dimension ;
20
22 explicit CartesianIndexMapper( const Grid& )
23 {
24 DUNE_THROW(InvalidStateException,"CartesianIndexMapper not specialized for given grid");
25 }
26
28 const std::array<int, dimension>& cartesianDimensions() const
29 {
30 static std::array<int, dimension> a;
31 return a;
32 }
33
35 int cartesianSize() const
36 {
37 return 0;
38 }
39
41 int compressedSize() const
42 {
43 return 0;
44 }
45
48 {
49 return 0;
50 }
51
53 int cartesianIndex( const int /* compressedElementIndex */) const
54 {
55 return 0;
56 }
57
59 void cartesianCoordinate(const int /* compressedElementIndex */, std::array<int,dimension>& /* coords */) const
60 {
61 }
62
64 void cartesianCoordinateLevel(const int /* compressedElementIndexOnLevel */,
65 std::array<int,dimension>& /* coordsOnLevel */, int /*level*/) const
66 {
67 }
68 };
69
70} // end namespace Opm
71#endif
Interface class to access the logical Cartesian grid as used in industry standard simulator decks.
Definition: common/CartesianIndexMapper.hpp:16
int cartesianIndex(const int) const
return index of the cells in the logical Cartesian grid
Definition: common/CartesianIndexMapper.hpp:53
int compressedLevelZeroSize() const
return number of cells in the active level zero grid. Only relevant for CpGrid specialization.
Definition: common/CartesianIndexMapper.hpp:47
int compressedSize() const
return number of cells in the active grid
Definition: common/CartesianIndexMapper.hpp:41
const std::array< int, dimension > & cartesianDimensions() const
return Cartesian dimensions, i.e. number of cells in each direction
Definition: common/CartesianIndexMapper.hpp:28
static const int dimension
dimension of the grid
Definition: common/CartesianIndexMapper.hpp:19
CartesianIndexMapper(const Grid &)
constructor taking grid
Definition: common/CartesianIndexMapper.hpp:22
int cartesianSize() const
return total number of cells in the logical Cartesian grid
Definition: common/CartesianIndexMapper.hpp:35
void cartesianCoordinate(const int, std::array< int, dimension > &) const
return Cartesian coordinate, i.e. IJK, for a given cell
Definition: common/CartesianIndexMapper.hpp:59
void cartesianCoordinateLevel(const int, std::array< int, dimension > &, int) const
return Cartesian coordinate, i.e. IJK, for a given cell. Only relevant for CpGrid specialization.
Definition: common/CartesianIndexMapper.hpp:64
The namespace Dune is the main namespace for all Dune code.
Definition: common/CartesianIndexMapper.hpp:10