Add 'python/' from commit '278373703455ea6562a0f8e5278b4db46eb1fc7e'

git-subtree-dir: python
git-subtree-mainline: e8dbf7d8ee
git-subtree-split: 2783737034
This commit is contained in:
Joakim Hove
2019-05-08 07:20:29 +02:00
133 changed files with 538641 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include "sunbeam.hpp"
namespace {
py::tuple getXYZ( const EclipseGrid& grid ) {
return py::make_tuple( grid.getNX(),
grid.getNY(),
grid.getNZ());
}
int getNumActive( const EclipseGrid& grid ) {
return grid.getNumActive();
}
int getCartesianSize( const EclipseGrid& grid ) {
return grid.getCartesianSize();
}
int getGlobalIndex( const EclipseGrid& grid, int i, int j, int k ) {
return grid.getGlobalIndex(i, j, k);
}
py::tuple getIJK( const EclipseGrid& grid, int g ) {
const auto& ijk = grid.getIJK(g);
return py::make_tuple(ijk[0], ijk[1], ijk[2]);
}
double cellVolume1G( const EclipseGrid& grid, size_t glob_idx) {
return grid.getCellVolume(glob_idx);
}
double cellVolume3( const EclipseGrid& grid, size_t i_idx, size_t j_idx, size_t k_idx) {
return grid.getCellVolume(i_idx, j_idx, k_idx);
}
}
void sunbeam::export_EclipseGrid(py::module& module) {
py::class_< EclipseGrid >( module, "EclipseGrid")
.def( "_getXYZ", &getXYZ )
.def( "nactive", &getNumActive )
.def( "cartesianSize", &getCartesianSize )
.def( "globalIndex", &getGlobalIndex )
.def( "getIJK", &getIJK )
.def( "_cellVolume1G", &cellVolume1G)
.def( "_cellVolume3", &cellVolume3)
;
}