Merge pull request #38 from OPM/internal

Version 0.9.20
This commit is contained in:
Magne Sjaastad 2013-08-23 04:58:06 -07:00
commit 562c46c2be
52 changed files with 521 additions and 290 deletions

View File

@ -837,42 +837,14 @@ bool RiaApplication::parseArguments()
if (showHelp)
{
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(getVersionStringApp(false));
helpText += "Copyright Statoil ASA, Ceetron AS 2011, 2012\n\n";
helpText +=
"\nParameter Description\n"
"-----------------------------------------------------------------\n"
"-last Open last used project\n"
"\n"
"-project <filename> Open project file <filename>\n"
"\n"
"-case <casename> Open Eclipse case <casename>\n"
" (do not include .GRID/.EGRID)\n"
"\n"
"-startdir The default directory for open/save commands\n"
"\n"
"-savesnapshots Save snapshot of all views to 'snapshots' folder in project file folder\n"
" Application closes after snapshots are written to file\n"
"\n"
"-regressiontest <folder> Run a regression test on all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
" " + RegTestNames::testProjectName + " files in the sub-folders will be opened and \n"
" snapshots of all the views is written to the sub-sub-folder " + RegTestNames::generatedFolderName + ". \n"
" Then difference images is generated in the sub-sub-folder " + RegTestNames::diffFolderName + " based \n"
" on the images in sub-sub-folder " + RegTestNames::baseFolderName + ".\n"
" The results are presented in " + RegTestNames::reportFileName + " that is\n"
" written in the given folder.\n"
"\n"
"-updateregressiontestbase <folder> For all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
" Copy the images in the sub-sub-folder " + RegTestNames::generatedFolderName + " to the sub-sub-folder\n"
" " + RegTestNames::baseFolderName + " after deleting " + RegTestNames::baseFolderName + " completely.\n"
"\n"
"-help, -? Displays help text\n"
"-----------------------------------------------------------------";
QString helpText = commandLineParameterHelp();
#if defined(_MSC_VER) && defined(_WIN32)
showFormattedTextInMessageBox(helpText);
#else
fprintf(stdout, "%s\n", helpText.toAscii().data());
fflush(stdout);
#endif
return false;
}
@ -1578,3 +1550,65 @@ RimProject* RiaApplication::project()
return m_project;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::showFormattedTextInMessageBox(const QString& text)
{
QString helpText = text;
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setWindowTitle("ResInsight");
helpText.replace("&", "&amp;");
helpText.replace("<", "&lt;");
helpText.replace(">", "&gt;");
helpText = QString("<pre>%1</pre>").arg(helpText);
msgBox.setText(helpText);
msgBox.exec();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaApplication::commandLineParameterHelp() const
{
QString text = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(getVersionStringApp(false));
text += "Copyright Statoil ASA, Ceetron AS 2011, 2012\n\n";
text +=
"\nParameter Description\n"
"-----------------------------------------------------------------\n"
"-last Open last used project\n"
"\n"
"-project <filename> Open project file <filename>\n"
"\n"
"-case <casename> Open Eclipse case <casename>\n"
" (do not include .GRID/.EGRID)\n"
"\n"
"-startdir The default directory for open/save commands\n"
"\n"
"-savesnapshots Save snapshot of all views to 'snapshots' folder in project file folder\n"
" Application closes after snapshots are written to file\n"
"\n"
"-regressiontest <folder> Run a regression test on all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
" " + RegTestNames::testProjectName + " files in the sub-folders will be opened and \n"
" snapshots of all the views is written to the sub-sub-folder " + RegTestNames::generatedFolderName + ". \n"
" Then difference images is generated in the sub-sub-folder " + RegTestNames::diffFolderName + " based \n"
" on the images in sub-sub-folder " + RegTestNames::baseFolderName + ".\n"
" The results are presented in " + RegTestNames::reportFileName + " that is\n"
" written in the given folder.\n"
"\n"
"-updateregressiontestbase <folder> For all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
" Copy the images in the sub-sub-folder " + RegTestNames::generatedFolderName + " to the sub-sub-folder\n"
" " + RegTestNames::baseFolderName + " after deleting " + RegTestNames::baseFolderName + " completely.\n"
"\n"
"-help, -? Displays help text\n"
"-----------------------------------------------------------------";
return text;
}

View File

@ -125,6 +125,9 @@ public:
cvf::Font* standardFont();
QString commandLineParameterHelp() const;
void showFormattedTextInMessageBox(const QString& text);
private:
void onProjectOpenedOrClosed();
void setWindowCaptionFromAppState();

View File

@ -191,7 +191,19 @@ source_group( "UserInterface" FILES ${USER_INTERFACE_FILES} )
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
add_executable(ResInsight
# Default behaviour for a Qt application is a console application, resulting in a console window always being launced at startup
# The following statement is used to control this behaviour
# set_target_properties( MY_TARGET PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
# This setting i not honored by Cmake - http://public.kitware.com/Bug/view.php?id=14326
# We use the following workaround described in the bug report
# ADD_EXECUTABLE(${TARGET_NAME} WIN32 ${SRC})
# See CMake symbol WIN32_EXECUTABLE for details
if (MSVC)
set( EXE_FILES WIN32)
endif()
set( EXE_FILES
${EXE_FILES}
${CPP_SOURCES}
${MOC_FILES_CPP}
${FORM_FILES_CPP}
@ -201,6 +213,8 @@ add_executable(ResInsight
${REFERENCED_CMAKE_FILES}
)
add_executable( ResInsight ${EXE_FILES} )
set( LINK_LIBRARIES
cafPdmCvf

View File

@ -111,8 +111,6 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
{
RigCell& cell = mainGrid->cells()[cellStartIndex + localCellIdx];
bool invalid = ecl_grid_cell_invalid1(localEclGrid, localCellIdx);
cell.setInvalid(invalid);
cell.setCellIndex(localCellIdx);
// Active cell index
@ -163,10 +161,7 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
// Mark inactive long pyramid looking cells as invalid
// Forslag
//if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
if (!invalid)
{
cell.setInvalid(cell.isLongPyramidCell());
}
cell.setInvalid(cell.isLongPyramidCell());
#pragma omp atomic
computedCellCount++;
@ -602,6 +597,9 @@ void RifReaderEclipseOutput::buildMetaData()
staticDate.push_back(m_timeSteps.front());
}
// Add ACTNUM
matrixResultNames += "ACTNUM";
for (int i = 0; i < matrixResultNames.size(); ++i)
{
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false);
@ -621,6 +619,9 @@ void RifReaderEclipseOutput::buildMetaData()
staticDate.push_back(m_timeSteps.front());
}
// Add ACTNUM
fractureResultNames += "ACTNUM";
for (int i = 0; i < fractureResultNames.size(); ++i)
{
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false);
@ -665,6 +666,14 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe
{
CVF_ASSERT(values);
if (result.compare("ACTNUM", Qt::CaseInsensitive) == 0)
{
RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(matrixOrFracture);
values->resize(activeCellInfo->globalActiveCellCount(), 1.0);
return true;
}
openInitFile();
if(m_ecl_init_file)

View File

@ -98,7 +98,7 @@ void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if (!m_reservoirView->wellCollection()->active() ) return;
if (!m_reservoirView->wellCollection()->isActive()) return;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF) return;

View File

@ -396,14 +396,14 @@ void RivReservoirViewPartMgr::createPropertyFilteredGeometry(size_t frameIndex)
std::vector<RigGridBase*> grids;
res->allGrids(&grids);
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
{
cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx);
cvf::ref<cvf::UByteArray> rangeVisibility;
cvf::ref<cvf::UByteArray> fenceVisibility;
cvf::cref<cvf::UByteArray> cellIsWellCellStatuses = res->wellCellsInGrid(gIdx);
cvf::cref<cvf::UByteArray> isWellCell = res->wellCellsInGrid(gIdx);
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
@ -416,7 +416,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredGeometry(size_t frameIndex)
#pragma omp parallel for
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
{
(*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && !(*cellIsWellCellStatuses)[cellIdx]) || (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
(*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
}
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
@ -551,10 +551,11 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
CVF_ASSERT(grid != NULL);
CVF_ASSERT(nativeVisibility->size() == grid->cellCount());
if (rangeFilterColl->hasActiveFilters())
{
if (cellVisibility != nativeVisibility) (*cellVisibility) = (*nativeVisibility);
// Initialize range filter with native visibility
if (cellVisibility != nativeVisibility) (*cellVisibility) = (*nativeVisibility);
if (rangeFilterColl->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells())
{
// Build range filter for current grid
cvf::CellRangeFilter gridCellRangeFilter;
rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid);
@ -579,6 +580,8 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
parentGridVisibilities = reservoirGridPartMgr->cellVisibility(parentGridIndex);
}
bool hasAdditiveRangeFilters = rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
#pragma omp parallel for
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
{
@ -599,16 +602,24 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
bool isInSubGridArea = cell.subGrid() != NULL;
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea))
bool nativeRangeVisibility = false;
if (hasAdditiveRangeFilters)
{
nativeRangeVisibility = gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
}
else
{
// Special handling when no include filters are present. Use native visibility
nativeRangeVisibility = (*nativeVisibility)[cellIndex];
}
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || nativeRangeVisibility)
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
}
}
}
else
{
cellVisibility->resize(grid->cellCount());
cellVisibility->setAll(false);
}
}
//--------------------------------------------------------------------------------------------------
@ -632,7 +643,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator pfIt;
for (pfIt = propFilterColl->propertyFilters().begin(); pfIt != propFilterColl->propertyFilters().end(); ++pfIt)
{
if ((*pfIt)->active()&& (*pfIt)->resultDefinition->hasResult())
if ((*pfIt)->isActive()&& (*pfIt)->resultDefinition->hasResult())
{
const double lowerBound = (*pfIt)->lowerBound();
const double upperBound = (*pfIt)->upperBound();

View File

@ -108,8 +108,47 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
whStartPos -= rigReservoir->mainGrid()->displayModelOffset();
whStartPos.transformPoint(m_scaleTransform->worldTransform());
cvf::Vec3d whEndPos = whStartPos;
whEndPos.z() += characteristicCellSize * m_rimReservoirView->wellCollection()->wellHeadScaleFactor();
// Compute well head based on the z position of the top of the K column the well head is part of
cvf::Vec3d whEndPos = whStartPos;
if (m_rimReservoirView->wellCollection()->wellHeadPosition() == RimWellCollection::WELLHEAD_POS_TOP_COLUMN)
{
// Position well head at top active cell of IJ-column
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while(k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex))
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
topCellPos -= rigReservoir->mainGrid()->displayModelOffset();
topCellPos.transformPoint(m_scaleTransform->worldTransform());
// Modify position if top active cell is closer to sea than well head
if (kIndexWellHeadCell > k)
{
whEndPos.z() = topCellPos.z() + characteristicCellSize;
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
activeCellsBoundingBoxMax -= rigReservoir->mainGrid()->displayModelOffset();
activeCellsBoundingBoxMax.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = activeCellsBoundingBoxMax.z();
}
cvf::Vec3d arrowPosition = whEndPos;
arrowPosition.z() += 2.0;

View File

@ -45,8 +45,8 @@ RimCellFilter::RimCellFilter()
CAF_PDM_InitObject("Cell Filter", "", "", "");
CAF_PDM_InitField(&name, "UserDescription", QString("Filter Name"), "Name", "", "", "");
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
active.setUiHidden(true);
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
}
@ -96,7 +96,7 @@ void RimCellFilter::updateIconState()
painter.drawPixmap(0,0, sign);
}
if (!active)
if (!isActive)
{
QIcon temp(icPixmap);
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
@ -111,5 +111,5 @@ void RimCellFilter::updateIconState()
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCellFilter::objectToggleField()
{
return &active;
return &isActive;
}

View File

@ -42,7 +42,7 @@ public:
virtual ~RimCellFilter();
caf::PdmField<QString> name;
caf::PdmField<bool> active;
caf::PdmField<bool> isActive;
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
void updateIconState();

View File

@ -109,7 +109,7 @@ void RimCellPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
if ( &lowerBound == changedField
|| &upperBound == changedField
|| &evaluationRegion == changedField
|| &active == changedField
|| &isActive == changedField
|| &filterMode == changedField)
{
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
@ -148,27 +148,10 @@ void RimCellPropertyFilter::setDefaultValues()
{
CVF_ASSERT(m_parentContainer);
double min = 0.0;
double max = 0.0;
computeResultValueRange();
size_t scalarIndex = resultDefinition->gridScalarIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
{
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
if (results)
{
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
}
}
lowerBound = min;
lowerBound.setUiName(QString("Min (%1)").arg(min));
upperBound = max;
upperBound.setUiName(QString("Max (%1)").arg(max));
m_maximumResultValue = max;
m_minimumResultValue = min;
lowerBound = m_minimumResultValue;
upperBound = m_maximumResultValue;
}
//--------------------------------------------------------------------------------------------------
@ -186,7 +169,7 @@ void RimCellPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
group1->add(&(resultDefinition->m_resultVariableUiField));
// Fields declared in RimCellFilter
uiOrdering.add(&active);
uiOrdering.add(&isActive);
uiOrdering.add(&filterMode);
// Fields declared in this class (RimCellPropertyFilter)
@ -218,3 +201,30 @@ void RimCellPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* fie
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCellPropertyFilter::computeResultValueRange()
{
CVF_ASSERT(m_parentContainer);
double min = 0.0;
double max = 0.0;
size_t scalarIndex = resultDefinition->gridScalarIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
{
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
if (results)
{
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
}
}
m_maximumResultValue = max;
m_minimumResultValue = min;
lowerBound.setUiName(QString("Min (%1)").arg(min));
upperBound.setUiName(QString("Max (%1)").arg(max));
}

View File

@ -60,6 +60,7 @@ public:
void setParentContainer(RimCellPropertyFilterCollection* parentContainer);
RimCellPropertyFilterCollection* parentContainer();
void setDefaultValues();
void computeResultValueRange();
caf::PdmField<RimResultDefinition*> resultDefinition;

View File

@ -128,6 +128,7 @@ void RimCellPropertyFilterCollection::loadAndInitializePropertyFilters()
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
propertyFilter->resultDefinition->loadResult();
propertyFilter->updateIconState();
propertyFilter->computeResultValueRange();
}
}
@ -157,7 +158,7 @@ bool RimCellPropertyFilterCollection::hasActiveFilters() const
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
{
if ((*it)->active() && (*it)->resultDefinition->hasResult()) return true;
if ((*it)->isActive() && (*it)->resultDefinition->hasResult()) return true;
}
return false;
@ -173,7 +174,7 @@ bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
{
if ((*it)->active() && (*it)->resultDefinition->hasDynamicResult()) return true;
if ((*it)->isActive() && (*it)->resultDefinition->hasDynamicResult()) return true;
}
return false;

