mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor code
Make use of calculateCurrentTotalCellVisibility for eclipse view to get surface vertices. Prevent usage of individual grid part managers in gRPC-service.
This commit is contained in:
@@ -203,33 +203,6 @@ void RivGridPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
if ( m_surfaceGridLines.notNull() ) model->addPart( m_surfaceGridLines.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns the surface vertices of the grid part
|
||||
///
|
||||
/// Creates vertices if they do not exist
|
||||
/// Used for gRPC service GridGeometryExtraction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3fArray* RivGridPartMgr::getOrCreateSurfaceVertices()
|
||||
{
|
||||
return m_surfaceGenerator.getOrCreateVertices();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get map from quad index to cell index
|
||||
///
|
||||
/// Used for gRPC service GridGeometryExtraction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RivGridPartMgr::getSurfaceQuadToCellIndicesArray()
|
||||
{
|
||||
auto* gridQuadToCellFaceMapper = m_surfaceGenerator.quadToCellFaceMapper();
|
||||
if ( gridQuadToCellFaceMapper == nullptr )
|
||||
{
|
||||
return std::vector<size_t>();
|
||||
}
|
||||
|
||||
return gridQuadToCellFaceMapper->quadToCellIndicesArray();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -71,9 +71,6 @@ public:
|
||||
|
||||
void appendPartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
cvf::Vec3fArray* getOrCreateSurfaceVertices();
|
||||
std::vector<size_t> getSurfaceQuadToCellIndicesArray();
|
||||
|
||||
private:
|
||||
void generatePartGeometry( cvf::StructGridGeometryGenerator& geoBuilder );
|
||||
|
||||
|
||||
@@ -179,22 +179,6 @@ void RivReservoirPartMgr::appendElementVectorResultPartsToModel( cvf::ModelBasic
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get the part manager for main grid
|
||||
///
|
||||
/// Needed for the gRPC service for GridGeometryExtraction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGridPartMgr* RivReservoirPartMgr::mainGridPartManager()
|
||||
{
|
||||
if ( m_allGrids.empty() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// First grid should be the main grid
|
||||
return m_allGrids.at( 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -76,8 +76,6 @@ public:
|
||||
// Element Vector Result
|
||||
void appendElementVectorResultPartsToModel( cvf::ModelBasicList* model, size_t timeStepIndex );
|
||||
|
||||
RivGridPartMgr* mainGridPartManager();
|
||||
|
||||
private:
|
||||
cvf::Collection<RivGridPartMgr> m_allGrids; // Main grid and all LGR's
|
||||
cvf::ref<RivElementVectorResultPartMgr> m_elementVectorResultMgr;
|
||||
|
||||
@@ -910,14 +910,6 @@ void RivReservoirViewPartMgr::computePropertyVisibility( cvf::UByteArray*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Needed for the gRPC service for GridGeometryExtraction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReservoirPartMgr* RivReservoirViewPartMgr::rangeFilteredReservoirPartManager( size_t timeStepIndex )
|
||||
{
|
||||
return reservoirPartManager( RivCellSetEnum::RANGE_FILTERED, timeStepIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -97,8 +97,6 @@ public:
|
||||
const cvf::UByteArray* rangeFilterVisibility,
|
||||
RimEclipsePropertyFilterCollection* propFilterColl );
|
||||
|
||||
RivReservoirPartMgr* rangeFilteredReservoirPartManager( size_t timeStepIndex );
|
||||
|
||||
private:
|
||||
void createGeometry( RivCellSetEnum geometryType );
|
||||
void computeVisibility( cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx );
|
||||
|
||||
@@ -383,6 +383,142 @@ void RimEclipseView::propagateEclipseCaseToChildObjects()
|
||||
m_streamlineCollection->setEclipseCase( currentEclipseCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Collection<cvf::ModelBasicList> RimEclipseView::frameModelsForTimeSteps()
|
||||
{
|
||||
const bool hasPropertyFiltersActive = eclipsePropertyFilterCollection()->hasActiveFilters();
|
||||
|
||||
// Define a vector containing time step indices to produce geometry for.
|
||||
// First entry in this vector is used to define the geometry only result mode with no results.
|
||||
std::vector<size_t> timeStepIndices;
|
||||
|
||||
// The one and only geometry entry
|
||||
timeStepIndices.push_back( 0 );
|
||||
|
||||
// Find the number of time frames the animation needs to show the requested data.
|
||||
|
||||
if ( ( isTimeStepDependentDataVisibleInThisOrComparisonView() && currentGridCellResults()->maxTimeStepCount() > 0 ) )
|
||||
{
|
||||
CVF_ASSERT( currentGridCellResults() );
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < currentGridCellResults()->maxTimeStepCount(); i++ )
|
||||
{
|
||||
timeStepIndices.push_back( i );
|
||||
}
|
||||
}
|
||||
else if ( cellResult()->hasStaticResult() || cellEdgeResult()->hasResult() || hasPropertyFiltersActive ||
|
||||
intersectionCollection()->hasAnyActiveSeparateResults() ||
|
||||
( surfaceInViewCollection() && surfaceInViewCollection()->hasAnyActiveSeparateResults() ) )
|
||||
{
|
||||
// The one and only static result entry
|
||||
timeStepIndices.push_back( 0 );
|
||||
}
|
||||
|
||||
cvf::Collection<cvf::ModelBasicList> frameModels;
|
||||
size_t timeIdx;
|
||||
for ( timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++ )
|
||||
{
|
||||
frameModels.push_back( new cvf::ModelBasicList );
|
||||
}
|
||||
|
||||
return frameModels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::createRequiredReservoirPartManagers( cvf::Collection<cvf::ModelBasicList> frameModels )
|
||||
{
|
||||
const bool hasCellFiltersActive = cellFilterCollection()->hasActiveFilters();
|
||||
const bool hasPropertyFiltersActive = eclipsePropertyFilterCollection()->hasActiveFilters();
|
||||
|
||||
// Create vector of grid indices to render
|
||||
std::vector<size_t> gridIndices = indicesToVisibleGrids();
|
||||
|
||||
///
|
||||
// Get or create the parts for "static" type geometry. The same geometry is used
|
||||
// for the different frames. updateCurrentTimeStep updates the colors etc.
|
||||
// For property filtered geometry : just set all the models as empty scenes
|
||||
// updateCurrentTimeStep requests the actual parts
|
||||
|
||||
if ( !hasPropertyFiltersActive || ( viewController() && viewController()->isVisibleCellsOveridden() ) )
|
||||
{
|
||||
std::vector<RivCellSetEnum> geometryTypesToAdd;
|
||||
|
||||
if ( viewController() && viewController()->isVisibleCellsOveridden() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( OVERRIDDEN_CELL_VISIBILITY );
|
||||
}
|
||||
else if ( hasCellFiltersActive && wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
|
||||
}
|
||||
}
|
||||
else if ( !hasCellFiltersActive && wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS );
|
||||
}
|
||||
else if ( hasCellFiltersActive && !wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
geometryTypesToAdd.push_back( ALL_WELL_CELLS ); // Should be all well cells
|
||||
geometryTypesToAdd.push_back( ACTIVE );
|
||||
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( INACTIVE );
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: This assignment must be done here, as m_visibleGridParts is used in code triggered by
|
||||
// m_reservoirGridPartManager->appendStaticGeometryPartsToModel()
|
||||
setVisibleGridParts( geometryTypesToAdd );
|
||||
|
||||
size_t frameIdx;
|
||||
for ( frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx )
|
||||
{
|
||||
for ( size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx )
|
||||
{
|
||||
if ( isGridVisualizationMode() )
|
||||
{
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel( frameModels[frameIdx].p(),
|
||||
geometryTypesToAdd[gtIdx],
|
||||
gridIndices );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reservoirGridPartManager->ensureStaticGeometryPartsCreated( geometryTypesToAdd[gtIdx] );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set static colors
|
||||
onUpdateStaticCellColors();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RivCellSetEnum> empty;
|
||||
setVisibleGridParts( empty );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -477,128 +613,16 @@ void RimEclipseView::onCreateDisplayModel()
|
||||
const bool cellFiltersActive = cellFilterCollection()->hasActiveFilters();
|
||||
const bool propertyFiltersActive = eclipsePropertyFilterCollection()->hasActiveFilters();
|
||||
|
||||
// Define a vector containing time step indices to produce geometry for.
|
||||
// First entry in this vector is used to define the geometry only result mode with no results.
|
||||
std::vector<size_t> timeStepIndices;
|
||||
|
||||
// The one and only geometry entry
|
||||
timeStepIndices.push_back( 0 );
|
||||
|
||||
// Find the number of time frames the animation needs to show the requested data.
|
||||
|
||||
if ( ( isTimeStepDependentDataVisibleInThisOrComparisonView() && currentGridCellResults()->maxTimeStepCount() > 0 ) )
|
||||
{
|
||||
CVF_ASSERT( currentGridCellResults() );
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < currentGridCellResults()->maxTimeStepCount(); i++ )
|
||||
{
|
||||
timeStepIndices.push_back( i );
|
||||
}
|
||||
}
|
||||
else if ( cellResult()->hasStaticResult() || cellEdgeResult()->hasResult() || propertyFiltersActive ||
|
||||
intersectionCollection()->hasAnyActiveSeparateResults() ||
|
||||
( surfaceInViewCollection() && surfaceInViewCollection()->hasAnyActiveSeparateResults() ) )
|
||||
{
|
||||
// The one and only static result entry
|
||||
timeStepIndices.push_back( 0 );
|
||||
}
|
||||
|
||||
cvf::Collection<cvf::ModelBasicList> frameModels;
|
||||
size_t timeIdx;
|
||||
for ( timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++ )
|
||||
{
|
||||
frameModels.push_back( new cvf::ModelBasicList );
|
||||
}
|
||||
// Get frame models for all time steps
|
||||
cvf::Collection<cvf::ModelBasicList> frameModels = frameModelsForTimeSteps();
|
||||
|
||||
// Remove all existing animation frames from the viewer.
|
||||
// The parts are still cached in the RivReservoir geometry and friends
|
||||
nativeOrOverrideViewer()->removeAllFrames( isUsingOverrideViewer() );
|
||||
|
||||
wellCollection()->scheduleIsWellPipesVisibleRecalculation();
|
||||
|
||||
// Create vector of grid indices to render
|
||||
std::vector<size_t> gridIndices = indicesToVisibleGrids();
|
||||
|
||||
///
|
||||
// Get or create the parts for "static" type geometry. The same geometry is used
|
||||
// for the different frames. updateCurrentTimeStep updates the colors etc.
|
||||
// For property filtered geometry : just set all the models as empty scenes
|
||||
// updateCurrentTimeStep requests the actual parts
|
||||
|
||||
if ( !propertyFiltersActive || ( viewController() && viewController()->isVisibleCellsOveridden() ) )
|
||||
{
|
||||
std::vector<RivCellSetEnum> geometryTypesToAdd;
|
||||
|
||||
if ( viewController() && viewController()->isVisibleCellsOveridden() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( OVERRIDDEN_CELL_VISIBILITY );
|
||||
}
|
||||
else if ( cellFiltersActive && wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
|
||||
}
|
||||
}
|
||||
else if ( !cellFiltersActive && wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS );
|
||||
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS );
|
||||
}
|
||||
else if ( cellFiltersActive && !wellCollection()->hasVisibleWellCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED );
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
geometryTypesToAdd.push_back( ALL_WELL_CELLS ); // Should be all well cells
|
||||
geometryTypesToAdd.push_back( ACTIVE );
|
||||
|
||||
if ( showInactiveCells() )
|
||||
{
|
||||
geometryTypesToAdd.push_back( INACTIVE );
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: This assignment must be done here, as m_visibleGridParts is used in code triggered by
|
||||
// m_reservoirGridPartManager->appendStaticGeometryPartsToModel()
|
||||
setVisibleGridParts( geometryTypesToAdd );
|
||||
|
||||
size_t frameIdx;
|
||||
for ( frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx )
|
||||
{
|
||||
for ( size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx )
|
||||
{
|
||||
if ( isGridVisualizationMode() )
|
||||
{
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel( frameModels[frameIdx].p(),
|
||||
geometryTypesToAdd[gtIdx],
|
||||
gridIndices );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reservoirGridPartManager->ensureStaticGeometryPartsCreated( geometryTypesToAdd[gtIdx] );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set static colors
|
||||
onUpdateStaticCellColors();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RivCellSetEnum> empty;
|
||||
setVisibleGridParts( empty );
|
||||
}
|
||||
// Create required reservoir part managers
|
||||
createRequiredReservoirPartManagers( frameModels );
|
||||
|
||||
m_reservoirGridPartManager->clearWatertightGeometryFlags();
|
||||
|
||||
@@ -1652,6 +1676,17 @@ std::vector<RigEclipseResultAddress> RimEclipseView::additionalResultsForResultI
|
||||
return m_additionalResultsForResultInfo()->additionalResultAddresses();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::createGridGeometryParts()
|
||||
{
|
||||
if ( !( eclipseCase() && eclipseCase()->eclipseCaseData() ) ) return;
|
||||
|
||||
const auto frameModels = frameModelsForTimeSteps();
|
||||
createRequiredReservoirPartManagers( frameModels );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2395,6 +2430,14 @@ bool RimEclipseView::showInactiveCells() const
|
||||
return m_showInactiveCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::setShowInactiveCells( bool showInactive )
|
||||
{
|
||||
m_showInactiveCells = showInactive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -106,6 +106,8 @@ public:
|
||||
bool showInvalidCells() const;
|
||||
bool showInactiveCells() const;
|
||||
|
||||
void setShowInactiveCells( bool showInactive );
|
||||
|
||||
// Access internal objects
|
||||
const RimPropertyFilterCollection* propertyFilterCollection() const override;
|
||||
|
||||
@@ -164,6 +166,8 @@ public:
|
||||
|
||||
std::vector<RigEclipseResultAddress> additionalResultsForResultInfo() const;
|
||||
|
||||
void createGridGeometryParts();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
@@ -221,6 +225,9 @@ private:
|
||||
|
||||
void propagateEclipseCaseToChildObjects();
|
||||
|
||||
cvf::Collection<cvf::ModelBasicList> frameModelsForTimeSteps();
|
||||
void createRequiredReservoirPartManagers( cvf::Collection<cvf::ModelBasicList> frameModels );
|
||||
|
||||
protected:
|
||||
cvf::ref<cvf::ModelBasicList> m_faultReactVizModel;
|
||||
|
||||
|
||||
@@ -63,14 +63,19 @@ grpc::Status RiaGrpcGridGeometryExtractionService::GetGridSurface( grpc::ServerC
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve grid surface vertices from eclipse view
|
||||
status = initializeMainGridPartManagerFromEclipseView();
|
||||
// Ensure static geometry parts created for grid part manager in view
|
||||
m_eclipseView->createGridGeometryParts();
|
||||
|
||||
// Initialize grid geometry generator
|
||||
const bool useOpenMP = false;
|
||||
auto* gridGeometryGenerator = new cvf::StructGridGeometryGenerator( m_eclipseView->mainGrid(), useOpenMP );
|
||||
status = initializeGridGeometryGeneratorWithEclipseViewCellVisibility( gridGeometryGenerator );
|
||||
if ( status.error_code() != grpc::StatusCode::OK )
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
auto* gridSurfaceVertices = m_mainGridPartManager->getOrCreateSurfaceVertices();
|
||||
auto* gridSurfaceVertices = gridGeometryGenerator->getOrCreateVertices();
|
||||
if ( gridSurfaceVertices == nullptr )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No grid vertices found" );
|
||||
@@ -96,7 +101,11 @@ grpc::Status RiaGrpcGridGeometryExtractionService::GetGridSurface( grpc::ServerC
|
||||
response->set_allocated_originutm( modelOffset );
|
||||
|
||||
// Source cell indices from main grid part manager
|
||||
const auto sourceCellIndicesArray = m_mainGridPartManager->getSurfaceQuadToCellIndicesArray();
|
||||
std::vector<size_t> sourceCellIndicesArray = std::vector<size_t>();
|
||||
if ( gridGeometryGenerator->quadToCellFaceMapper() != nullptr )
|
||||
{
|
||||
sourceCellIndicesArray = gridGeometryGenerator->quadToCellFaceMapper()->quadToCellIndicesArray();
|
||||
}
|
||||
if ( sourceCellIndicesArray.empty() )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No source cell indices array found" );
|
||||
@@ -158,10 +167,9 @@ std::vector<RiaGrpcCallbackInterface*> RiaGrpcGridGeometryExtractionService::cre
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcGridGeometryExtractionService::resetInternalPointers()
|
||||
{
|
||||
m_application = nullptr;
|
||||
m_eclipseCase = nullptr;
|
||||
m_eclipseView = nullptr;
|
||||
m_mainGridPartManager = nullptr;
|
||||
m_application = nullptr;
|
||||
m_eclipseCase = nullptr;
|
||||
m_eclipseView = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -204,37 +212,30 @@ grpc::Status RiaGrpcGridGeometryExtractionService::applyIJKCellFilterToEclipseCa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaGrpcGridGeometryExtractionService::initializeMainGridPartManagerFromEclipseView()
|
||||
grpc::Status RiaGrpcGridGeometryExtractionService::initializeGridGeometryGeneratorWithEclipseViewCellVisibility(
|
||||
cvf::StructGridGeometryGenerator* generator )
|
||||
{
|
||||
if ( m_eclipseView == nullptr )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No initialized eclipse view found" );
|
||||
}
|
||||
|
||||
auto* viewPartManager = m_eclipseView->reservoirGridPartManager();
|
||||
if ( viewPartManager == nullptr )
|
||||
auto* mainGrid = m_eclipseCase->mainGrid();
|
||||
if ( mainGrid == nullptr )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No view part manager found for eclipse view" );
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No main grid found for eclipse view" );
|
||||
}
|
||||
|
||||
// Ensure static geometry parts created prior to getting part manager
|
||||
viewPartManager->ensureStaticGeometryPartsCreated( RivCellSetEnum::RANGE_FILTERED );
|
||||
// Cell visibilities
|
||||
const int firstTimeStep = 0;
|
||||
auto* cellVisibilities = new cvf::UByteArray( mainGrid->cellCount() );
|
||||
m_eclipseView->calculateCurrentTotalCellVisibility( cellVisibilities, firstTimeStep );
|
||||
|
||||
const size_t timeStepIndex = 0;
|
||||
auto rangeFilteredPartManager = viewPartManager->rangeFilteredReservoirPartManager( timeStepIndex );
|
||||
// Face visibility filter
|
||||
auto* faceVisibilityFilter = new RigGridCellFaceVisibilityFilter( mainGrid );
|
||||
|
||||
if ( rangeFilteredPartManager == nullptr )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No range filtered part manager found for eclipse view" );
|
||||
}
|
||||
|
||||
auto* mainGridPartManager = rangeFilteredPartManager->mainGridPartManager();
|
||||
if ( mainGridPartManager == nullptr )
|
||||
{
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND,
|
||||
"No main grid part manager found for range filtered part manager" );
|
||||
}
|
||||
m_mainGridPartManager = mainGridPartManager;
|
||||
generator->setCellVisibility( cellVisibilities );
|
||||
generator->addFaceVisibilityFilter( faceVisibilityFilter );
|
||||
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
@@ -313,6 +314,7 @@ grpc::Status RiaGrpcGridGeometryExtractionService::initializeApplicationAndEclip
|
||||
return grpc::Status( grpc::StatusCode::NOT_FOUND, "No eclipse view found for eclipse case" );
|
||||
}
|
||||
m_eclipseView = dynamic_cast<RimEclipseView*>( m_eclipseCase->views().front() );
|
||||
m_eclipseView->setShowInactiveCells( true );
|
||||
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "RivGridPartMgr.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
@@ -62,12 +63,12 @@ private:
|
||||
void resetInternalPointers();
|
||||
|
||||
grpc::Status loadGridGeometryFromAbsoluteFilePath( const std::string filePath );
|
||||
grpc::Status initializeApplicationAndEclipseCaseAndEclipseViewFromAbsoluteFilePath( const std::string filePath );
|
||||
grpc::Status initializeMainGridPartManagerFromEclipseView();
|
||||
grpc::Status applyIJKCellFilterToEclipseCase( const rips::IJKIndexFilter& filter );
|
||||
grpc::Status initializeApplicationAndEclipseCaseAndEclipseViewFromAbsoluteFilePath( const std::string filePath );
|
||||
|
||||
RiaApplication* m_application = nullptr;
|
||||
RimEclipseCase* m_eclipseCase = nullptr;
|
||||
RimEclipseView* m_eclipseView = nullptr;
|
||||
RivGridPartMgr* m_mainGridPartManager = nullptr;
|
||||
grpc::Status initializeGridGeometryGeneratorWithEclipseViewCellVisibility( cvf::StructGridGeometryGenerator* generator );
|
||||
|
||||
RiaApplication* m_application = nullptr;
|
||||
RimEclipseCase* m_eclipseCase = nullptr;
|
||||
RimEclipseView* m_eclipseView = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user