mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added data access objects for native results
This commit is contained in:
parent
fa7e505262
commit
cb8edaffde
@ -12,6 +12,8 @@ ${CEE_CURRENT_LIST_DIR}RigGridBase.h
|
||||
${CEE_CURRENT_LIST_DIR}RigGridManager.h
|
||||
${CEE_CURRENT_LIST_DIR}RigResultAccessObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RigResultAccessObjectFactory.h
|
||||
${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
|
||||
${CEE_CURRENT_LIST_DIR}RigMainGrid.h
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.h
|
||||
@ -33,6 +35,8 @@ ${CEE_CURRENT_LIST_DIR}RigGridBase.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigGridManager.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigResultAccessObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigResultAccessObjectFactory.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigMainGrid.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.cpp
|
||||
|
@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, 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 "RigActiveCellsResultAccessObject.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
RigActiveCellsResultAccessObject::RigActiveCellsResultAccessObject(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo, const QString& resultName)
|
||||
: m_grid(grid),
|
||||
m_reservoirResultValues(reservoirResultValues),
|
||||
m_activeCellInfo(activeCellInfo),
|
||||
m_resultName(resultName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessObject::cellScalar(size_t localCellIndex) const
|
||||
{
|
||||
if (m_reservoirResultValues == NULL || m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
size_t globalGridCellIndex = m_grid->globalGridCellIndex(localCellIndex);
|
||||
size_t resultValueIndex = m_activeCellInfo->cellResultIndex(globalGridCellIndex);
|
||||
if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL;
|
||||
|
||||
CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size());
|
||||
|
||||
return m_reservoirResultValues->at(resultValueIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigActiveCellsResultAccessObject::cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const
|
||||
{
|
||||
return cellScalar(localCellIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigActiveCellsResultAccessObject::resultName() const
|
||||
{
|
||||
return m_resultName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellsResultAccessObject::setCellScalar(size_t localCellIndex, double scalarValue)
|
||||
{
|
||||
size_t globalGridCellIndex = m_grid->globalGridCellIndex(localCellIndex);
|
||||
size_t resultValueIndex = m_activeCellInfo->cellResultIndex(globalGridCellIndex);
|
||||
|
||||
CVF_TIGHT_ASSERT(m_reservoirResultValues != NULL && resultValueIndex < m_reservoirResultValues->size());
|
||||
|
||||
(*m_reservoirResultValues)[resultValueIndex] = scalarValue;
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, 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 "RigResultAccessObject.h"
|
||||
|
||||
class RigGridBase;
|
||||
class RigActiveCellInfo;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigActiveCellsResultAccessObject : public RigResultAccessObject
|
||||
{
|
||||
public:
|
||||
RigActiveCellsResultAccessObject(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo, const QString& resultName);
|
||||
|
||||
virtual double cellScalar(size_t localCellIndex) const;
|
||||
virtual double cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
virtual QString resultName() const;
|
||||
virtual void setCellScalar(size_t localCellIndex, double scalarValue);
|
||||
|
||||
private:
|
||||
const RigActiveCellInfo* m_activeCellInfo;
|
||||
const RigGridBase* m_grid;
|
||||
std::vector<double>* m_reservoirResultValues;
|
||||
QString m_resultName;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
|
||||
class CellFaceScalarDataAccess : public Object
|
||||
{
|
||||
public:
|
||||
virtual double cellFaceScalar(size_t cellIndex, cvf::StructGridInterface faceId) const = 0;
|
||||
};
|
||||
|
||||
class PlainCellFaceScalarDataAccess : public CellFaceScalarDataAccess
|
||||
{
|
||||
public:
|
||||
PlainCellFaceScalarDataAccess()
|
||||
{
|
||||
cellEdgeDataAccessObjects.resize(6);
|
||||
}
|
||||
|
||||
void setDataAccessObjectForFace(cvf::StructGridInterface faceId, cvf::StructGridScalarDataAccess* dataAccessObject)
|
||||
{
|
||||
cellEdgeDataAccessObjects[faceId] = dataAccessObject;
|
||||
}
|
||||
|
||||
virtual double cellFaceScalar( size_t cellIndex, cvf::StructGridInterface faceId ) const
|
||||
{
|
||||
cvf::StructGridScalarDataAccess* dataAccessObj = cellEdgeDataAccessObjects[faceId];
|
||||
if (dataAccessObj != NULL)
|
||||
{
|
||||
return dataAccessObj->cellScalar(cellIndex);
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
private:
|
||||
cvf::Collection<cvf::StructGridScalarDataAccess> cellEdgeDataAccessObjects;
|
||||
};
|
||||
|
||||
*/
|
@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, 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 "RigAllGridCellsResultAccessObject.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllGridCellsResultAccessObject::RigAllGridCellsResultAccessObject(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const QString& resultName)
|
||||
: m_grid(grid),
|
||||
m_reservoirResultValues(reservoirResultValues),
|
||||
m_resultName(resultName)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessObject::cellScalar(size_t localCellIndex) const
|
||||
{
|
||||
if (m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
|
||||
|
||||
size_t globalGridCellIndex = m_grid->globalGridCellIndex(localCellIndex);
|
||||
CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size());
|
||||
|
||||
return m_reservoirResultValues->at(globalGridCellIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigAllGridCellsResultAccessObject::cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const
|
||||
{
|
||||
return cellScalar(localCellIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigAllGridCellsResultAccessObject::resultName() const
|
||||
{
|
||||
return m_resultName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAllGridCellsResultAccessObject::setCellScalar(size_t localCellIndex, double scalarValue)
|
||||
{
|
||||
size_t globalGridCellIndex = m_grid->globalGridCellIndex(localCellIndex);
|
||||
CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size());
|
||||
|
||||
(*m_reservoirResultValues)[globalGridCellIndex] = scalarValue;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, 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 "RigActiveCellsResultAccessObject.h"
|
||||
|
||||
class RigGridBase;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigAllGridCellsResultAccessObject : public RigResultAccessObject
|
||||
{
|
||||
public:
|
||||
RigAllGridCellsResultAccessObject(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const QString& resultName);
|
||||
|
||||
virtual double cellScalar(size_t localCellIndex) const;
|
||||
virtual double cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
virtual QString resultName() const;
|
||||
virtual void setCellScalar(size_t localCellIndex, double scalarValue);
|
||||
|
||||
private:
|
||||
const RigGridBase* m_grid;
|
||||
std::vector<double>* m_reservoirResultValues;
|
||||
QString m_resultName;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
|
||||
class CellFaceScalarDataAccess : public Object
|
||||
{
|
||||
public:
|
||||
virtual double cellFaceScalar(size_t cellIndex, cvf::StructGridInterface faceId) const = 0;
|
||||
};
|
||||
|
||||
class PlainCellFaceScalarDataAccess : public CellFaceScalarDataAccess
|
||||
{
|
||||
public:
|
||||
PlainCellFaceScalarDataAccess()
|
||||
{
|
||||
cellEdgeDataAccessObjects.resize(6);
|
||||
}
|
||||
|
||||
void setDataAccessObjectForFace(cvf::StructGridInterface faceId, cvf::StructGridScalarDataAccess* dataAccessObject)
|
||||
{
|
||||
cellEdgeDataAccessObjects[faceId] = dataAccessObject;
|
||||
}
|
||||
|
||||
virtual double cellFaceScalar( size_t cellIndex, cvf::StructGridInterface faceId ) const
|
||||
{
|
||||
cvf::StructGridScalarDataAccess* dataAccessObj = cellEdgeDataAccessObjects[faceId];
|
||||
if (dataAccessObj != NULL)
|
||||
{
|
||||
return dataAccessObj->cellScalar(cellIndex);
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
private:
|
||||
cvf::Collection<cvf::StructGridScalarDataAccess> cellEdgeDataAccessObjects;
|
||||
};
|
||||
|
||||
*/
|
@ -25,6 +25,9 @@
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigResultAccessObject : public cvf::Object
|
||||
{
|
||||
public:
|
||||
@ -33,7 +36,7 @@ public:
|
||||
|
||||
virtual QString resultName() const = 0;
|
||||
|
||||
virtual void setCellScalar(size_t cellIndex, double value) = 0;
|
||||
virtual void setCellScalar(size_t localCellIndex, double scalarValue) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) Statoil ASA, 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) Statoil ASA, 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
|
||||
|
Loading…
Reference in New Issue
Block a user