View File

@ -80,7 +80,7 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
{
RimCellRangeFilter* rangeFilter = *it;
if (rangeFilter && rangeFilter->active() && static_cast<size_t>(rangeFilter->gridIndex()) == grid->gridIndex())
if (rangeFilter && rangeFilter->isActive() && static_cast<size_t>(rangeFilter->gridIndex()) == grid->gridIndex())
{
if (rangeFilter->filterMode == RimCellFilter::INCLUDE)
{
@ -214,7 +214,7 @@ bool RimCellRangeFilterCollection::hasActiveFilters() const
std::list< caf::PdmPointer< RimCellRangeFilter > >::const_iterator it;
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); ++it)
{
if ((*it)->active()) return true;
if ((*it)->isActive()) return true;
}
return false;
@ -228,3 +228,20 @@ caf::PdmFieldHandle* RimCellRangeFilterCollection::objectToggleField()
return &active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimCellRangeFilterCollection::hasActiveIncludeFilters() const
{
if (!active) return false;
std::list< caf::PdmPointer< RimCellRangeFilter > >::const_iterator it;
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); ++it)
{
if ((*it)->isActive() && (*it)->filterMode() == RimCellFilter::INCLUDE) return true;
}
return false;
}

View File

@ -44,6 +44,7 @@ public:
void compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter, const RigGridBase* grid) const;
bool hasActiveFilters() const;
bool hasActiveIncludeFilters() const;
void setReservoirView(RimReservoirView* reservoirView);
RimReservoirView* reservoirView();

