Merged in changes from maintenace branch

This commit is contained in:
Magne Sjaastad 2016-08-12 14:53:04 +02:00
commit cea77a4299
5 changed files with 55 additions and 65 deletions

View File

@ -1567,10 +1567,10 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts, QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts,
const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, const RigActiveCellInfo* matrixActiveCellInfo, const RigActiveCellInfo* fractureActiveCellInfo,
PorosityModelResultType porosityModel, size_t timeStepCount) const PorosityModelResultType porosityModel, size_t timeStepCount) const
{ {
CVF_ASSERT(activeCellInfo); CVF_ASSERT(matrixActiveCellInfo);
if (keywords.size() != static_cast<int>(keywordDataItemCounts.size())) if (keywords.size() != static_cast<int>(keywordDataItemCounts.size()))
{ {
@ -1590,51 +1590,55 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
for (int i = 0; i < keywords.size(); i++) for (int i = 0; i < keywords.size(); i++)
{ {
QString keyword = keywords[i]; QString keyword = keywords[i];
size_t keywordDataItemCount = keywordDataItemCounts[i];
if (activeCellInfo->reservoirActiveCellCount() > 0) bool validKeyword = false;
size_t timeStepsAllCellsRest = keywordDataItemCount % matrixActiveCellInfo->reservoirCellCount();
if (timeStepsAllCellsRest == 0 && keywordDataItemCount <= timeStepCount * matrixActiveCellInfo->reservoirCellCount())
{ {
if (keywordDataItemCounts[i] < activeCellInfo->reservoirActiveCellCount()) continue; // Found result for all cells for N time steps, usually a static dataset for one time step
validKeyword = true;
}
else
{
size_t timeStepsMatrixRest = keywordDataItemCount % matrixActiveCellInfo->reservoirActiveCellCount();
size_t timeStepsAllCellsRest = keywordDataItemCounts[i] % activeCellInfo->reservoirCellCount(); size_t timeStepsFractureRest = 0;
size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->reservoirActiveCellCount(); if (fractureActiveCellInfo->reservoirActiveCellCount() > 0)
size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount());
if (timeStepsAllCellsRest == 0)
{ {
if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirCellCount()) timeStepsFractureRest = keywordDataItemCount % fractureActiveCellInfo->reservoirActiveCellCount();
{
continue;
}
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
else if (porosityModel == RifReaderInterface::MATRIX_RESULTS && timeStepsMatrixRest == 0)
{
if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirActiveCellCount())
{
continue;
}
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]); size_t sumFractureMatrixActiveCellCount = matrixActiveCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount();
size_t timeStepsMatrixAndFractureRest = keywordDataItemCount % sumFractureMatrixActiveCellCount;
if (porosityModel == RifReaderInterface::MATRIX_RESULTS && timeStepsMatrixRest == 0)
{
if (keywordDataItemCount <= timeStepCount * std::max(matrixActiveCellInfo->reservoirActiveCellCount(), sumFractureMatrixActiveCellCount))
{
validKeyword = true;
}
} }
else if (porosityModel == RifReaderInterface::FRACTURE_RESULTS && timeStepsMatrixAndFractureRest == 0) else if (porosityModel == RifReaderInterface::FRACTURE_RESULTS && fractureActiveCellInfo->reservoirActiveCellCount() > 0 && timeStepsFractureRest == 0)
{ {
if (keywordDataItemCounts[i] > timeStepCount * (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount())) if (keywordDataItemCount <= timeStepCount * std::max(fractureActiveCellInfo->reservoirActiveCellCount(), sumFractureMatrixActiveCellCount))
{ {
continue; validKeyword = true;
}
}
else if (timeStepsMatrixAndFractureRest == 0)
{
if (keywordDataItemCount <= timeStepCount * sumFractureMatrixActiveCellCount)
{
validKeyword = true;
} }
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
} }
else
{
if (keywordDataItemCounts[i] > activeCellInfo->reservoirCellCount())
{
continue;
}
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]); if (validKeyword)
{
keywordsWithCorrectNumberOfDataItems.push_back(keyword);
} }
} }
@ -1647,8 +1651,9 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* destinationResultValues, const std::vector<double>& sourceResultValues) void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* destinationResultValues, const std::vector<double>& sourceResultValues)
{ {
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS); if (sourceResultValues.size() == 0) return;
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS && fracActCellInfo->reservoirActiveCellCount() == 0) if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS && fracActCellInfo->reservoirActiveCellCount() == 0)
{ {

View File

@ -251,16 +251,13 @@ void RivCrossSectionPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray*
textureCoords->resize(numVertices); textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr(); cvf::Vec2f* rawPtr = textureCoords->ptr();
double cellScalarValue;
cvf::Vec2f texCoord;
int triangleCount = static_cast<int>(triangleToCellIdxMap.size()); int triangleCount = static_cast<int>(triangleToCellIdxMap.size());
#pragma omp parallel for private(texCoord, cellScalarValue) #pragma omp parallel for
for (int tIdx = 0; tIdx < triangleCount; tIdx++) for (int tIdx = 0; tIdx < triangleCount; tIdx++)
{ {
cellScalarValue = resultAccessor->cellScalarGlobIdx(triangleToCellIdxMap[tIdx]); double cellScalarValue = resultAccessor->cellScalarGlobIdx(triangleToCellIdxMap[tIdx]);
texCoord = mapper->mapToTextureCoord(cellScalarValue); cvf::Vec2f texCoord = mapper->mapToTextureCoord(cellScalarValue);
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
{ {
texCoord[1] = 1.0f; texCoord[1] = 1.0f;

View File

@ -159,14 +159,11 @@ void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
return; return;
} }
double cellScalarValue; #pragma omp parallel for
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, cellScalarValue)
for (int tIdx = 0; tIdx < static_cast<int>(m_triangleIndexToNNCIndex->size()); tIdx++) for (int tIdx = 0; tIdx < static_cast<int>(m_triangleIndexToNNCIndex->size()); tIdx++)
{ {
cellScalarValue = (*nncResultVals)[(*m_triangleIndexToNNCIndex)[tIdx]]; double cellScalarValue = (*nncResultVals)[(*m_triangleIndexToNNCIndex)[tIdx]];
texCoord = mapper->mapToTextureCoord(cellScalarValue); cvf::Vec2f texCoord = mapper->mapToTextureCoord(cellScalarValue);
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
{ {
texCoord[1] = 1.0f; texCoord[1] = 1.0f;

View File

@ -138,17 +138,14 @@ void RivTernaryTextureCoordsCreator::createTextureCoords(
quadTextureCoords->resize(numVertices); quadTextureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = quadTextureCoords->ptr(); cvf::Vec2f* rawPtr = quadTextureCoords->ptr();
cvf::Vec2d resultValue; #pragma omp parallel for
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, resultValue)
for (int i = 0; i < static_cast<int>(quadMapper->quadCount()); i++) for (int i = 0; i < static_cast<int>(quadMapper->quadCount()); i++)
{ {
cvf::StructGridInterface::FaceType faceId = quadMapper->cellFace(i); cvf::StructGridInterface::FaceType faceId = quadMapper->cellFace(i);
size_t cellIdx = quadMapper->cellIndex(i); size_t cellIdx = quadMapper->cellIndex(i);
resultValue = resultAccessor->cellFaceScalar(cellIdx, faceId); cvf::Vec2d resultValue = resultAccessor->cellFaceScalar(cellIdx, faceId);
texCoord = texMapper->getTexCoord(resultValue.x(), resultValue.y(), cellIdx); cvf::Vec2f texCoord = texMapper->getTexCoord(resultValue.x(), resultValue.y(), cellIdx);
size_t j; size_t j;
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
@ -169,16 +166,13 @@ void RivTernaryTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* textur
textureCoords->resize(numVertices); textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr(); cvf::Vec2f* rawPtr = textureCoords->ptr();
cvf::Vec2d resultValue; #pragma omp parallel for
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, resultValue)
for (int i = 0; i < static_cast<int>(triangleToCellIdx.size()); i++) for (int i = 0; i < static_cast<int>(triangleToCellIdx.size()); i++)
{ {
size_t cellIdx = triangleToCellIdx[i]; size_t cellIdx = triangleToCellIdx[i];
resultValue = resultAccessor->cellScalarGlobIdx(cellIdx); cvf::Vec2d resultValue = resultAccessor->cellScalarGlobIdx(cellIdx);
texCoord = texMapper->getTexCoord(resultValue.x(), resultValue.y(), cellIdx); cvf::Vec2f texCoord = texMapper->getTexCoord(resultValue.x(), resultValue.y(), cellIdx);
size_t j; size_t j;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)

View File

@ -91,17 +91,14 @@ void RivTextureCoordsCreator::createTextureCoords(
quadTextureCoords->resize(numVertices); quadTextureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = quadTextureCoords->ptr(); cvf::Vec2f* rawPtr = quadTextureCoords->ptr();
double resultValue; #pragma omp parallel for
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, resultValue)
for (int i = 0; i < static_cast<int>(quadMapper->quadCount()); i++) for (int i = 0; i < static_cast<int>(quadMapper->quadCount()); i++)
{ {
cvf::StructGridInterface::FaceType faceId = quadMapper->cellFace(i); cvf::StructGridInterface::FaceType faceId = quadMapper->cellFace(i);
size_t cellIdx = quadMapper->cellIndex(i); size_t cellIdx = quadMapper->cellIndex(i);
resultValue = resultAccessor->cellFaceScalar(cellIdx, faceId); double resultValue = resultAccessor->cellFaceScalar(cellIdx, faceId);
texCoord = texMapper->getTexCoord(resultValue, cellIdx); cvf::Vec2f texCoord = texMapper->getTexCoord(resultValue, cellIdx);
size_t j; size_t j;
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)