Add methods save() and addNNC() to EclipseGrid
This commit is contained in:
parent
f8e711246f
commit
5b8882d6f0
@ -38,6 +38,7 @@ namespace Opm {
|
||||
|
||||
class Deck;
|
||||
class ZcornMapper;
|
||||
class NNC;
|
||||
|
||||
/**
|
||||
About cell information and dimension: The actual grid
|
||||
@ -85,6 +86,8 @@ namespace Opm {
|
||||
size_t activeIndex(size_t i, size_t j, size_t k) const;
|
||||
size_t activeIndex(size_t globalIndex) const;
|
||||
|
||||
void save(const std::string& filename, UnitSystem::UnitType output_units) const;
|
||||
void addNNC(const NNC& nnc);
|
||||
/*
|
||||
Observe that the there is a getGlobalIndex(i,j,k)
|
||||
implementation in the base class. This method - translating
|
||||
|
@ -205,7 +205,7 @@ class EclipseIO::Impl {
|
||||
public:
|
||||
Impl( const EclipseState&, EclipseGrid, const Schedule&, const SummaryConfig& );
|
||||
void writeINITFile( const data::Solution& simProps, std::map<std::string, std::vector<int> > int_data, const NNC& nnc) const;
|
||||
void writeEGRIDFile( const NNC& nnc ) const;
|
||||
void writeEGRIDFile( const NNC& nnc );
|
||||
|
||||
const EclipseState& es;
|
||||
EclipseGrid grid;
|
||||
@ -374,7 +374,7 @@ void EclipseIO::Impl::writeINITFile( const data::Solution& simProps, std::map<st
|
||||
}
|
||||
|
||||
|
||||
void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) const {
|
||||
void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) {
|
||||
const auto& ioConfig = this->es.getIOConfig();
|
||||
|
||||
std::string egridFile( ERT::EclFilename( this->outputDir,
|
||||
@ -382,14 +382,8 @@ void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) const {
|
||||
ECL_EGRID_FILE,
|
||||
ioConfig.getFMTOUT() ));
|
||||
|
||||
{
|
||||
int idx = 0;
|
||||
auto* ecl_grid = const_cast< ecl_grid_type* >( this->grid.c_ptr() );
|
||||
for (const NNCdata& n : nnc.nncdata())
|
||||
ecl_grid_add_self_nnc( ecl_grid, n.cell1, n.cell2, idx++);
|
||||
|
||||
ecl_grid_fwrite_EGRID2(ecl_grid, egridFile.c_str(), this->es.getDeckUnitSystem().getEclType() );
|
||||
}
|
||||
this->grid.addNNC( nnc );
|
||||
this->grid.save( egridFile, this->es.getDeckUnitSystem().getType());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
@ -887,6 +888,20 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
void EclipseGrid::addNNC(const NNC& nnc) {
|
||||
int idx = 0;
|
||||
auto* ecl_grid = const_cast< ecl_grid_type* >( this->c_ptr() );
|
||||
for (const NNCdata& n : nnc.nncdata())
|
||||
ecl_grid_add_self_nnc( ecl_grid, n.cell1, n.cell2, idx++);
|
||||
}
|
||||
|
||||
|
||||
void EclipseGrid::save(const std::string& filename, UnitSystem::UnitType output_units) const {
|
||||
auto* ecl_grid = const_cast< ecl_grid_type* >( this->c_ptr() );
|
||||
ecl_grid_fwrite_EGRID2(ecl_grid, filename.c_str(), UnitSystem::ecl_units(output_units));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::vector<int>& EclipseGrid::getActiveMap() const {
|
||||
if( !this->activeMap.empty() ) return this->activeMap;
|
||||
|
Loading…
Reference in New Issue
Block a user