34 #ifndef OPM_CPGRIDLEVELCARTESIANINDEXMAPPER_HH 35 #define OPM_CPGRIDLEVELCARTESIANINDEXMAPPER_HH 37 #include <opm/grid/common/LevelCartesianIndexMapper.hpp> 38 #include <opm/grid/CpGrid.hpp> 55 static constexpr
int dimension = 3 ;
62 const std::array<int,3>& cartesianDimensions(
int level)
const 65 return grid_->currentData()[level]->logicalCartesianSize();
68 int cartesianSize(
int level)
const 71 return computeCartesianSize(level);
74 int compressedSize(
int level)
const 77 return grid_->currentData()[level]->size(0);
80 int cartesianIndex(
const int compressedElementIndex,
const int level)
const 83 assert( compressedElementIndex >= 0 && compressedElementIndex < grid_->currentData()[level]->size(0) );
84 return grid_->currentData()[level]->globalCell()[compressedElementIndex];
87 void cartesianCoordinate(
const int compressedElementIndexOnLevel, std::array<int,dimension>& coordsOnLevel,
int level)
const 90 grid_->currentData()[level]->getIJK( compressedElementIndexOnLevel, coordsOnLevel);
96 int computeCartesianSize(
int level)
const 98 int size = cartesianDimensions(level)[ 0 ];
99 for(
int d=1; d<dimension; ++d )
100 size *= cartesianDimensions(level)[ d ];
104 void validLevel(
int level)
const 106 if ((level < 0) || (level > grid_->
maxLevel())) {
107 throw std::invalid_argument(
"Invalid level.\n");
Definition: LevelCartesianIndexMapper.hpp:44
The namespace Dune is the main namespace for all Dune code.
Definition: CartesianIndexMapper.hpp:9
[ provides Dune::Grid ]
Definition: CpGrid.hpp:201
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.cpp:71
int maxLevel() const
Return maximum level defined in this grid. Levels are 0 and 1, maxlevel = 1 (not counting leafview)...
Definition: CpGrid.cpp:767