Added column extraction for a vertically aligned grid

This commit is contained in:
Kjetil Olsen Lye 2012-03-01 09:46:18 +01:00
parent cea5324e4e
commit e8543adddc
4 changed files with 35 additions and 4 deletions

View File

@ -80,12 +80,13 @@ opm/core/pressure/mimetic/mimetic.c \
opm/core/pressure/mimetic/hybsys_global.c \
opm/core/pressure/mimetic/hybsys.c \
opm/core/transport/spu_explicit.c \
opm/core/transport/spu_implicit.c \
opm/core/transport/transport_source.c \
opm/core/transport/spu_implicit.c \
opm/core/transport/GravitySolver.cpp \
opm/core/transport/transport_source.c \
opm/core/transport/reorder/TransportModelInterface.cpp \
opm/core/transport/reorder/TransportModelTwophase.cpp \
opm/core/transport/reorder/reordersequence.cpp \
opm/core/transport/reorder/nlsolvers.c \
opm/core/transport/reorder/reordersequence.cpp \
opm/core/transport/reorder/nlsolvers.c \
opm/core/transport/reorder/tarjan.c
nobase_include_HEADERS = \

View File

@ -0,0 +1,29 @@
#include <opm/core/grid.h>
#include <vector>
/**
* Extract each column of the grid.
* \note Assumes the pillars of the grid are all vertically aligned.
* \param grid The grid from which to extract the columns.
* \param columns will for each i + cartgrim[0]*j contain the k values contained in the column
* centered at (i, j).
*/
void extractColumn( const UnstructuredGrid& grid, std::vector<std::vector<int> >& columns ) {
columns.resize(grid.cartdims[0]*grid.cartdims[1]);
// This is used for sorting (and discarded afterwards)
std::vector<std::vector<double> > z_values;
z_values.resize(columns.size());
for(int i = 0; i < grid.cartdims[0]; i++) {
for(int j = 0; j < grid.cartdims[1]; j++) {
int plane_index = i + j*grid.cartdims[0];
for(int k = 0; k < grid.cartdims[2]; k++) {
columns[plane_index].push_back(plane_index + k*grid.cartdims[0]*grid.cartdims[1]);
z_values[plane_index].push_back(grid.cell_volumes[3]);
}
}
}
}

View File

@ -0,0 +1 @@
#include <opm/core/ColumnExtract.hpp>

View File