View File

@ -435,6 +435,9 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
}
else if ( changedField == &showInactiveCells )
{
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE);
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
createDisplayModelAndRedraw();
}
else if ( changedField == &showMainGrid )
@ -557,7 +560,7 @@ void RimReservoirView::createDisplayModel()
if (! this->propertyFilterCollection()->hasActiveFilters())
{
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometryTypesToAdd;
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
{
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
@ -579,7 +582,7 @@ void RimReservoirView::createDisplayModel()
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE);
}
}
size_t frameIdx;
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
{
@ -675,6 +678,22 @@ void RimReservoirView::updateCurrentTimeStep()
float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
m_reservoirGridPartManager->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
if (this->showInactiveCells())
{
std::vector<size_t> gridIndices;
this->indicesToVisibleGrids(&gridIndices);
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices);
}
else
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::INACTIVE, gridIndices);
}
}
if (m_viewer)
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);

View File

@ -49,6 +49,7 @@ RimResultSlot::RimResultSlot()
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", "");
m_legendConfigData.setUiHidden(true);
m_legendConfigData.setUiChildrenHidden(true);
legendConfig = new RimLegendConfig();
}
@ -66,11 +67,14 @@ RimResultSlot::~RimResultSlot()
//--------------------------------------------------------------------------------------------------
void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_resultVariable)
RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue);
// Update of legend config must happen after RimResultDefinition::fieldChangedByUi(), as this function modifies this->resultVariable()
if (changedField == &m_resultVariableUiField)
{
if (oldValue != newValue)
{
changeLegendConfig(this->resultVariable());
changeLegendConfig(this->resultVariable());
}
if (newValue != RimDefines::undefinedResultName())
@ -79,8 +83,6 @@ void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co
}
}
RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue);
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
}

View File

@ -142,7 +142,7 @@ bool RimUiTreeModelPdm::deletePropertyFilter(const QModelIndex& itemIndex)
RimCellPropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
CVF_ASSERT(propertyFilterCollection);
bool wasFilterActive = propertyFilter->active();
bool wasFilterActive = propertyFilter->isActive();
bool wasSomeFilterActive = propertyFilterCollection->hasActiveFilters();
// Remove Ui items pointing at the pdm object to delete
@ -182,7 +182,7 @@ bool RimUiTreeModelPdm::deleteRangeFilter(const QModelIndex& itemIndex)
RimCellRangeFilterCollection* rangeFilterCollection = rangeFilter->parentContainer();
CVF_ASSERT(rangeFilterCollection);
bool wasFilterActive = rangeFilter->active();
bool wasFilterActive = rangeFilter->isActive();
bool wasSomeFilterActive = rangeFilterCollection->hasActiveFilters();
// Remove Ui items pointing at the pdm object to delete

View File

@ -148,12 +148,18 @@ bool RimWell::calculateWellPipeVisibility(size_t frameIndex)
if (m_reservoirView == NULL) return false;
if (this->wellResults() == NULL) return false;
if ( this->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T
|| frameIndex < this->wellResults()->firstResultTimeStep()
|| frameIndex >= this->wellResults()->m_wellCellsTimeSteps.size())
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
{
return false;
}
if (!m_reservoirView->wellCollection()->active())
size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex];
if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T)
{
return false;
}
if (!m_reservoirView->wellCollection()->isActive())
return false;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_ON)

