createGlobalCellArray.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2015 Andreas Lauser
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef OPM_CREATE_GLOBAL_CELL_ARRAY_HPP
20 #define OPM_CREATE_GLOBAL_CELL_ARRAY_HPP
21 
23 
24 namespace Opm
25 {
30 template <class Grid>
31 void createGlobalCellArray(const Grid &grid, std::vector<int>& dest)
32 {
33  int numCells = Opm::UgGridHelpers::numCells(grid);
34  dest.resize(numCells);
35  const auto& globalCell = Opm::UgGridHelpers::globalCell(grid);
36  std::vector<int> compressedToCartesianIdx(numCells);
37  for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
38  if (globalCell) {
39  dest[cellIdx] = globalCell[cellIdx];
40  }
41  else {
42  dest[cellIdx] = cellIdx;
43  }
44  }
45 
46 }
47 }
48 
49 #endif
Definition: AdditionalObjectDeleter.hpp:22
void createGlobalCellArray(const Grid &grid, std::vector< int > &dest)
Create a mapping from a global cell index of a grid to the logically Cartesian index of the ECL deck...
Definition: createGlobalCellArray.hpp:31