#2143 Import of NNC : Move import of dynamic NNC data to RifEclipseOutputFileTools

This commit is contained in:
Magne Sjaastad 2017-11-14 10:43:14 +01:00
parent 1c0d8c0dd0
commit 018549d15a
4 changed files with 50 additions and 54 deletions

View File

@ -27,6 +27,8 @@
#include "ert/ecl/ecl_file.h"
#include "ert/ecl/ecl_grid.h"
#include "ert/ecl/ecl_kw_magic.h"
#include "ert/ecl/ecl_nnc_geometry.h"
#include "ert/ecl/ecl_nnc_data.h"
#include "cafProgressInfo.h"
@ -417,6 +419,46 @@ std::set<RiaDefines::PhaseType> RifEclipseOutputFileTools::findAvailablePhases(e
return phaseTypes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputFileTools::transferNncFluxData(const ecl_grid_type* grid,
ecl_file_view_type* summaryView,
std::vector<double>* waterFlux,
std::vector<double>* oilFlux,
std::vector<double>* gasFlux)
{
ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(grid);
if (nnc_geo)
{
ecl_nnc_data_type* waterFluxData = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, summaryView);
if (waterFluxData)
{
const double* waterFluxValues = ecl_nnc_data_get_values(waterFluxData);
waterFlux->insert(waterFlux->end(), &waterFluxValues[0], &waterFluxValues[ecl_nnc_data_get_size(waterFluxData)]);
ecl_nnc_data_free(waterFluxData);
}
ecl_nnc_data_type* oilFluxData = ecl_nnc_data_alloc_oil_flux(grid, nnc_geo, summaryView);
if (oilFluxData)
{
const double* oilFluxValues = ecl_nnc_data_get_values(oilFluxData);
oilFlux->insert(oilFlux->end(), &oilFluxValues[0], &oilFluxValues[ecl_nnc_data_get_size(oilFluxData)]);
ecl_nnc_data_free(oilFluxData);
}
ecl_nnc_data_type* gasFluxData = ecl_nnc_data_alloc_gas_flux(grid, nnc_geo, summaryView);
if (gasFluxData)
{
const double* gasFluxValues = ecl_nnc_data_get_values(gasFluxData);
gasFlux->insert(gasFlux->end(), &gasFluxValues[0], &gasFluxValues[ecl_nnc_data_get_size(gasFluxData)]);
ecl_nnc_data_free(gasFluxData);
}
ecl_nnc_geometry_free(nnc_geo);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -71,6 +71,10 @@ public:
static std::set<RiaDefines::PhaseType> findAvailablePhases(ecl_file_type* ecl_file);
static void transferNncFluxData(const ecl_grid_type* grid, ecl_file_view_type* summaryView,
std::vector<double>* waterFlux, std::vector<double>* oilFlux, std::vector<double>* gasFlux);
private:
static void createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps);
};

View File

@ -232,28 +232,8 @@ bool RifEclipseRestartFilesetAccess::dynamicNNCResults(const ecl_grid_type* grid
}
ecl_file_view_type* summaryView = ecl_file_get_global_view(m_ecl_files[timeStep]);
ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(grid);
{
ecl_nnc_data_type* waterFluxData = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, summaryView);
const double* waterFluxValues = ecl_nnc_data_get_values(waterFluxData);
waterFlux->insert(waterFlux->end(), &waterFluxValues[0], &waterFluxValues[ecl_nnc_data_get_size(waterFluxData)]);
ecl_nnc_data_free(waterFluxData);
}
{
ecl_nnc_data_type* oilFluxData = ecl_nnc_data_alloc_oil_flux(grid, nnc_geo, summaryView);
const double* oilFluxValues = ecl_nnc_data_get_values(oilFluxData);
oilFlux->insert(oilFlux->end(), &oilFluxValues[0], &oilFluxValues[ecl_nnc_data_get_size(oilFluxData)]);
ecl_nnc_data_free(oilFluxData);
}
{
ecl_nnc_data_type* gasFluxData = ecl_nnc_data_alloc_gas_flux(grid, nnc_geo, summaryView);
const double* gasFluxValues = ecl_nnc_data_get_values(gasFluxData);
gasFlux->insert(gasFlux->end(), &gasFluxValues[0], &gasFluxValues[ecl_nnc_data_get_size(gasFluxData)]);
ecl_nnc_data_free(gasFluxData);
}
ecl_nnc_geometry_free(nnc_geo);
RifEclipseOutputFileTools::transferNncFluxData(grid, summaryView, waterFlux, oilFlux, gasFlux);
return true;
}

View File

@ -276,42 +276,12 @@ bool RifEclipseUnifiedRestartFileAccess::dynamicNNCResults(const ecl_grid_type*
if (!openFile())
{
return false;
}
ecl_file_view_type* summaryView = ecl_file_get_restart_view(m_ecl_file, static_cast<int>(timeStep), 0, 0, 0);
ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(grid);
if (nnc_geo)
{
{
ecl_nnc_data_type* waterFluxData = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, summaryView);
if (waterFluxData)
{
const double* waterFluxValues = ecl_nnc_data_get_values(waterFluxData);
waterFlux->insert(waterFlux->end(), &waterFluxValues[0], &waterFluxValues[ecl_nnc_data_get_size(waterFluxData)]);
ecl_nnc_data_free(waterFluxData);
}
}
{
ecl_nnc_data_type* oilFluxData = ecl_nnc_data_alloc_oil_flux(grid, nnc_geo, summaryView);
if (oilFluxData)
{
const double* oilFluxValues = ecl_nnc_data_get_values(oilFluxData);
oilFlux->insert(oilFlux->end(), &oilFluxValues[0], &oilFluxValues[ecl_nnc_data_get_size(oilFluxData)]);
ecl_nnc_data_free(oilFluxData);
}
}
{
ecl_nnc_data_type* gasFluxData = ecl_nnc_data_alloc_gas_flux(grid, nnc_geo, summaryView);
if (gasFluxData)
{
const double* gasFluxValues = ecl_nnc_data_get_values(gasFluxData);
gasFlux->insert(gasFlux->end(), &gasFluxValues[0], &gasFluxValues[ecl_nnc_data_get_size(gasFluxData)]);
ecl_nnc_data_free(gasFluxData);
}
}
ecl_nnc_geometry_free(nnc_geo);
}
RifEclipseOutputFileTools::transferNncFluxData(grid, summaryView, waterFlux, oilFlux, gasFlux);
return true;
}