View File

@ -66,6 +66,16 @@ namespace caf
}
}
namespace caf
{
template<>
void RimWellCollection::WellHeadPositionEnum::setUp()
{
addItem(RimWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "Top of active cells BB");
addItem(RimWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column");
setDefault(RimWellCollection::WELLHEAD_POS_TOP_COLUMN);
}
}
CAF_PDM_SOURCE_INIT(RimWellCollection, "Wells");
@ -76,12 +86,13 @@ RimWellCollection::RimWellCollection()
{
CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
active.setUiHidden(true);
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.setUiHidden(true);
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", "");
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", "");
@ -130,6 +141,7 @@ RimWell* RimWellCollection::findWell(QString name)
//--------------------------------------------------------------------------------------------------
bool RimWellCollection::hasVisibleWellCells()
{
if (!this->isActive()) return false;
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_NONE) return false;
if (this->wells().size() == 0 ) return false;
@ -164,7 +176,7 @@ bool RimWellCollection::hasVisibleWellCells()
//--------------------------------------------------------------------------------------------------
bool RimWellCollection::hasVisibleWellPipes()
{
if (!this->active()) return false;
if (!this->isActive()) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false;
if (this->wells().size() == 0 ) return false;
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true;
@ -178,12 +190,13 @@ bool RimWellCollection::hasVisibleWellPipes()
//--------------------------------------------------------------------------------------------------
void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&showWellLabel == changedField || &active == changedField)
if (&showWellLabel == changedField || &isActive == changedField)
{
this->updateUiIconFromState(active);
this->updateUiIconFromState(isActive);
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
m_reservoirView->createDisplayModelAndRedraw();
}
}
@ -229,7 +242,8 @@ void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|| &pipeRadiusScaleFactor == changedField
|| &wellHeadScaleFactor == changedField
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField)
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField)
{
if (m_reservoirView)
{
@ -276,7 +290,7 @@ void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellCollection::objectToggleField()
{
return &active;
return &isActive;
}

View File

@ -67,8 +67,16 @@ public:
};
typedef caf::AppEnum<RimWellCollection::WellFenceType> WellFenceEnum;
enum WellHeadPositionType
{
WELLHEAD_POS_ACTIVE_CELLS_BB,
WELLHEAD_POS_TOP_COLUMN
};
typedef caf::AppEnum<RimWellCollection::WellHeadPositionType> WellHeadPositionEnum;
caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> active;
caf::PdmField<bool> isActive;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences;
@ -81,6 +89,7 @@ public:
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<bool> showWellHead;
caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
caf::PdmField<bool> isAutoDetectingBranches;

View File

@ -249,14 +249,34 @@ void RimWellPathAsciiFileReader::readAllWellData(QString filePath)
size_t quoteStartIdx = line.find_first_of("'`´");
size_t quoteEndIdx = line.find_last_of("'`´");
std::string wellName;
if (quoteStartIdx < line.size() -1 )
{
// Extract the text between the quotes
wellName = line.substr(quoteStartIdx + 1, quoteEndIdx - 1 - quoteStartIdx);
}
else if (quoteStartIdx > line.length() && quoteEndIdx > line.length())
{
// Did not find any quotes
// Look for keyword Name
std::string lineLowerCase = line;
transform(lineLowerCase.begin(), lineLowerCase.end(), lineLowerCase.begin(), ::tolower );
std::string token = "name ";
size_t firstNameIdx = lineLowerCase.find_first_of(token);
if (firstNameIdx < lineLowerCase.length())
{
wellName = line.substr(firstNameIdx + token.length());
}
}
if (wellName.size() > 0)
{
// Create a new Well data
fileWellDataArray.push_back(WellData());
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();
// Extract the text between the quotes
std::string wellName = line.substr(quoteStartIdx + 1, quoteEndIdx - 1 - quoteStartIdx);
fileWellDataArray.back().m_name = wellName.c_str();
}
}

View File

