mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Depth plot as docking widget (#9909)
* Add docked depth result plot for eclipse data * Update dock layout defaults
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultAccessorFactory.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllGridCellsResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellsResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellEdgeResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCombTransResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCombMultResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTernaryResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTimeHistoryResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigDepthResultAccessor.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultAccessorFactory.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllGridCellsResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellsResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellEdgeResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCombTransResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCombMultResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTernaryResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTimeHistoryResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigDepthResultAccessor.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
|
||||
|
||||
source_group(
|
||||
"ReservoirDataModel\\ResultAccessors"
|
||||
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
|
||||
)
|
||||
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
RigActiveCellsResultAccessor::RigActiveCellsResultAccessor( const RigGridBase* grid,
|
||||
const std::vector<double>* reservoirResultValues,
|
||||
const RigActiveCellInfo* activeCellInfo )
|
||||
: m_activeCellInfo( activeCellInfo )
|
||||
, m_grid( grid )
|
||||
, m_reservoirResultValues( reservoirResultValues )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
size_t reservoirCellIndex = m_grid->reservoirCellIndex( gridLocalCellIndex );
|
||||
size_t resultValueIndex = m_activeCellInfo->cellResultIndex( reservoirCellIndex );
|
||||
if ( resultValueIndex == cvf::UNDEFINED_SIZE_T ) return HUGE_VAL;
|
||||
|
||||
if ( resultValueIndex < m_reservoirResultValues->size() ) return m_reservoirResultValues->at( resultValueIndex );
|
||||
|
||||
CVF_TIGHT_ASSERT( resultValueIndex < m_activeCellInfo->reservoirActiveCellCount() ); // Because some static results
|
||||
// might lack LGR data
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessor::cellScalarGlobIdx( size_t reservoirCellIndex ) const
|
||||
{
|
||||
if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
size_t resultValueIndex = m_activeCellInfo->cellResultIndex( reservoirCellIndex );
|
||||
if ( resultValueIndex == cvf::UNDEFINED_SIZE_T ) return HUGE_VAL;
|
||||
|
||||
if ( resultValueIndex < m_reservoirResultValues->size() ) return m_reservoirResultValues->at( resultValueIndex );
|
||||
|
||||
CVF_TIGHT_ASSERT( resultValueIndex < m_activeCellInfo->reservoirActiveCellCount() ); // Because some static results
|
||||
// might lack LGR data
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
class RigGridBase;
|
||||
class RigActiveCellInfo;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigActiveCellsResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
RigActiveCellsResultAccessor( const RigGridBase* grid,
|
||||
const std::vector<double>* reservoirResultValues,
|
||||
const RigActiveCellInfo* activeCellInfo );
|
||||
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
private:
|
||||
const RigActiveCellInfo* m_activeCellInfo;
|
||||
const RigGridBase* m_grid;
|
||||
const std::vector<double>* m_reservoirResultValues;
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigAllGridCellsResultAccessor.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllGridCellsResultAccessor::RigAllGridCellsResultAccessor( const RigGridBase* grid, const std::vector<double>* reservoirResultValues )
|
||||
: m_grid( grid )
|
||||
, m_reservoirResultValues( reservoirResultValues )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
if ( m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
size_t reservoirCellIndex = m_grid->reservoirCellIndex( gridLocalCellIndex );
|
||||
CVF_TIGHT_ASSERT( reservoirCellIndex < m_reservoirResultValues->size() );
|
||||
|
||||
return m_reservoirResultValues->at( reservoirCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
if ( m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
CVF_TIGHT_ASSERT( globCellIndex < m_reservoirResultValues->size() );
|
||||
|
||||
return m_reservoirResultValues->at( globCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigAllGridCellsResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
RigAllGridCellsResultAccessor( const RigGridBase* grid, const std::vector<double>* reservoirResultValues );
|
||||
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
private:
|
||||
const RigGridBase* m_grid;
|
||||
const std::vector<double>* m_reservoirResultValues;
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigCellEdgeResultAccessor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCellEdgeResultAccessor::RigCellEdgeResultAccessor()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCellEdgeResultAccessor::setDataAccessObjectForFace( cvf::StructGridInterface::FaceType faceId, RigResultAccessor* resultAccessObject )
|
||||
{
|
||||
m_resultAccessObjects[faceId] = resultAccessObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCellEdgeResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
// TODO: How to handle when we get here?
|
||||
CVF_ASSERT( false );
|
||||
|
||||
return cvf::UNDEFINED_DOUBLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCellEdgeResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
const RigResultAccessor* resultAccessObj = m_resultAccessObjects[faceId].p();
|
||||
if ( resultAccessObj != nullptr )
|
||||
{
|
||||
return resultAccessObj->cellFaceScalar( gridLocalCellIndex, faceId );
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCellEdgeResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
// TODO: How to handle when we get here?
|
||||
CVF_ASSERT( false );
|
||||
|
||||
return cvf::UNDEFINED_DOUBLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCellEdgeResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
const RigResultAccessor* resultAccessObj = m_resultAccessObjects[faceId].p();
|
||||
if ( resultAccessObj != nullptr )
|
||||
{
|
||||
return resultAccessObj->cellFaceScalarGlobIdx( globCellIndex, faceId );
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigCellEdgeResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
RigCellEdgeResultAccessor();
|
||||
|
||||
void setDataAccessObjectForFace( cvf::StructGridInterface::FaceType faceId, RigResultAccessor* resultAccessObject );
|
||||
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
private:
|
||||
std::array<cvf::ref<RigResultAccessor>, 6> m_resultAccessObjects;
|
||||
};
|
||||
@@ -0,0 +1,173 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigCombMultResultAccessor.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include "RigCell.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCombMultResultAccessor::RigCombMultResultAccessor( const RigGridBase* grid )
|
||||
: m_grid( grid )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCombMultResultAccessor::setMultResultAccessors( RigResultAccessor* multXPosAccessor,
|
||||
RigResultAccessor* multXNegAccessor,
|
||||
RigResultAccessor* multYPosAccessor,
|
||||
RigResultAccessor* multYNegAccessor,
|
||||
RigResultAccessor* multZPosAccessor,
|
||||
RigResultAccessor* multZNegAccessor )
|
||||
{
|
||||
m_multXPosAccessor = multXPosAccessor;
|
||||
m_multXNegAccessor = multXNegAccessor;
|
||||
m_multYPosAccessor = multYPosAccessor;
|
||||
m_multYNegAccessor = multYNegAccessor;
|
||||
m_multZPosAccessor = multZPosAccessor;
|
||||
m_multZNegAccessor = multZNegAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombMultResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT( false );
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombMultResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
size_t i, j, k, neighborGridCellIdx;
|
||||
m_grid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k );
|
||||
|
||||
double faceScalarThisCell = nativeMultScalar( gridLocalCellIndex, faceId );
|
||||
|
||||
double faceScalarNeighborCell = 1.0;
|
||||
if ( m_grid->cellIJKNeighbor( i, j, k, faceId, &neighborGridCellIdx ) )
|
||||
{
|
||||
faceScalarNeighborCell = nativeMultScalar( neighborGridCellIdx, cvf::StructGridInterface::oppositeFace( faceId ) );
|
||||
}
|
||||
|
||||
return faceScalarThisCell * faceScalarNeighborCell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombMultResultAccessor::nativeMultScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
double faceScalar = 1.0;
|
||||
|
||||
switch ( faceId )
|
||||
{
|
||||
case cvf::StructGridInterface::POS_I:
|
||||
{
|
||||
if ( m_multXPosAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multXPosAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case cvf::StructGridInterface::NEG_I:
|
||||
{
|
||||
if ( m_multXNegAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multXNegAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case cvf::StructGridInterface::POS_J:
|
||||
{
|
||||
if ( m_multYPosAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multYPosAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case cvf::StructGridInterface::NEG_J:
|
||||
{
|
||||
if ( m_multYNegAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multYNegAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case cvf::StructGridInterface::POS_K:
|
||||
{
|
||||
if ( m_multZPosAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multZPosAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case cvf::StructGridInterface::NEG_K:
|
||||
{
|
||||
if ( m_multZNegAccessor.notNull() )
|
||||
{
|
||||
faceScalar = m_multZNegAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// FaceScalar with value HUGE_VAL means value outside valid IJK-range. Clamp to 1.0 as this means no change in MULT
|
||||
// factor.
|
||||
if ( faceScalar == HUGE_VAL )
|
||||
{
|
||||
faceScalar = 1.0;
|
||||
}
|
||||
|
||||
return faceScalar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombMultResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT( false );
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombMultResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
size_t gridLocalCellIndex = m_grid->mainGrid()->cell( globCellIndex ).gridLocalCellIndex();
|
||||
return this->cellFaceScalar( gridLocalCellIndex, faceId );
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigCombMultResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
explicit RigCombMultResultAccessor( const RigGridBase* grid );
|
||||
|
||||
void setMultResultAccessors( RigResultAccessor* multXPosAccessor,
|
||||
RigResultAccessor* multXNegAccessor,
|
||||
RigResultAccessor* multYPosAccessor,
|
||||
RigResultAccessor* multYNegAccessor,
|
||||
RigResultAccessor* multZPosAccessor,
|
||||
RigResultAccessor* multZNegAccessor );
|
||||
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
private:
|
||||
double nativeMultScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const;
|
||||
|
||||
private:
|
||||
cvf::ref<RigResultAccessor> m_multXPosAccessor;
|
||||
cvf::ref<RigResultAccessor> m_multXNegAccessor;
|
||||
cvf::ref<RigResultAccessor> m_multYPosAccessor;
|
||||
cvf::ref<RigResultAccessor> m_multYNegAccessor;
|
||||
cvf::ref<RigResultAccessor> m_multZPosAccessor;
|
||||
cvf::ref<RigResultAccessor> m_multZNegAccessor;
|
||||
|
||||
const RigGridBase* m_grid;
|
||||
};
|
||||
@@ -0,0 +1,161 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigCombTransResultAccessor.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include "RigCell.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCombTransResultAccessor::RigCombTransResultAccessor( const RigGridBase* grid )
|
||||
: m_grid( grid )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Only sensible to provide the positive values, as the negative ones will never be used.
|
||||
/// The negative faces gets their value from the neighbor cell in that direction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCombTransResultAccessor::setTransResultAccessors( RigResultAccessor* xTransAccessor,
|
||||
RigResultAccessor* yTransAccessor,
|
||||
RigResultAccessor* zTransAccessor )
|
||||
|
||||
{
|
||||
m_xTransAccessor = xTransAccessor;
|
||||
m_yTransAccessor = yTransAccessor;
|
||||
m_zTransAccessor = zTransAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT( false );
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get tran value from neighbor cell. Return 0.0 on active/inactive cell borders and end of grid
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessor::neighborCellTran( size_t gridLocalCellIndex,
|
||||
cvf::StructGridInterface::FaceType faceId,
|
||||
const RigResultAccessor* transAccessor ) const
|
||||
{
|
||||
if ( transAccessor != nullptr )
|
||||
{
|
||||
size_t i, j, k, neighborGridCellIdx;
|
||||
m_grid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k );
|
||||
|
||||
if ( m_grid->cellIJKNeighbor( i, j, k, faceId, &neighborGridCellIdx ) )
|
||||
{
|
||||
double neighborCellValue = transAccessor->cellScalar( neighborGridCellIdx );
|
||||
if ( neighborCellValue == HUGE_VAL && transAccessor->cellScalar( gridLocalCellIndex ) != HUGE_VAL )
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return neighborCellValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
switch ( faceId )
|
||||
{
|
||||
case cvf::StructGridInterface::POS_I:
|
||||
{
|
||||
if ( m_xTransAccessor.notNull() )
|
||||
{
|
||||
return m_xTransAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_I:
|
||||
{
|
||||
return this->neighborCellTran( gridLocalCellIndex, cvf::StructGridInterface::NEG_I, m_xTransAccessor.p() );
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::POS_J:
|
||||
{
|
||||
if ( m_yTransAccessor.notNull() )
|
||||
{
|
||||
return m_yTransAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_J:
|
||||
{
|
||||
return this->neighborCellTran( gridLocalCellIndex, cvf::StructGridInterface::NEG_J, m_yTransAccessor.p() );
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::POS_K:
|
||||
{
|
||||
if ( m_zTransAccessor.notNull() )
|
||||
{
|
||||
return m_zTransAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_K:
|
||||
{
|
||||
return this->neighborCellTran( gridLocalCellIndex, cvf::StructGridInterface::NEG_K, m_zTransAccessor.p() );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT( false );
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
size_t gridLocalCellIndex = m_grid->mainGrid()->cell( globCellIndex ).gridLocalCellIndex();
|
||||
return this->cellFaceScalar( gridLocalCellIndex, faceId );
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigCombTransResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
explicit RigCombTransResultAccessor( const RigGridBase* grid );
|
||||
|
||||
void setTransResultAccessors( RigResultAccessor* xTransAccessor, RigResultAccessor* yTransAccessor, RigResultAccessor* zTransAccessor );
|
||||
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
|
||||
private:
|
||||
double neighborCellTran( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId, const RigResultAccessor* transAccessor ) const;
|
||||
|
||||
cvf::ref<RigResultAccessor> m_xTransAccessor;
|
||||
cvf::ref<RigResultAccessor> m_yTransAccessor;
|
||||
cvf::ref<RigResultAccessor> m_zTransAccessor;
|
||||
|
||||
const RigGridBase* m_grid;
|
||||
};
|
||||
@@ -0,0 +1,153 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigDepthResultAccessor.h"
|
||||
|
||||
#include "RigCell.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigDepthResultAccessor::resultValues( RigEclipseCaseData* eclipseCaseData,
|
||||
RimEclipseResultDefinition* resultDefinition,
|
||||
int gridIndex,
|
||||
size_t cellIndex,
|
||||
int currentTimeStep )
|
||||
{
|
||||
std::vector<double> values;
|
||||
|
||||
RigHugeValResultAccessor hugeVal;
|
||||
|
||||
if ( cellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t dummy = 0;
|
||||
|
||||
auto kvals = kValues( eclipseCaseData, gridIndex );
|
||||
|
||||
auto grid = eclipseCaseData->grid( gridIndex );
|
||||
|
||||
if ( grid->ijkFromCellIndex( cellIndex, &i, &j, &dummy ) )
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor =
|
||||
RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, gridIndex, currentTimeStep, resultDefinition );
|
||||
|
||||
for ( auto k : kvals )
|
||||
{
|
||||
int tmpCellIdx = grid->cellIndexFromIJK( i, j, k );
|
||||
|
||||
if ( resultAccessor.notNull() )
|
||||
{
|
||||
values.push_back( resultAccessor->cellScalar( tmpCellIdx ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
values.push_back( hugeVal.cellScalar( tmpCellIdx ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RigDepthResultAccessor::kValues( RigEclipseCaseData* eclipseCaseData, int gridIndex )
|
||||
{
|
||||
std::vector<int> kvals;
|
||||
int maxK = eclipseCaseData->grid( gridIndex )->cellCountK();
|
||||
|
||||
for ( int i = 0; i < maxK; i++ )
|
||||
{
|
||||
kvals.push_back( i );
|
||||
}
|
||||
|
||||
return kvals;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigDepthResultAccessor::depthValues( RigEclipseCaseData* eclipseCaseData, int startCellIndex, int gridIndex )
|
||||
{
|
||||
std::vector<double> depthVals;
|
||||
|
||||
auto grid = eclipseCaseData->grid( gridIndex );
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t dummy = 0;
|
||||
|
||||
if ( grid->ijkFromCellIndex( startCellIndex, &i, &j, &dummy ) )
|
||||
{
|
||||
int maxK = grid->cellCountK();
|
||||
|
||||
for ( int k = 0; k < maxK; k++ )
|
||||
{
|
||||
auto cellIdx = grid->cellIndexFromIJK( i, j, k );
|
||||
|
||||
auto& cell = grid->cell( cellIdx );
|
||||
if ( cell.isInvalid() )
|
||||
{
|
||||
depthVals.push_back( std::nan( "" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto center = cell.center();
|
||||
depthVals.push_back( -1.0 * center.z() );
|
||||
}
|
||||
}
|
||||
}
|
||||
return depthVals;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigDepthResultAccessor::geometrySelectionText( RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex )
|
||||
{
|
||||
QString text;
|
||||
|
||||
if ( eclipseCaseData )
|
||||
{
|
||||
if ( cellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
if ( eclipseCaseData->grid( gridIndex )->ijkFromCellIndex( cellIndex, &i, &j, &k ) )
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
|
||||
text += QString( "[%1, %2]" ).arg( i ).arg( j );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RimEclipseResultDefinition;
|
||||
|
||||
class RigDepthResultAccessor
|
||||
{
|
||||
public:
|
||||
static QString geometrySelectionText( RigEclipseCaseData* eclipseCaseData, size_t m_gridIndex, size_t m_cellIndex );
|
||||
static std::vector<double> resultValues( RigEclipseCaseData* eclipseCaseData,
|
||||
RimEclipseResultDefinition* resultDefinition,
|
||||
int gridIndex,
|
||||
size_t cellIndex,
|
||||
int currentTimeStep );
|
||||
|
||||
static std::vector<int> kValues( RigEclipseCaseData* eclipseCaseData, int gridIndex );
|
||||
static std::vector<double> depthValues( RigEclipseCaseData* eclipseCaseData, int startCellIndex, int gridIndex );
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigResultAccessor : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual double cellScalar( size_t gridLocalCellIndex ) const = 0;
|
||||
virtual double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const = 0;
|
||||
virtual double cellScalarGlobIdx( size_t globCellIndex ) const = 0;
|
||||
virtual double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const = 0;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigHugeValResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
double cellScalar( size_t gridLocalCellIndex ) const override;
|
||||
double cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
double cellScalarGlobIdx( size_t globCellIndex ) const override;
|
||||
double cellFaceScalarGlobIdx( size_t globCellIndex, cvf::StructGridInterface::FaceType faceId ) const override;
|
||||
};
|
||||
@@ -0,0 +1,380 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
#include "RigAllGridCellsResultAccessor.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCombMultResultAccessor.h"
|
||||
#include "RigCombTransResultAccessor.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
const RimEclipseResultDefinition* resultDefinition )
|
||||
{
|
||||
if ( resultDefinition->isFlowDiagOrInjectionFlooding() )
|
||||
{
|
||||
RimFlowDiagSolution* flowSol = resultDefinition->flowDiagSolution();
|
||||
if ( !flowSol ) return new RigHugeValResultAccessor;
|
||||
;
|
||||
|
||||
const std::vector<double>* resultValues =
|
||||
flowSol->flowDiagResults()->resultValues( resultDefinition->flowDiagResAddress(), timeStepIndex );
|
||||
if ( !resultValues ) return new RigHugeValResultAccessor;
|
||||
|
||||
const RigGridBase* grid = eclipseCase->grid( gridIndex );
|
||||
if ( !grid ) return new RigHugeValResultAccessor;
|
||||
|
||||
cvf::ref<RigResultAccessor> object =
|
||||
new RigActiveCellsResultAccessor( grid, resultValues, eclipseCase->activeCellInfo( resultDefinition->porosityModel() ) );
|
||||
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RigResultAccessorFactory::createFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
resultDefinition->porosityModel(),
|
||||
timeStepIndex,
|
||||
resultDefinition->eclipseResultAddress() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultAddress( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
if ( !eclipseCase || !eclipseCase->results( porosityModel ) || !eclipseCase->activeCellInfo( porosityModel ) )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( !eclipseCase->results( porosityModel )->hasResultEntry( resVarAddr ) )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t adjustedTimeStepIndex = timeStepIndex;
|
||||
if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
resVarAddr.resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES ||
|
||||
resVarAddr.resultCatType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS )
|
||||
{
|
||||
adjustedTimeStepIndex = 0;
|
||||
}
|
||||
else if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::INPUT_PROPERTY )
|
||||
{
|
||||
if ( eclipseCase->results( porosityModel )->timeStepCount( resVarAddr ) == 1 )
|
||||
{
|
||||
adjustedTimeStepIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<RigResultAccessor> derivedCandidate =
|
||||
createCombinedResultAccessor( eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, resVarAddr );
|
||||
|
||||
if ( derivedCandidate.notNull() ) return derivedCandidate;
|
||||
|
||||
return createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, resVarAddr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createCombinedResultAccessor( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
CVF_ASSERT( gridIndex < eclipseCase->gridCount() );
|
||||
CVF_ASSERT( eclipseCase );
|
||||
CVF_ASSERT( eclipseCase->results( porosityModel ) );
|
||||
CVF_ASSERT( eclipseCase->activeCellInfo( porosityModel ) );
|
||||
|
||||
RigEclipseResultAddress nativeAddr( resVarAddr );
|
||||
const RigGridBase* grid = eclipseCase->grid( gridIndex );
|
||||
|
||||
if ( resVarAddr.resultName() == RiaResultNames::combinedTransmissibilityResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.setResultName( "TRANX" );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "TRANY" );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "TRANZ" );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( "MULTX" );
|
||||
cvf::ref<RigResultAccessor> multXPos =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "MULTX-" );
|
||||
cvf::ref<RigResultAccessor> multXNeg =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "MULTY" );
|
||||
cvf::ref<RigResultAccessor> multYPos =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "MULTY-" );
|
||||
cvf::ref<RigResultAccessor> multYNeg =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "MULTZ" );
|
||||
cvf::ref<RigResultAccessor> multZPos =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "MULTZ-" );
|
||||
cvf::ref<RigResultAccessor> multZNeg =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setMultResultAccessors( multXPos.p(), multXNeg.p(), multYPos.p(), multYNeg.p(), multZPos.p(), multZNeg.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( RiaResultNames::riTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.setResultName( RiaResultNames::riMultXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riMultYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riMultZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xRiMultAccessor.p(), yRiMultAccessor.p(), zRiMultAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiAreaNormTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedWaterFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( "FLRWATI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLRWATJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLRWATK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedOilFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( "FLROILI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLROILJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLROILK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedGasFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.setResultName( "FLRGASI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLRGASJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( "FLRGASK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.resultName().endsWith( "IJK" ) )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
QString baseName = resVarAddr.resultName().left( resVarAddr.resultName().size() - 3 );
|
||||
|
||||
nativeAddr.setResultName( QString( "%1I" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> iAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( QString( "%1J" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> jAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
nativeAddr.setResultName( QString( "%1K" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> kAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, nativeAddr );
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors( iAccessor.p(), jAccessor.p(), kAccessor.p() );
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeFromResultAddress( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resultAddress )
|
||||
{
|
||||
if ( !eclipseCase || !eclipseCase->results( porosityModel ) || !eclipseCase->activeCellInfo( porosityModel ) )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( !eclipseCase->results( porosityModel )->hasResultEntry( resultAddress ) )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( !resultAddress.isValid() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const RigGridBase* grid = eclipseCase->grid( gridIndex );
|
||||
if ( !grid )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::vector<std::vector<double>>& scalarSetResults = eclipseCase->results( porosityModel )->cellScalarResults( resultAddress );
|
||||
|
||||
if ( timeStepIndex >= scalarSetResults.size() )
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
const std::vector<double>* resultValues = nullptr;
|
||||
if ( timeStepIndex < scalarSetResults.size() )
|
||||
{
|
||||
resultValues = &( scalarSetResults[timeStepIndex] );
|
||||
}
|
||||
|
||||
if ( !resultValues || resultValues->size() == 0 )
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
bool useGlobalActiveIndex = eclipseCase->results( porosityModel )->isUsingGlobalActiveIndex( resultAddress );
|
||||
if ( useGlobalActiveIndex )
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object =
|
||||
new RigActiveCellsResultAccessor( grid, resultValues, eclipseCase->activeCellInfo( porosityModel ) );
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object = new RigAllGridCellsResultAccessor( grid, resultValues );
|
||||
return object;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigGridBase;
|
||||
|
||||
class RimEclipseResultDefinition;
|
||||
class RigEclipseResultAddress;
|
||||
|
||||
class RigResultAccessorFactory
|
||||
{
|
||||
public:
|
||||
static cvf::ref<RigResultAccessor> createFromResultDefinition( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
const RimEclipseResultDefinition* resultDefinition );
|
||||
|
||||
static cvf::ref<RigResultAccessor> createFromResultAddress( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
private:
|
||||
static cvf::ref<RigResultAccessor> createCombinedResultAccessor( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
static cvf::ref<RigResultAccessor> createNativeFromResultAddress( const RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const RigEclipseResultAddress& resVarAddr );
|
||||
};
|
||||
@@ -0,0 +1,163 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigTernaryResultAccessor.h"
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigTernaryResultAccessor::RigTernaryResultAccessor()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Requires at least two data objects present, asserts if more than one data accessor is nullptr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTernaryResultAccessor::setTernaryResultAccessors( RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat )
|
||||
{
|
||||
m_soilAccessor = soil;
|
||||
m_sgasAccessor = sgas;
|
||||
m_swatAccessor = swat;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// If only swat is present, soil is set to (1.0 - swat) and sgas to 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2d RigTernaryResultAccessor::cellScalar( size_t gridLocalCellIndex ) const
|
||||
{
|
||||
double soil = 0.0;
|
||||
double sgas = 0.0;
|
||||
|
||||
if ( m_soilAccessor.notNull() )
|
||||
{
|
||||
soil = m_soilAccessor->cellScalar( gridLocalCellIndex );
|
||||
|
||||
if ( m_sgasAccessor.notNull() )
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
else if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
sgas = 1.0 - soil - m_swatAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
sgas = 1.0 - soil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_sgasAccessor.notNull() )
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar( gridLocalCellIndex );
|
||||
|
||||
if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
soil = 1.0 - sgas - m_swatAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
soil = 1.0 - sgas;
|
||||
}
|
||||
}
|
||||
else if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
soil = 1.0 - m_swatAccessor->cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
}
|
||||
|
||||
return cvf::Vec2d( soil, sgas );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2d RigTernaryResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
|
||||
{
|
||||
return cellScalar( gridLocalCellIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2d RigTernaryResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const
|
||||
{
|
||||
double soil = 0.0;
|
||||
double sgas = 0.0;
|
||||
|
||||
if ( m_soilAccessor.notNull() )
|
||||
{
|
||||
soil = m_soilAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
|
||||
if ( soil == HUGE_VAL )
|
||||
{
|
||||
return cvf::Vec2d( HUGE_VAL, HUGE_VAL );
|
||||
}
|
||||
|
||||
if ( m_sgasAccessor.notNull() )
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
else if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
sgas = 1.0 - soil - m_swatAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
sgas = 1.0 - soil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_sgasAccessor.notNull() )
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
|
||||
if ( sgas == HUGE_VAL )
|
||||
{
|
||||
return cvf::Vec2d( HUGE_VAL, HUGE_VAL );
|
||||
}
|
||||
|
||||
if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
soil = 1.0 - sgas - m_swatAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
soil = 1.0 - sgas;
|
||||
}
|
||||
}
|
||||
else if ( m_swatAccessor.notNull() )
|
||||
{
|
||||
double swat = m_swatAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
if ( swat == HUGE_VAL )
|
||||
{
|
||||
return cvf::Vec2d( HUGE_VAL, HUGE_VAL );
|
||||
}
|
||||
|
||||
soil = 1.0 - m_swatAccessor->cellScalarGlobIdx( globCellIndex );
|
||||
}
|
||||
}
|
||||
|
||||
return cvf::Vec2d( soil, sgas );
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "cvfVector2.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigTernaryResultAccessor : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigTernaryResultAccessor();
|
||||
|
||||
/// Requires two of the arguments to be present
|
||||
void setTernaryResultAccessors( RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat );
|
||||
|
||||
/// Returns [SOIL, SGAS] regardless of which one of the three is missing. if Soil or SWat is missing, it is
|
||||
/// calculated based on the two others
|
||||
cvf::Vec2d cellScalar( size_t gridLocalCellIndex ) const;
|
||||
cvf::Vec2d cellFaceScalar( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const;
|
||||
cvf::Vec2d cellScalarGlobIdx( size_t globCellIndex ) const;
|
||||
|
||||
private:
|
||||
cvf::ref<RigResultAccessor> m_soilAccessor;
|
||||
cvf::ref<RigResultAccessor> m_sgasAccessor;
|
||||
cvf::ref<RigResultAccessor> m_swatAccessor;
|
||||
};
|
||||
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
//#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigTimeHistoryResultAccessor::timeHistoryValues( RigEclipseCaseData* eclipseCaseData,
|
||||
RimEclipseResultDefinition* resultDefinition,
|
||||
size_t gridIndex,
|
||||
size_t cellIndex,
|
||||
size_t timeStepCount )
|
||||
{
|
||||
std::vector<double> values;
|
||||
|
||||
RigHugeValResultAccessor hugeVal;
|
||||
|
||||
for ( size_t i = 0; i < timeStepCount; i++ )
|
||||
{
|
||||
// TODO: Consider rewrite RigResultAccessorFactory::createFromResultDefinition so the function always returns a
|
||||
// valid result accessor. Use hugeVal result accessor if no valid result is found
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor =
|
||||
RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, gridIndex, i, resultDefinition );
|
||||
if ( resultAccessor.notNull() )
|
||||
{
|
||||
values.push_back( resultAccessor->cellScalar( cellIndex ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
values.push_back( hugeVal.cellScalar( cellIndex ) );
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigTimeHistoryResultAccessor::geometrySelectionText( RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex )
|
||||
{
|
||||
QString text;
|
||||
|
||||
if ( eclipseCaseData )
|
||||
{
|
||||
if ( cellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
if ( eclipseCaseData->grid( gridIndex )->ijkFromCellIndex( cellIndex, &i, &j, &k ) )
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
k++;
|
||||
|
||||
text += QString( "Cell : [%1, %2, %3]" ).arg( i ).arg( j ).arg( k );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RimEclipseResultDefinition;
|
||||
|
||||
class RigTimeHistoryResultAccessor
|
||||
{
|
||||
public:
|
||||
static QString geometrySelectionText( RigEclipseCaseData* eclipseCaseData, size_t m_gridIndex, size_t m_cellIndex );
|
||||
static std::vector<double> timeHistoryValues( RigEclipseCaseData* eclipseCaseData,
|
||||
RimEclipseResultDefinition* resultDefinition,
|
||||
size_t gridIndex,
|
||||
size_t cellIndex,
|
||||
size_t timeStepCount );
|
||||
};
|
||||
Reference in New Issue
Block a user