static std::vector< double > satnumApply( size_t size, const std::string& columnName, const std::vector< double >& fallbackValues, const TableManager* tableManager, const EclipseGrid* eclipseGrid, const GridProperties<int>* intGridProperties, bool useOneMinusTableValue ) { std::vector< double > values( size, 0 ); auto tabdims = tableManager->getTabdims(); const auto& satnum = intGridProperties->getKeyword("SATNUM"); const auto& endnum = intGridProperties->getKeyword("ENDNUM"); int numSatTables = tabdims->getNumSatTables(); satnum.checkLimits( 1 , numSatTables ); // acctually assign the defaults. if the ENPVD keyword was specified in the deck, // this currently cannot be done because we would need the Z-coordinate of the // cell and we would need to know how the simulator wants to interpolate between // sampling points. Both of these are outside the scope of opm-parser, so we just // assign a NaN in this case... const bool useEnptvd = tableManager->useEnptvd(); const auto& enptvdTables = tableManager->getEnptvdTables(); const auto gridsize = eclipseGrid->getCartesianSize(); for( size_t cellIdx = 0; cellIdx < gridsize; cellIdx++ ) { int satTableIdx = satnum.iget( cellIdx ) - 1; int endNum = endnum.iget( cellIdx ) - 1; double cellDepth = eclipseGrid->getCellDepth( cellIdx ); values[cellIdx] = selectValue(enptvdTables, (useEnptvd && endNum >= 0) ? endNum : -1, columnName, cellDepth, fallbackValues[ satTableIdx ], useOneMinusTableValue); } return values; }
LRESULT PickList<C>::init(HWND hDlg, WORD wId, BSTR xmlDoc, BSTR xpath, C curVal) { ::SendDlgItemMessage(hDlg, wId, CB_RESETCONTENT, 0, 0); this->hDlg = hDlg; this->wId = wId; // In case any of the XML stuff fails selectValue(curVal); try { ::MSXML2::IXMLDOMDocumentPtr pXMLDoc; pXMLDoc.CreateInstance("Msxml2.DOMDocument", NULL, CLSCTX_INPROC_SERVER); pXMLDoc->async = false; pXMLDoc->loadXML(xmlDoc); valueSet = pXMLDoc->selectSingleNode(xpath); if (valueSet != NULL) { ::MSXML2::IXMLDOMNodeListPtr items = valueSet->childNodes; ::MSXML2::IXMLDOMNodePtr item = items->nextNode(); int i=0; while (item != NULL) { _bstr_t value = item->selectSingleNode(L"value")->nodeTypedValue; _bstr_t label = item->selectSingleNode(L"label")->nodeTypedValue; int index = SendDlgItemMessage(hDlg,wId,CB_ADDSTRING,0,(LPARAM)((char*)label)); SendDlgItemMessage(hDlg,wId,CB_SETITEMDATA,index,(LPARAM)i); if ((*pEquals)(curVal,value)) SendDlgItemMessage(hDlg,wId,CB_SETCURSEL,(WPARAM)index,0); item = items->nextNode(); i++; } } } catch (...) { AtlTrace("Exception trying to build picklist from XML fragment\n"); } return 1; }