@ -21,32 +21,6 @@
#include "RiuMainWindow.h"
// Cmake is able to control subsystem on Windows using the following method http://www.cmake.org/Wiki/VSConfigSpecificSettings
//
// if(WIN32)
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
// set_target_properties(WindowApplicationExample PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
// set_target_properties(WindowApplicationExample PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
// endif(WIN32)
//
//
// Due to a bug in Cmake, use workaround described here http://public.kitware.com/Bug/view.php?id=12566
#if defined(_MSC_VER) && defined(_WIN32)
#ifdef _DEBUG
#pragma comment(linker, "/SUBSYSTEM:CONSOLE")
#else
#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
#endif // _DEBUG
#endif // defined(_MSC_VER) && defined(_WIN32)
int main(int argc, char *argv[])
{
RiaApplication app(argc, argv);

View File

@ -224,31 +224,22 @@ public:
}
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
std::vector< std::vector<double> >* scalarResultFrames = NULL;
if (gridIdx < 0 || rimCase->reservoirData()->gridCount() <= (size_t)gridIdx)
{
server->errorMessageDialog()->showMessage("ResInsight SocketServer: riGetGridProperty : \n"
"The gridIndex \"" + QString::number(gridIdx) + "\" does not point to an existing grid." );
}
else
{
// Find the requested data
if (rimCase && rimCase->results(porosityModelEnum))
{
scalarResultIndex = rimCase->results(porosityModelEnum)->findOrLoadScalarResult(propertyName);
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellResults()->cellScalarResults(scalarResultIndex));
}
}
}
if (scalarResultFrames == NULL)
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the %1 model property named: \"%2\"").arg(porosityModelName).arg(propertyName));
@ -257,6 +248,7 @@ public:
return true;
}
// Create a list of all the requested time steps
std::vector<size_t> requestedTimesteps;
@ -264,7 +256,7 @@ public:
if (args.size() <= 5)
{
// Select all
for (size_t tsIdx = 0; tsIdx < scalarResultFrames->size(); ++tsIdx)
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModelEnum)->cellResults()->timeStepCount(scalarResultIndex); ++tsIdx)
{
requestedTimesteps.push_back(tsIdx);
}
@ -297,7 +289,6 @@ public:
RigGridBase* rigGrid = rimCase->reservoirData()->grid(gridIdx);
const RigActiveCellInfo* activeInfo = rimCase->reservoirData()->activeCellInfo(porosityModelEnum);
quint64 cellCountI = (quint64)rigGrid->cellCountI();
quint64 cellCountJ = (quint64)rigGrid->cellCountJ();
@ -318,27 +309,20 @@ public:
for (size_t tsIdx = 0; tsIdx < timestepCount; tsIdx++)
{
for (size_t k = 0; k < cellCountK; k++)
cvf::ref<cvf::StructGridScalarDataAccess> cellCenterDataAccessObject = rimCase->reservoirData()->dataAccessObject(rigGrid, porosityModelEnum, requestedTimesteps[tsIdx], scalarResultIndex);
if (cellCenterDataAccessObject.isNull())
{
for (size_t j = 0; j < cellCountJ; j++)
continue;
}
for (size_t cellIdx = 0; static_cast<size_t>(cellIdx) < rigGrid->cellCount(); cellIdx++)
{
double cellValue = cellCenterDataAccessObject->cellScalar(cellIdx);
if (cellValue == HUGE_VAL)
{
for (size_t i = 0; i < cellCountI; i++)
{
size_t localCellIndex = rigGrid->cellIndexFromIJK(i,j,k);
size_t gcIdx = rigGrid->globalGridCellIndex(localCellIndex);
size_t resultIdx = activeInfo->cellResultIndex(gcIdx);
if (resultIdx < scalarResultFrames->at(requestedTimesteps[tsIdx]).size())
{
values[valueIdx++] = scalarResultFrames->at(requestedTimesteps[tsIdx])[resultIdx];
}
else
{
values[valueIdx++] = HUGE_VAL;
}
}
cellValue = 0.0;
}
values[cellIdx] = cellValue;
}
}
@ -887,16 +871,28 @@ public:
size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double);
RigActiveCellInfo* activeCellInfo = m_currentReservoir->reservoirData()->activeCellInfo(m_porosityModelEnum);
size_t globalCellResultCount = activeCellInfo->globalCellResultCount();
if (cellCountFromOctave != grid->cellCount())
{
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") +
RiaSocketServer::tr("Mismatch between expected and received data. Expected : %1, Received : %2").arg(grid->cellCount()).arg(cellCountFromOctave));
// Make sure the size of the retreiving container is correct.
// If it is, this is noops
m_invalidDataDetected = true;
currentClient->abort();
return true;
}
for (size_t tIdx = 0; tIdx < m_timeStepCountToRead; ++tIdx)
{
size_t tsId = m_requestedTimesteps[tIdx];
m_scalarResultsToAdd->at(tsId).resize(globalCellResultCount, HUGE_VAL);
// Result data is stored in an array containing all cells for all grids
// The size of this array must match the test in RigCaseCellResultsData::isUsingGlobalActiveIndex(),
// as it is used to determine if we have data for active cells or all cells
// See RigCaseCellResultsData::isUsingGlobalActiveIndex()
size_t totalNumberOfCellsIncludingLgrCells = grid->mainGrid()->cells().size();
m_scalarResultsToAdd->at(tsId).resize(totalNumberOfCellsIncludingLgrCells, HUGE_VAL);
}
if ((currentClient->bytesAvailable() >= (int)m_bytesPerTimeStepToRead) && (m_currentTimeStepNumberToRead < m_timeStepCountToRead))
@ -908,24 +904,12 @@ public:
qint64 bytesRead = currentClient->read((char*)(doubleValues.data()), m_bytesPerTimeStepToRead);
size_t doubleValueIndex = 0;
for (size_t k = 0; k < grid->cellCountK(); k++)
cvf::ref<cvf::StructGridScalarDataAccess> cellCenterDataAccessObject = m_currentReservoir->reservoirData()->dataAccessObject(grid, m_porosityModelEnum, m_currentTimeStepNumberToRead, m_currentScalarIndex);
if (!cellCenterDataAccessObject.isNull())
{
for (size_t j = 0; j < grid->cellCountJ(); j++)
for (size_t cellIdx = 0; static_cast<size_t>(cellIdx) < cellCountFromOctave; cellIdx++)
{
for (size_t i = 0; i < grid->cellCountI(); i++)
{
size_t localCellIndex = grid->cellIndexFromIJK(i,j,k);
size_t gcIdx = grid->globalGridCellIndex(localCellIndex);
size_t resultIdx = activeCellInfo->cellResultIndex(gcIdx);
if (resultIdx < m_scalarResultsToAdd->at(m_requestedTimesteps[m_currentTimeStepNumberToRead]).size())
{
m_scalarResultsToAdd->at(m_requestedTimesteps[m_currentTimeStepNumberToRead])[resultIdx] = doubleValues[doubleValueIndex];
}
doubleValueIndex++;
}
cellCenterDataAccessObject->setCellScalar(cellIdx, doubleValues[cellIdx]);
}
}

View File

@ -267,6 +267,8 @@ void RiuMainWindow::createActions()
// Help actions
m_aboutAction = new QAction("&About", this);
connect(m_aboutAction, SIGNAL(triggered()), SLOT(slotAbout()));
m_commandLineHelpAction = new QAction("&Command Line Help", this);
connect(m_commandLineHelpAction, SIGNAL(triggered()), SLOT(slotShowCommandLineHelp()));
// Draw style actions
m_dsActionGroup = new QActionGroup(this);
@ -365,6 +367,7 @@ void RiuMainWindow::createMenus()
// Help menu
QMenu* helpMenu = menuBar()->addMenu("&Help");
helpMenu->addAction(m_aboutAction);
helpMenu->addAction(m_commandLineHelpAction);
}
@ -786,7 +789,7 @@ void RiuMainWindow::slotImportWellPathsFromFile()
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("WELLPATH_DIR");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(this, "Import Well Paths", defaultDir, "JSON Well Path (*.json);;ASCII Well Paths (*.asc *.asci *.ascii)");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(this, "Import Well Paths", defaultDir, "Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
if (wellPathFilePaths.size() < 1) return;
@ -1647,3 +1650,13 @@ void RiuMainWindow::slotImportWellPathsFromSSIHub()
if (app->project()) app->project()->createDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotShowCommandLineHelp()
{
RiaApplication* app = RiaApplication::instance();
QString text = app->commandLineParameterHelp();
app->showFormattedTextInMessageBox(text);
}

View File

@ -156,6 +156,7 @@ private:
// Help actions
QAction* m_aboutAction;
QAction* m_commandLineHelpAction;
// Animation
caf::AnimationToolBar* m_animationToolBar;
@ -231,6 +232,7 @@ private slots:
// Help slots
void slotAbout();
void slotShowCommandLineHelp();
void slotSubWindowActivated(QMdiSubWindow* subWindow);
void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);

View File

