mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Updated riGetCurrentCase with case type
p4#: 21619
This commit is contained in:
parent
b3a15268f6
commit
667a4e6995
@ -292,22 +292,20 @@ void RiaSocketServer::readCommandFromOctave()
|
||||
{
|
||||
qint64 caseId = -1;
|
||||
QString caseName;
|
||||
qint64 caseType = -1;
|
||||
QString caseType;
|
||||
qint64 caseGroupId = -1;
|
||||
|
||||
if (reservoir)
|
||||
{
|
||||
caseId = reservoir->caseId();
|
||||
caseName = reservoir->caseUserDescription();
|
||||
caseType = -1;
|
||||
|
||||
if (reservoir->parentGridCaseGroup())
|
||||
{
|
||||
caseGroupId = reservoir->parentGridCaseGroup()->groupId();
|
||||
}
|
||||
caseInfo(reservoir, caseGroupId, caseType);
|
||||
}
|
||||
|
||||
quint64 byteCount = 3*sizeof(qint64) + caseName.size()*sizeof(QChar);
|
||||
quint64 byteCount = 2*sizeof(qint64);
|
||||
byteCount += caseName.size()*sizeof(QChar);
|
||||
byteCount += caseType.size()*sizeof(QChar);
|
||||
|
||||
socketStream << byteCount;
|
||||
|
||||
@ -449,34 +447,9 @@ void RiaSocketServer::readCommandFromOctave()
|
||||
{
|
||||
RimCase* rimCase = cases[i];
|
||||
|
||||
qint64 caseGroupId;
|
||||
QString caseType;
|
||||
qint64 caseGroupId = -1;
|
||||
|
||||
RimCaseCollection* caseCollection = rimCase->parentCaseCollection();
|
||||
if (caseCollection)
|
||||
{
|
||||
caseGroupId = caseCollection->parentCaseGroup()->groupId;
|
||||
|
||||
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||
{
|
||||
caseType = "StatisticsCase";
|
||||
}
|
||||
else
|
||||
{
|
||||
caseType = "SourceCase";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dynamic_cast<RimInputCase*>(rimCase))
|
||||
{
|
||||
caseType = "InputCase";
|
||||
}
|
||||
else
|
||||
{
|
||||
caseType = "ResultCase";
|
||||
}
|
||||
}
|
||||
caseInfo(rimCase, caseGroupId, caseType);
|
||||
|
||||
caseIds.push_back(rimCase->caseId);
|
||||
caseNames.push_back(rimCase->caseUserDescription);
|
||||
@ -934,3 +907,39 @@ void RiaSocketServer::calculateMatrixModelActiveCellInfo(RimCase* reservoirCase,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::caseInfo(RimCase* rimCase, qint64& caseGroupId, QString& caseType)
|
||||
{
|
||||
CVF_ASSERT(rimCase);
|
||||
|
||||
RimCaseCollection* caseCollection = rimCase->parentCaseCollection();
|
||||
if (caseCollection)
|
||||
{
|
||||
caseGroupId = caseCollection->parentCaseGroup()->groupId;
|
||||
|
||||
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||
{
|
||||
caseType = "StatisticsCase";
|
||||
}
|
||||
else
|
||||
{
|
||||
caseType = "SourceCase";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caseGroupId = -1;
|
||||
|
||||
if (dynamic_cast<RimInputCase*>(rimCase))
|
||||
{
|
||||
caseType = "InputCase";
|
||||
}
|
||||
else
|
||||
{
|
||||
caseType = "ResultCase";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,8 @@ private:
|
||||
std::vector<qint32>& hostCellJ,
|
||||
std::vector<qint32>& hostCellK);
|
||||
|
||||
void caseInfo(RimCase* rimCase, qint64& caseGroupId, QString& caseType);
|
||||
|
||||
|
||||
private:
|
||||
QTcpServer* m_tcpServer;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "riSettings.h"
|
||||
|
||||
void getCurrentCase(qint64& caseId, QString& caseName, qint64& caseType, qint64& caseGroupId, const QString &hostName, quint16 port)
|
||||
void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64& caseGroupId, const QString &hostName, quint16 port)
|
||||
{
|
||||
QString serverName = hostName;
|
||||
quint16 serverPort = port;
|
||||
@ -70,9 +70,9 @@ DEFUN_DLD (riGetCurrentCase, args, nargout,
|
||||
"\n"
|
||||
" riGetCurrentCase()\n"
|
||||
"\n"
|
||||
"Returns meta information for the Case considered to be the “Current Case” by ResInsight.\n"
|
||||
"This function returns a CaseInfo Structure for the Case considered being the 'Current Case' by ResInsight.\n"
|
||||
"When ResInsigt loops over a selection of cases and executes an Octave script for each of them,\n"
|
||||
"this function returns the CaseInformation for that particular Case."
|
||||
"this function returns the CaseInfo for that particular Case.\n"
|
||||
)
|
||||
{
|
||||
octave_value retval;
|
||||
@ -92,7 +92,7 @@ DEFUN_DLD (riGetCurrentCase, args, nargout,
|
||||
{
|
||||
qint64 caseId = -1;
|
||||
QString caseName;
|
||||
qint64 caseType = -1;
|
||||
QString caseType;
|
||||
qint64 caseGroupId = -1;
|
||||
|
||||
getCurrentCase(caseId, caseName, caseType, caseGroupId, "127.0.0.1", 40001);
|
||||
@ -101,7 +101,7 @@ DEFUN_DLD (riGetCurrentCase, args, nargout,
|
||||
|
||||
fieldMap.assign(riOctavePlugin::caseInfo_CaseId, caseId);
|
||||
fieldMap.assign(riOctavePlugin::caseInfo_CaseName, caseName.toLatin1().data());
|
||||
fieldMap.assign(riOctavePlugin::caseInfo_CaseType, caseType);
|
||||
fieldMap.assign(riOctavePlugin::caseInfo_CaseType, caseType.toLatin1().data());
|
||||
fieldMap.assign(riOctavePlugin::caseInfo_CaseGroupId, caseGroupId);
|
||||
|
||||
retval = octave_value(fieldMap);
|
||||
|
Loading…
Reference in New Issue
Block a user