More tests and moved more functions

p4#: 20447
This commit is contained in:
Magne Sjaastad 2013-02-12 07:11:32 +01:00
parent 8fd8a31aec
commit 0bc3d9f205
4 changed files with 249 additions and 23 deletions

View File

@ -25,7 +25,20 @@ include_directories(
)
file( GLOB CPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../*.cpp )
file( GLOB UNIT_TEST_CPP_SOURCES *.cpp )
set( UNIT_TEST_CPP_SOURCES
main.cpp
RigActiveCellInfo-Test.cpp
RigReservoir-Test.cpp
)
#############################################################################
# Adds folders for Visual Studio solution explorer (and for Xcode explorer)
#############################################################################
source_group( "ResInsight" FILES ${CPP_SOURCES} )
source_group( "UnitTests" FILES ${UNIT_TEST_CPP_SOURCES} )
set( LINK_LIBRARIES

View File

@ -24,6 +24,7 @@
#include "RigReservoir.h"
/*
//--------------------------------------------------------------------------------------------------
///
@ -62,3 +63,5 @@ TEST(RigReservoirTest, BasicTest)
}
*/

View File

@ -18,3 +18,207 @@
#include "RigActiveCellInfo.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo::RigActiveCellInfo()
: m_globalMatrixModelActiveCellCount(0),
m_globalFractureModelActiveCellCount(0),
m_activeCellPositionMin(cvf::Vec3d::ZERO),
m_activeCellPositionMax(cvf::Vec3d::ZERO)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setGlobalCellCount(size_t globalCellCount)
{
m_activeInMatrixModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigActiveCellInfo::isActiveInMatrixModel(size_t globalCellIndex) const
{
if (globalCellIndex >= m_activeInMatrixModel.size()) return false;
return m_activeInMatrixModel[globalCellIndex] != cvf::UNDEFINED_SIZE_T;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::activeIndexInMatrixModel(size_t globalCellIndex) const
{
if (globalCellIndex >= m_activeInMatrixModel.size()) return cvf::UNDEFINED_SIZE_T;
return m_activeInMatrixModel[globalCellIndex];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex)
{
CVF_TIGHT_ASSERT(globalActiveCellIndex < m_activeInMatrixModel.size());
m_activeInMatrixModel[globalCellIndex] = globalActiveCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigActiveCellInfo::isActiveInFractureModel(size_t globalCellIndex) const
{
if (globalCellIndex >= m_activeInFractureModel.size()) return false;
return m_activeInFractureModel[globalCellIndex] != cvf::UNDEFINED_SIZE_T;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::activeIndexInFractureModel(size_t globalCellIndex) const
{
if (globalCellIndex >= m_activeInFractureModel.size()) return cvf::UNDEFINED_SIZE_T;
return m_activeInFractureModel[globalCellIndex];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex)
{
if (m_activeInFractureModel.size() == 0)
{
m_activeInFractureModel.resize(m_activeInMatrixModel.size(), cvf::UNDEFINED_SIZE_T);
}
CVF_TIGHT_ASSERT(globalActiveCellIndex < m_activeInFractureModel.size());
m_activeInFractureModel[globalCellIndex] = globalActiveCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setGridCount(size_t gridCount)
{
m_perGridActiveCellInfo.resize(gridCount);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount, size_t fractureActiveCellCount)
{
CVF_ASSERT(gridIndex < m_perGridActiveCellInfo.size());
m_perGridActiveCellInfo[gridIndex].setMatrixModelActiveCellCount(matrixActiveCellCount);
m_perGridActiveCellInfo[gridIndex].setFractureModelActiveCellCount(fractureActiveCellCount);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::computeDerivedData()
{
m_globalMatrixModelActiveCellCount = 0;
m_globalFractureModelActiveCellCount = 0;
for (size_t i = 0; i < m_perGridActiveCellInfo.size(); i++)
{
m_globalMatrixModelActiveCellCount += m_perGridActiveCellInfo[i].matrixModelActiveCellCount();
m_globalFractureModelActiveCellCount += m_perGridActiveCellInfo[i].fractureModelActiveCellCount();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::globalMatrixModelActiveCellCount() const
{
return m_globalMatrixModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::globalFractureModelActiveCellCount() const
{
return m_globalFractureModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setMatrixModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max)
{
m_activeCellPositionMin = min;
m_activeCellPositionMax = max;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const
{
min = m_activeCellPositionMin;
max = m_activeCellPositionMax;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setFractureModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max)
{
m_fractureModelActiveCellPositionMin = min;
m_fractureModelActiveCellPositionMax = max;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const
{
min = m_fractureModelActiveCellPositionMin;
max = m_fractureModelActiveCellPositionMax;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::GridActiveCellCounts::matrixModelActiveCellCount() const
{
return m_matrixModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::GridActiveCellCounts::setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount)
{
m_matrixModelActiveCellCount = activeMatrixModelCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigActiveCellInfo::GridActiveCellCounts::fractureModelActiveCellCount() const
{
return m_fractureModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::GridActiveCellCounts::setFractureModelActiveCellCount(size_t activeFractureModelCellCount)
{
m_fractureModelActiveCellCount = activeFractureModelCellCount;
}

View File

@ -32,27 +32,30 @@ class RigActiveCellInfo
public:
RigActiveCellInfo();
void setGlobalCellCount(size_t globalCellCount);
void setGlobalCellCount(size_t globalCellCount);
bool isActiveInMatrixModel(size_t globalCellIndex) const;
size_t activeIndexInMatrixModel(size_t globalCellIndex) const;
void setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex);
bool isActiveInMatrixModel(size_t globalCellIndex) const;
size_t activeIndexInMatrixModel(size_t globalCellIndex) const;
void setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex);
bool isActiveInFractureModel(size_t globalCellIndex) const;
size_t activeIndexInFractureModel(size_t globalCellIndex) const;
void setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex);
bool isActiveInFractureModel(size_t globalCellIndex) const;
size_t activeIndexInFractureModel(size_t globalCellIndex) const;
void setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex);
// From RigBase
void setGridCount(size_t gridCount);
void setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount, size_t fractureActiveCellCount);
void computeDerivedData();
// From RigMainGrid
size_t globalMatrixModelActiveCellCount() const;
size_t globalFractureModelActiveCellCount() const;
void setGlobalMatrixModelActiveCellCount (size_t globalMatrixModelActiveCellCount) { m_globalMatrixModelActiveCellCount = globalMatrixModelActiveCellCount; }
void setGlobalFractureModelActiveCellCount(size_t globalFractureModelActiveCellCount) { m_globalFractureModelActiveCellCount = globalFractureModelActiveCellCount;}
size_t globalMatrixModelActiveCellCount() const;
size_t globalFractureModelActiveCellCount() const;
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void setMatrixModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max);
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void setFractureModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max);
void fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
@ -60,14 +63,14 @@ private:
class GridActiveCellCounts
{
public:
size_t matrixModelActiveCellCount() const;
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount() const ;
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
size_t matrixModelActiveCellCount() const;
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount() const;
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
private:
size_t m_matrixModelActiveCellCount;
size_t m_fractureModelActiveCellCount;
size_t m_matrixModelActiveCellCount;
size_t m_fractureModelActiveCellCount;
};
@ -83,9 +86,12 @@ private:
cvf::Vec3st m_activeCellPositionMin;
cvf::Vec3st m_activeCellPositionMax;
cvf::Vec3st m_validCellPositionMin;
cvf::Vec3st m_validCellPositionMax;
cvf::Vec3st m_fractureModelActiveCellPositionMin;
cvf::Vec3st m_fractureModelActiveCellPositionMax;
cvf::BoundingBox m_activeCellsBoundingBox;
// NOT USED
// cvf::Vec3st m_validCellPositionMin;
// cvf::Vec3st m_validCellPositionMax;
// cvf::BoundingBox m_activeCellsBoundingBox;
};