@ -9,12 +9,10 @@ void getActiveCellCenters(NDArray& cellCenterValues, const QString &hostName, qu
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getActiveCellCenters(NDArray& cellCenterValues, const QString &hostName, qu
while (socket.bytesAvailable() < (int)(2 * sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -65,7 +63,7 @@ void getActiveCellCenters(NDArray& cellCenterValues, const QString &hostName, qu
while (socket.bytesAvailable() < (qint64)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
while (socket.bytesAvailable() < (int)(2 * sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -65,7 +63,7 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
while (socket.bytesAvailable() < (qint64)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -69,7 +67,7 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
{
while (socket.bytesAvailable() < (int)byteCount)
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
QString errorMsg = QString("Waiting for column number: %1 of %2: %3").arg(tIdx).arg(columnCount).arg(socket.errorString());

View File

@ -5,12 +5,10 @@
void getActiveCellProperty(Matrix& propertyFrames, const QString &serverName, quint16 serverPort,
const qint64& caseId, QString propertyName, const int32NDArray& requestedTimeSteps, QString porosityModel)
{
const int Timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(Timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -40,7 +38,7 @@ void getActiveCellProperty(Matrix& propertyFrames, const QString &serverName, qu
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -71,7 +69,7 @@ void getActiveCellProperty(Matrix& propertyFrames, const QString &serverName, qu
{
while (socket.bytesAvailable() < (int)byteCount)
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error((("Waiting for timestep data number: ") + QString::number(tIdx)+ ": " + socket.errorString()).toLatin1().data());
octave_stdout << "Active cells: " << activeCellCount << ", Timesteps: " << timestepCount << std::endl;

View File

@ -9,12 +9,10 @@ void getCaseGroups(std::vector<QString>& groupNames, std::vector<int>& groupIds,
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -33,7 +31,7 @@ void getCaseGroups(std::vector<QString>& groupNames, std::vector<int>& groupIds,
// Get response. First wait for the header
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;
@ -51,7 +49,7 @@ void getCaseGroups(std::vector<QString>& groupNames, std::vector<int>& groupIds,
// Get response. Read all data for command
while (socket.bytesAvailable() < (int)byteCount)
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNames, std
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNames, std
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -47,7 +45,7 @@ void getCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNames, std
while (socket.bytesAvailable() < (int)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getCellCenters(NDArray& cellCenterValues, const QString &hostName, quint16
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getCellCenters(NDArray& cellCenterValues, const QString &hostName, quint16
while (socket.bytesAvailable() < (int)(5 * sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -70,7 +68,7 @@ void getCellCenters(NDArray& cellCenterValues, const QString &hostName, quint16
while (socket.bytesAvailable() < (qint64)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16
while (socket.bytesAvailable() < (int)(5 * sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -72,7 +70,7 @@ void getCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16
while (socket.bytesAvailable() < (qint64)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getCoarseningInfo(int32NDArray& coarseningInfo, const QString &hostName, qu
QString serverName = hostName;
quint16 serverPort = port;
const int Timeout = 5 * 1000;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(Timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getCoarseningInfo(int32NDArray& coarseningInfo, const QString &hostName, qu
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -47,7 +45,7 @@ void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64
while (socket.bytesAvailable() < (int)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getGridDimensions(int32NDArray& gridDimensions, const QString &hostName, qu
QString serverName = hostName;
quint16 serverPort = port;
const int Timeout = 5 * 1000;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(Timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getGridDimensions(int32NDArray& gridDimensions, const QString &hostName, qu
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -5,12 +5,12 @@
void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16 serverPort,
const int& caseId, int gridIdx, QString propertyName, const int32NDArray& requestedTimeSteps, QString porosityModel)
{
const int Timeout = riOctavePlugin::timeOutMilliSecs;
const int Timeout = riOctavePlugin::shortTimeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(Timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -40,7 +40,7 @@ void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16
while (socket.bytesAvailable() < (int)(4*sizeof(quint64)))
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -81,7 +81,7 @@ void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16
while (socket.bytesAvailable() < (int)totalByteCount)
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
{
error(("Waiting for data : " + socket.errorString()).toLatin1().data());
return ;
@ -104,12 +104,15 @@ void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16
if (caseId < 0)
{
tmp += QString(" from current case.");
tmp += QString(" from current case,");
}
else
{
tmp += QString(" from case with Id: %1.").arg(caseId);
tmp += QString(" from case with Id: %1,").arg(caseId);
}
tmp += QString(" grid index: %1, ").arg(gridIdx);
octave_stdout << tmp.toStdString() << " I, J, K " << cellCountI << ", " << cellCountJ << ", " << cellCountK << ", Timesteps : " << timestepCount << std::endl;
return;
@ -130,7 +133,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
{
if (nargout < 1)
{
error("riGetActiveCellProperty: Missing output argument.\n");
error("riGetGridProperty: Missing output argument.\n");
print_usage();
return octave_value_list ();
}
@ -138,14 +141,14 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
int nargin = args.length ();
if (nargin < 2)
{
error("riGetActiveCellProperty: Too few arguments. The name of the property and index of the grid requested is neccesary.\n");
error("riGetGridProperty: Too few arguments. The name of the property and index of the grid requested is neccesary.\n");
print_usage();
return octave_value_list ();
}
if (nargin > 5)
{
error("riGetActiveCellProperty: Too many arguments.\n");
error("riGetGridProperty: Too many arguments.\n");
print_usage();
return octave_value_list ();
}
@ -187,7 +190,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
// Check if we have more arguments than we should
if (nargin > lastArgumentIndex + 1)
{
error("riGetActiveCellProperty: Unexpected argument after the PorosityModel.\n");
error("riGetGridProperty: Unexpected argument after the PorosityModel.\n");
print_usage();
return octave_value_list ();
}
@ -207,6 +210,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
if (argIndices[3] >= 0) requestedTimeSteps = args(argIndices[3]).int32_array_value();
if (argIndices[4] >= 0) porosityModel = args(argIndices[4]).string_value();
if (porosityModel != "Matrix" && porosityModel != "Fracture")
{
error("riGetGridProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");

View File

@ -1,18 +1,17 @@
#include <QtNetwork>
#include <octave/oct.h>
#include "riSettings.h"
void getMainGridDimensions(int32NDArray& gridDimensions, const QString &hostName, quint16 port, QString caseName)
{
QString serverName = hostName;
quint16 serverPort = port;
const int Timeout = 5 * 1000;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(Timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -34,7 +33,7 @@ void getMainGridDimensions(int32NDArray& gridDimensions, const QString &hostName
while (socket.bytesAvailable() < (int)(3*sizeof(quint64)))
{
if (!socket.waitForReadyRead(Timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,12 +9,10 @@ void getSelectedCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNa
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -35,7 +33,7 @@ void getSelectedCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNa
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -47,7 +45,7 @@ void getSelectedCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNa
while (socket.bytesAvailable() < (int)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -17,12 +17,10 @@ void getTimeStepDates( std::vector<qint32>& yearValues,
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -43,7 +41,7 @@ void getTimeStepDates( std::vector<qint32>& yearValues,
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -55,7 +53,7 @@ void getTimeStepDates( std::vector<qint32>& yearValues,
while (socket.bytesAvailable() < (int)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -11,12 +11,10 @@ void getTimeStepDates( std::vector<double>& decimalDays,
QString serverName = hostName;
quint16 serverPort = port;
const int timeout = riOctavePlugin::timeOutMilliSecs;
QTcpSocket socket;
socket.connectToHost(serverName, serverPort);
if (!socket.waitForConnected(timeout))
if (!socket.waitForConnected(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -37,7 +35,7 @@ void getTimeStepDates( std::vector<double>& decimalDays,
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
return;
@ -49,7 +47,7 @@ void getTimeStepDates( std::vector<double>& decimalDays,
while (socket.bytesAvailable() < (int)(byteCount))
{
if (!socket.waitForReadyRead(timeout))
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
return;

View File

@ -9,7 +9,7 @@ void setEclipseProperty(const Matrix& propertyFrames, const QString &hostName, q
QTcpSocket socket;
socket.connectToHost(hostName, port);
if (!socket.waitForConnected(riOctavePlugin::timeOutMilliSecs))
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -47,7 +47,7 @@ void setEclipseProperty(const Matrix& propertyFrames, const QString &hostName, q
socketStream << (qint64)timeStepByteCount;
const double* internalData = propertyFrames.fortran_vec();
int dataWritten = socket.write((const char *)internalData, timeStepByteCount*timeStepCount);
qint64 dataWritten = socket.write((const char *)internalData, timeStepByteCount*timeStepCount);
if (dataWritten == timeStepByteCount*timeStepCount)
{
@ -72,7 +72,7 @@ void setEclipseProperty(const Matrix& propertyFrames, const QString &hostName, q
while(socket.bytesToWrite() && socket.state() == QAbstractSocket::ConnectedState)
{
// octave_stdout << "Bytes to write: " << socket.bytesToWrite() << std::endl;
socket.waitForBytesWritten(riOctavePlugin::timeOutMilliSecs);
socket.waitForBytesWritten(riOctavePlugin::longTimeOutMilliSecs);
OCTAVE_QUIT;
}

View File

@ -9,7 +9,7 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
QTcpSocket socket;
socket.connectToHost(hostName, port);
if (!socket.waitForConnected(riOctavePlugin::timeOutMilliSecs))
if (!socket.waitForConnected(riOctavePlugin::shortTimeOutMilliSecs))
{
error((("Connection: ") + socket.errorString()).toLatin1().data());
return;
@ -41,7 +41,17 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
qint64 cellCountI = mxDims.elem(0);
qint64 cellCountJ = mxDims.elem(1);
qint64 cellCountK = mxDims.elem(2);
qint64 timeStepCount = mxDims.elem(3);
qint64 timeStepCount = 0;
if (mxDims.length() > 3)
{
timeStepCount = mxDims.elem(3);
}
else
{
timeStepCount = 1;
}
qint64 singleTimeStepByteCount = cellCountI * cellCountJ * cellCountK * sizeof(double);
//octave_stdout << " Cell count I: " << cellCountI << " Cell count J: " << cellCountJ << " Cell count K: " << cellCountK << std::endl;
@ -62,12 +72,16 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
if (caseId == -1)
{
tmp += QString(" to current case.");
tmp += QString(" to current case,");
}
else
{
tmp += QString(" to case with Id = %1.").arg(caseId);
tmp += QString(" to case with Id = %1,").arg(caseId);
}
tmp += QString(" grid index: %1, ").arg(gridIndex);
octave_stdout << tmp.toStdString() << " Time steps : " << timeStepCount << std::endl;
}
else
{
@ -79,13 +93,13 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
while(socket.bytesToWrite() && socket.state() == QAbstractSocket::ConnectedState)
{
// octave_stdout << "Bytes to write: " << socket.bytesToWrite() << std::endl;
socket.waitForBytesWritten(riOctavePlugin::timeOutMilliSecs);
socket.waitForBytesWritten(riOctavePlugin::longTimeOutMilliSecs);
OCTAVE_QUIT;
}
if (socket.bytesToWrite() && socket.state() != QAbstractSocket::ConnectedState)
{
error("riSetActiveCellProperty : ResInsight refused to accept the data. Maybe the dimensions or porosity model is wrong.\n");
error("riSetGridProperty : ResInsight refused to accept the data. Maybe the dimensions or porosity model is wrong.\n");
}
return;
}
@ -128,9 +142,9 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
dim_vector mxDims = propertyFrames.dims();
if (mxDims.length() != 4)
if (!(mxDims.length() == 3 || mxDims.length() == 4))
{
error("riSetGridProperty: The supplied Data Matrix must have four dimensions: numI*numJ*numK*numTimeSteps");
error("riSetGridProperty: The supplied Data Matrix must have three dimensions (numI*numJ*numK*1) or four dimensions (numI*numJ*numK*numTimeSteps)");
print_usage();
return octave_value_list ();
@ -200,8 +214,15 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
if (argIndices[4] >= 0) timeStepIndices = args(argIndices[4]).int32_array_value();
if (argIndices[5] >= 0) porosityModel = args(argIndices[5]).string_value();
if (timeStepIndices.length())
if (timeStepIndices.length() > 1)
{
if (mxDims.length() == 3)
{
error("riSetGridProperty: The input matrix has three dimensions, but there are more than one time step in [TimeStepIndices]. If more than one time step is defined, the data matrix must be 4D.");
print_usage();
return octave_value_list ();
}
int timeStepCount = mxDims.elem(3);
if (timeStepIndices.length() != timeStepCount)
{
@ -213,7 +234,7 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
if (porosityModel != "Matrix" && porosityModel != "Fracture")
{
error("riSetActiveCellProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");
error("riSetGridProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");
print_usage();
return octave_value_list ();
}

View File

@ -20,7 +20,9 @@
namespace riOctavePlugin
{
const int timeOutMilliSecs = 5000;
const int connectTimeOutMilliSecs = 5000;
const int shortTimeOutMilliSecs = 5000;
const int longTimeOutMilliSecs = 60000;
// Octave data structure : CaseInfo
char caseInfo_CaseId[] = "CaseId";

View File

@ -1,7 +1,7 @@
set(CMAKE_MAJOR_VERSION 0)
set(CMAKE_MINOR_VERSION 9)
set(CMAKE_PATCH_VERSION 18)
set(CMAKE_PATCH_VERSION 20)
set(PRODUCTVER ${CMAKE_MAJOR_VERSION},${CMAKE_MINOR_VERSION},0,${CMAKE_PATCH_VERSION})
set(STRPRODUCTVER ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})

View File

@ -33,6 +33,9 @@ namespace cvf {
//==================================================================================================
ScalarMapperDiscreteLog::ScalarMapperDiscreteLog()
: m_logRange(0.0),
m_logRangeMin(0.0),
m_hasNegativeRange(false)
{
m_decadeLevelCount = 2;
}

View File

@ -172,7 +172,7 @@ void AnimationToolBar::connectAnimationControl(caf::FrameAnimationControl* anima
connect(m_timestepCombo, SIGNAL(currentIndexChanged(int)), animationControl, SLOT(setCurrentFrame(int)));
connect(m_frameRateSlider, SIGNAL(valueChanged(int)), this, SLOT(slotFrameRateSliderChanged(int)));
connect(animationControl, SIGNAL(changeFrame(int)), m_timestepCombo, SLOT(setCurrentIndex (int)));
connect(animationControl, SIGNAL(changeFrame(int)), SLOT(slotUpdateComboBoxIndex(int)));
connect(animationControl, SIGNAL(frameCountChanged(int)), this, SLOT(slotUpdateTimestepList(int)));
int timeout = animationControl->timeout();
double initialFrameRate = 1000;
@ -318,4 +318,17 @@ void AnimationToolBar::slotFwdBwdModeToggled(bool on)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void AnimationToolBar::slotUpdateComboBoxIndex(int value)
{
// Update only the combo box index, but do not set current frame
// Disconnect the signal temporarily when updating UI
disconnect(m_timestepCombo, SIGNAL(currentIndexChanged(int)), m_activeAnimationControl, SLOT(setCurrentFrame(int)));
m_timestepCombo->setCurrentIndex(value);
connect(m_timestepCombo, SIGNAL(currentIndexChanged(int)), m_activeAnimationControl, SLOT(setCurrentFrame(int)));
}
} // End namespace caf

View File

@ -60,6 +60,7 @@ private slots:
void slotFrameRateSliderChanged(int value);
void slotFromStartModeToggled(bool on);
void slotFwdBwdModeToggled(bool on);
void slotUpdateComboBoxIndex(int value);
private:
void init();

View File

@ -164,6 +164,22 @@ bool PdmUiItem::isUiHidden(QString uiConfigName) const
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool PdmUiItem::isUiChildrenHidden(QString uiConfigName) const
{
const PdmUiItemInfo* conInfo = configInfo(uiConfigName);
const PdmUiItemInfo* defInfo = defaultInfo();
const PdmUiItemInfo* sttInfo = m_staticItemInfo;
if (conInfo && !(conInfo->m_isChildrenHidden == -1)) return conInfo->m_isChildrenHidden;
if (defInfo && !(defInfo->m_isChildrenHidden == -1)) return defInfo->m_isChildrenHidden;
if (sttInfo && !(sttInfo->m_isChildrenHidden == -1)) return sttInfo->m_isChildrenHidden;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -35,12 +35,12 @@ class PdmUiItemInfo
{
public:
PdmUiItemInfo()
: m_editorTypeName(""), m_isHidden(-1) , m_isReadOnly(-1)
: m_editorTypeName(""), m_isHidden(-1), m_isChildrenHidden(-1), m_isReadOnly(-1)
{}
PdmUiItemInfo( QString uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "")
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis),
m_editorTypeName(""), m_isHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT)
m_editorTypeName(""), m_isHidden(false), m_isChildrenHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT)
{ }
enum LabelPosType { LEFT, TOP, HIDDEN };
@ -52,8 +52,9 @@ private:
QString m_whatsThis;
QIcon m_icon;
QString m_editorTypeName; ///< Use this exact type of editor to edit this UiItem
int m_isHidden; ///< UiItem should be hidden. -1 means not set
int m_isReadOnly; ///< UiItem should be insensitive, or read only. -1 means not set.
int m_isHidden; ///< UiItem should be hidden. -1 means not set
int m_isChildrenHidden; ///< Children of UiItem should be hidden. -1 means not set
int m_isReadOnly; ///< UiItem should be insensitive, or read only. -1 means not set.
LabelPosType m_labelAlignment;
};
@ -115,6 +116,9 @@ public:
bool isUiHidden(QString uiConfigName = "") const;
void setUiHidden(bool isHidden, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isHidden = isHidden; }
bool isUiChildrenHidden(QString uiConfigName = "") const;
void setUiChildrenHidden(bool isChildrenHidden, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isChildrenHidden = isChildrenHidden; }
bool isUiReadOnly(QString uiConfigName = "");
void setUiReadOnly(bool isReadOnly, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isReadOnly = isReadOnly; }

View File

@ -21,6 +21,7 @@
#include <QPointer>
#include <QProgressDialog>
#include <QCoreApplication>
#include <QApplication>
#include <QThread>
#include <assert.h>
@ -56,6 +57,8 @@ namespace caf {
ProgressInfo::ProgressInfo(size_t maxProgressValue, const QString& title)
{
ProgressInfoStatic::start(maxProgressValue, title);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
}
//--------------------------------------------------------------------------------------------------
@ -64,6 +67,8 @@ ProgressInfo::ProgressInfo(size_t maxProgressValue, const QString& title)
ProgressInfo::~ProgressInfo()
{
ProgressInfoStatic::finished();
QApplication::restoreOverrideCursor();
}
//--------------------------------------------------------------------------------------------------
@ -265,7 +270,7 @@ void ProgressInfoStatic::start(size_t maxProgressValue, const QString& title)
if (!maxProgressStack().size())
{
progressDialog()->setWindowModality(Qt::WindowModal);
progressDialog()->setWindowModality(Qt::ApplicationModal);
progressDialog()->setMinimum(0);
progressDialog()->setWindowTitle(title);
progressDialog()->setCancelButton(NULL);

View File

@ -552,6 +552,14 @@ PdmUiTreeItem* UiTreeItemBuilderPdm::buildViewItems(PdmUiTreeItem* parentTreeIte
{
caf::PdmFieldHandle* field = *it;
// Fix for hidden legend definitions. There is only one visible legend definition, the others reside in a hidden container
// Todo: This is a Hack. Must be rewritten when a more general ui tree building method is in place.
// See comment at top of this method.
if (field->isUiChildrenHidden())
{
continue;
}
std::vector<caf::PdmObject*> children;
field->childObjects(&children);
size_t i;