Produce geometry for all cells, not per grid

p4#: 21710
This commit is contained in:
Magne Sjaastad
2013-05-24 09:54:32 +02:00
parent 5d2249aaea
commit d9750b2dd4
3 changed files with 80 additions and 124 deletions

View File

@@ -4,7 +4,7 @@
#include "riSettings.h"
void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16 port, const qint32& caseId, const quint32& gridIndex, const QString& porosityModel)
void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16 port, const qint32& caseId, const QString& porosityModel)
{
QString serverName = hostName;
quint16 serverPort = port;
@@ -22,7 +22,7 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
// Create command and send it:
QString command = QString("GetActiveCellCorners %1 %2 %3").arg(caseId).arg(gridIndex).arg(porosityModel);
QString command = QString("GetActiveCellCorners %1 %2").arg(caseId).arg(porosityModel);
QByteArray cmdBytes = command.toLatin1();
QDataStream socketStream(&socket);
@@ -91,7 +91,7 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
DEFUN_DLD (riGetActiveCellCorners, args, nargout,
"Usage:\n"
"\n"
" riGetActiveCellCorners([CaseId], GridIndex, [PorosityModel = <20>Matrix<69>|<7C>Fracture<72>] )\n"
" riGetActiveCellCorners([CaseId], [PorosityModel = <20>Matrix<69>|<7C>Fracture<72>] )\n"
"\n"
"This function returns the UTM coordinates (X, Y, Z) of the 8 corners of each of the active cells.\n"
"If the CaseId is not defined, ResInsight<68>s Current Case is used.\n"
@@ -106,14 +106,8 @@ DEFUN_DLD (riGetActiveCellCorners, args, nargout,
}
int nargin = args.length ();
if (nargin < 1)
{
error("riGetActiveCellCorners: Too few arguments. The grid index argument is required.\n");
print_usage();
return octave_value_list ();
}
if (nargin > 3)
if (nargin > 2)
{
error("riGetActiveCellCorners: Too many arguments.\n");
print_usage();
@@ -121,31 +115,31 @@ DEFUN_DLD (riGetActiveCellCorners, args, nargout,
}
qint32 caseId = -1;
quint32 gridIndex = 0;
std::string porosityModel = "Matrix";
if (nargin == 1)
{
gridIndex = args(0).uint_value();
}
else if (nargin == 2)
{
if (args(0).is_numeric_type() && args(1).is_numeric_type())
if (args(0).is_numeric_type())
{
caseId = args(0).uint_value();
gridIndex = args(1).uint_value();
}
else
{
gridIndex = args(0).uint_value();
porosityModel = args(1).string_value();
porosityModel = args(0).string_value();
}
}
else if (nargin == 3)
else if (nargin == 2)
{
caseId = args(0).uint_value();
gridIndex = args(1).uint_value();
porosityModel = args(2).string_value();
if (args(0).is_numeric_type())
{
caseId = args(0).uint_value();
porosityModel = args(1).string_value();
}
else
{
caseId = args(1).uint_value();
porosityModel = args(0).string_value();
}
}
if (porosityModel != "Matrix" && porosityModel != "Fracture")
@@ -156,7 +150,7 @@ DEFUN_DLD (riGetActiveCellCorners, args, nargout,
}
NDArray cellCornerValues;
getActiveCellCorners(cellCornerValues, "127.0.0.1", 40001, caseId, gridIndex, porosityModel.c_str());
getActiveCellCorners(cellCornerValues, "127.0.0.1", 40001, caseId, porosityModel.c_str());
return octave_value(cellCornerValues);
}