clang-format: Set column width to 140

* Set column width to 140
* Use c++20
* Remove redundant virtual
This commit is contained in:
Magne Sjaastad
2023-02-26 10:48:40 +01:00
committed by GitHub
parent 8768e186d8
commit f8c5cf389f
1535 changed files with 10456 additions and 19398 deletions

View File

@@ -83,8 +83,8 @@ public:
}
};
static bool RiaGetMainGridDimensions_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetMainGridDimensions>(
RiaGetMainGridDimensions::commandName() );
static bool RiaGetMainGridDimensions_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetMainGridDimensions>( RiaGetMainGridDimensions::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -143,10 +143,7 @@ public:
for ( size_t tIdx = 0; tIdx < columnCount; ++tIdx )
{
RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)activeCellInfo[tIdx].data(),
timestepByteCount );
RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)activeCellInfo[tIdx].data(), timestepByteCount );
}
return true;
@@ -179,7 +176,7 @@ public:
return;
}
RigActiveCellInfo* actCellInfo = reservoirCase->eclipseCaseData()->activeCellInfo( porosityModel );
RigActiveCellInfo* actCellInfo = reservoirCase->eclipseCaseData()->activeCellInfo( porosityModel );
size_t numMatrixModelActiveCells = actCellInfo->reservoirActiveCellCount();
gridNumber.reserve( numMatrixModelActiveCells );
@@ -405,7 +402,7 @@ class RiaGetTimeStepDates : public RiaSocketCommand
{
public:
static QString commandName() { return QString( "GetTimeStepDates" ); }
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
{
int argCaseGroupId = -1;
@@ -426,9 +423,7 @@ public:
RigEclipseResultAddress addrToMaxTimeStepCountResult;
if ( rimCase && rimCase->eclipseCaseData() )
{
rimCase->eclipseCaseData()
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->maxTimeStepCount( &addrToMaxTimeStepCountResult );
rimCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount( &addrToMaxTimeStepCountResult );
if ( !addrToMaxTimeStepCountResult.isValid() )
{
canFetchData = false;
@@ -447,10 +442,9 @@ public:
return true;
}
std::vector<QDateTime> timeStepDates =
rimCase->eclipseCaseData()
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->timeStepDates( RigEclipseResultAddress( addrToMaxTimeStepCountResult ) );
std::vector<QDateTime> timeStepDates = rimCase->eclipseCaseData()
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->timeStepDates( RigEclipseResultAddress( addrToMaxTimeStepCountResult ) );
quint64 timeStepCount = timeStepDates.size();
quint64 byteCount = sizeof( quint64 ) + 6 * timeStepCount * sizeof( qint32 );
@@ -495,7 +489,7 @@ class RiaGetTimeStepDays : public RiaSocketCommand
{
public:
static QString commandName() { return QString( "GetTimeStepDays" ); }
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
{
int argCaseGroupId = -1;
@@ -516,9 +510,7 @@ public:
RigEclipseResultAddress addrToMaxTimeStepCountResult;
if ( rimCase && rimCase->eclipseCaseData() )
{
rimCase->eclipseCaseData()
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->maxTimeStepCount( &addrToMaxTimeStepCountResult );
rimCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount( &addrToMaxTimeStepCountResult );
if ( !addrToMaxTimeStepCountResult.isValid() )
{
canFetchData = false;
@@ -537,9 +529,8 @@ public:
return true;
}
std::vector<double> daysSinceSimulationStart = rimCase->eclipseCaseData()
->results( RiaDefines::PorosityModelType::MATRIX_MODEL )
->daysSinceSimulationStart( addrToMaxTimeStepCountResult );
std::vector<double> daysSinceSimulationStart =
rimCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->daysSinceSimulationStart( addrToMaxTimeStepCountResult );
quint64 timeStepCount = daysSinceSimulationStart.size();
quint64 byteCount = sizeof( quint64 ) + timeStepCount * sizeof( qint32 );
@@ -578,12 +569,7 @@ public:
// Write data back to octave: column count, bytes per column, caseId, gridNumber, cellI, cellJ, cellK
std::array<std::vector<qint32>, 5> selectedCellInfo;
getSelectedCells( rimCase,
selectedCellInfo[0],
selectedCellInfo[1],
selectedCellInfo[2],
selectedCellInfo[3],
selectedCellInfo[4] );
getSelectedCells( rimCase, selectedCellInfo[0], selectedCellInfo[1], selectedCellInfo[2], selectedCellInfo[3], selectedCellInfo[4] );
// First write column count
quint64 columnCount = 5;
@@ -596,10 +582,7 @@ public:
// Write back table data
for ( size_t tIdx = 0; tIdx < columnCount; ++tIdx )
{
RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)selectedCellInfo[tIdx].data(),
columnByteCount );
RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)selectedCellInfo[tIdx].data(), columnByteCount );
}
return true;

View File

@@ -203,8 +203,7 @@ public:
{
quint64 valueIndex = 0;
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size();
reservoirCellIndex++ )
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ )
{
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
@@ -223,8 +222,8 @@ public:
}
};
static bool RiaGetActiveCellCenters_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellCenters>(
RiaGetActiveCellCenters::commandName() );
static bool RiaGetActiveCellCenters_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellCenters>( RiaGetActiveCellCenters::commandName() );
// NB: Match this mapping with the mapping in RifReaderEclipseOutput.cpp
static const size_t cellCornerMappingEclipse[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
@@ -299,18 +298,14 @@ public:
size_t gridLocalCellIndex = rigGrid->cellIndexFromIJK( i, j, k );
rigGrid->cellCornerVertices( gridLocalCellIndex, cornerVerts );
doubleValues[valueIndex++] =
getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
doubleValues[valueIndex++] = getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
}
}
}
CVF_ASSERT( valueIndex == cellCount );
RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)doubleValues.data(),
blockByteCount );
RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)doubleValues.data(), blockByteCount );
}
}
@@ -382,23 +377,18 @@ public:
quint64 valueIndex = 0;
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size();
reservoirCellIndex++ )
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < mainGrid->globalCellArray().size(); reservoirCellIndex++ )
{
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
mainGrid->cellCornerVertices( reservoirCellIndex, cornerVerts );
doubleValues[valueIndex++] =
getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
doubleValues[valueIndex++] = getCellCornerWithPositiveDepth( cornerVerts, cornerIndexMapping, coordIdx );
}
CVF_ASSERT( valueIndex == activeCellCount );
RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)doubleValues.data(),
blockByteCount );
RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)doubleValues.data(), blockByteCount );
}
}
@@ -406,5 +396,5 @@ public:
}
};
static bool RiaGetActiveCellCorners_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellCorners>(
RiaGetActiveCellCorners::commandName() );
static bool RiaGetActiveCellCorners_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellCorners>( RiaGetActiveCellCorners::commandName() );

View File

@@ -119,9 +119,8 @@ public:
QString propertyName = args[2];
RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid();
const std::vector<std::vector<double>>* nncValues =
mainGrid->nncData()->dynamicConnectionScalarResultByName( propertyName );
RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid();
const std::vector<std::vector<double>>* nncValues = mainGrid->nncData()->dynamicConnectionScalarResultByName( propertyName );
if ( nncValues == nullptr )
{
@@ -150,9 +149,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetDynamicNNCValues : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetDynamicNNCValues : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
}
}
else
@@ -220,10 +218,7 @@ public:
size_t connectionCount = mainGrid->nncData()->allConnections().size();
socketStream << (quint64)connectionCount;
RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)nncValues->data(),
sizeof( double ) * nncValues->size() );
RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)nncValues->data(), sizeof( double ) * nncValues->size() );
return true;
}
@@ -362,9 +357,8 @@ public:
bool ok = createIJKCellResults( rimCase->results( m_porosityModelEnum ), propertyName );
if ( !ok )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the property named: \"%2\"" ).arg( propertyName ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the property named: \"%2\"" ).arg( propertyName ) );
return true;
}
RigEclipseResultAddress resAddr( QString( "%1IJK" ).arg( propertyName ) );
@@ -403,9 +397,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riSetNNCProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riSetNNCProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
}
}
@@ -481,19 +474,17 @@ public:
size_t connectionCountFromOctave = m_bytesPerTimeStepToRead / sizeof( double );
size_t connectionCount = nncData->allConnections().size();
std::vector<std::vector<double>>* resultsToAdd =
nncData->generatedConnectionScalarResultByName( m_currentPropertyName );
std::vector<std::vector<double>>* resultsToAdd = nncData->generatedConnectionScalarResultByName( m_currentPropertyName );
if ( connectionCountFromOctave != connectionCount )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "The number of connections in the data coming from octave "
"does not match the case: '%1'\n" )
.arg( m_currentReservoir->caseUserDescription() ) +
RiaSocketServer::tr( " Octave: %1\n" ).arg( connectionCountFromOctave ) +
RiaSocketServer::tr( " %1: Connection count: %2" )
.arg( m_currentReservoir->caseUserDescription() )
.arg( connectionCount ) );
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "The number of connections in the data coming from octave "
"does not match the case: '%1'\n" )
.arg( m_currentReservoir->caseUserDescription() ) +
RiaSocketServer::tr( " Octave: %1\n" ).arg( connectionCountFromOctave ) +
RiaSocketServer::tr( " %1: Connection count: %2" ).arg( m_currentReservoir->caseUserDescription() ).arg( connectionCount ) );
connectionCountFromOctave = 0;
m_invalidConnectionCountDetected = true;
@@ -520,10 +511,7 @@ public:
internalMatrixData = resultsToAdd->at( m_requestedTimesteps[m_currentTimeStepNumberToRead] ).data();
QStringList errorMessages;
if ( !RiaSocketDataTransfer::readBlockDataFromSocket( currentClient,
(char*)( internalMatrixData ),
m_bytesPerTimeStepToRead,
errorMessages ) )
if ( !RiaSocketDataTransfer::readBlockDataFromSocket( currentClient, (char*)( internalMatrixData ), m_bytesPerTimeStepToRead, errorMessages ) )
{
for ( int i = 0; i < errorMessages.size(); i++ )
{
@@ -546,8 +534,7 @@ public:
RimEclipseInputCase* inputRes = dynamic_cast<RimEclipseInputCase*>( m_currentReservoir );
if ( inputRes )
{
RimEclipseInputProperty* inputProperty =
inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
RimEclipseInputProperty* inputProperty = inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
if ( !inputProperty )
{
inputProperty = new RimEclipseInputProperty;
@@ -562,12 +549,9 @@ public:
if ( m_currentEclResultAddress.isValid() && // Will never be valid because it is never set. What is
// correct behaviour ?
m_currentReservoir->eclipseCaseData() &&
m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum ) )
m_currentReservoir->eclipseCaseData() && m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum ) )
{
m_currentReservoir->eclipseCaseData()
->results( m_porosityModelEnum )
->recalculateStatistics( m_currentEclResultAddress );
m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum )->recalculateStatistics( m_currentEclResultAddress );
}
for ( size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i )
@@ -580,9 +564,7 @@ public:
// It is usually not needed to create new display model, but if any derived geometry based on
// generated data (from Octave) a full display model rebuild is required
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
m_currentReservoir->reservoirViews[i]
->intersectionCollection()
->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
m_currentReservoir->reservoirViews[i]->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}
}

View File

@@ -76,7 +76,7 @@ class RiaGetCurrentCase : public RiaSocketCommand
{
public:
static QString commandName() { return QString( "GetCurrentCase" ); }
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
{
qint64 caseId = RiaApplication::instance()->currentScriptCaseId();
QString caseName;
@@ -165,11 +165,10 @@ class RiaGetCaseGroups : public RiaSocketCommand
{
public:
static QString commandName() { return QString( "GetCaseGroups" ); }
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
bool interpretCommand( RiaSocketServer* server, const QList<QByteArray>& args, QDataStream& socketStream ) override
{
RimProject* proj = RimProject::current();
RimEclipseCaseCollection* analysisModels =
( proj && proj->activeOilField() ) ? proj->activeOilField()->analysisModels() : nullptr;
RimProject* proj = RimProject::current();
RimEclipseCaseCollection* analysisModels = ( proj && proj->activeOilField() ) ? proj->activeOilField()->analysisModels() : nullptr;
if ( analysisModels )
{
std::vector<QString> groupNames;
@@ -210,8 +209,7 @@ public:
}
};
static bool RiaGetCaseGroups_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetCaseGroups>( RiaGetCaseGroups::commandName() );
static bool RiaGetCaseGroups_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetCaseGroups>( RiaGetCaseGroups::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -230,9 +228,8 @@ public:
argCaseGroupId = args[1].toInt();
}
RimProject* proj = RimProject::current();
RimEclipseCaseCollection* analysisModels =
( proj && proj->activeOilField() ) ? proj->activeOilField()->analysisModels() : nullptr;
RimProject* proj = RimProject::current();
RimEclipseCaseCollection* analysisModels = ( proj && proj->activeOilField() ) ? proj->activeOilField()->analysisModels() : nullptr;
if ( analysisModels )
{
std::vector<RimCase*> cases;
@@ -300,5 +297,4 @@ public:
}
};
static bool RiaGetCases_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetCases>( RiaGetCases::commandName() );
static bool RiaGetCases_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetCases>( RiaGetCases::commandName() );

View File

@@ -77,17 +77,16 @@ public:
{
if ( rimCase->results( porosityModelEnum )->ensureKnownResultLoaded( RigEclipseResultAddress( propertyName ) ) )
{
scalarResultFrames = rimCase->results( porosityModelEnum )
->modifiableCellScalarResultTimesteps( RigEclipseResultAddress( propertyName ) );
scalarResultFrames =
rimCase->results( porosityModelEnum )->modifiableCellScalarResultTimesteps( RigEclipseResultAddress( propertyName ) );
}
}
if ( scalarResultFrames == nullptr )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" )
.arg( porosityModelName )
.arg( propertyName ) );
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" ).arg( porosityModelName ).arg( propertyName ) );
}
// Write data back : timeStepCount, bytesPrTimestep, dataForTimestep0 ... dataForTimestepN
@@ -131,9 +130,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
}
}
@@ -143,7 +141,7 @@ public:
// then the byte-size of the result values in one timestep
const RigActiveCellInfo* activeInfo = rimCase->eclipseCaseData()->activeCellInfo( porosityModelEnum );
const RigActiveCellInfo* activeInfo = rimCase->eclipseCaseData()->activeCellInfo( porosityModelEnum );
size_t timestepResultCount = activeInfo->reservoirActiveCellCount();
quint64 timestepByteCount = ( quint64 )( timestepResultCount * sizeof( double ) );
@@ -201,10 +199,7 @@ public:
}
// Write remaining data
if ( !RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)values.data(),
valueIndex * sizeof( double ) ) )
if ( !RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)values.data(), valueIndex * sizeof( double ) ) )
{
return false;
}
@@ -213,8 +208,8 @@ public:
}
};
static bool RiaGetActiveCellProperty_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellProperty>(
RiaGetActiveCellProperty::commandName() );
static bool RiaGetActiveCellProperty_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellProperty>( RiaGetActiveCellProperty::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -269,10 +264,9 @@ public:
if ( !isResultsLoaded )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" )
.arg( porosityModelName )
.arg( propertyName ) );
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" ).arg( porosityModelName ).arg( propertyName ) );
// No data available
socketStream << (quint64)0 << (quint64)0 << (quint64)0 << (quint64)0;
@@ -311,9 +305,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
}
}
@@ -360,10 +353,7 @@ public:
if ( valueIndex >= valueCount )
{
if ( !RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)values.data(),
valueIndex * sizeof( double ) ) )
if ( !RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)values.data(), valueIndex * sizeof( double ) ) )
{
return false;
}
@@ -373,10 +363,7 @@ public:
}
// Write remaining data
if ( !RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)values.data(),
valueIndex * sizeof( double ) ) )
if ( !RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)values.data(), valueIndex * sizeof( double ) ) )
{
return false;
}
@@ -440,7 +427,7 @@ public:
rimCase->results( m_porosityModelEnum )->setTimeStepInfos( eclResAddr, timeStepInfos );
}
scalarResultFrames = rimCase->results( m_porosityModelEnum )->modifiableCellScalarResultTimesteps( eclResAddr );
scalarResultFrames = rimCase->results( m_porosityModelEnum )->modifiableCellScalarResultTimesteps( eclResAddr );
size_t timeStepCount = rimCase->results( m_porosityModelEnum )->maxTimeStepCount();
scalarResultFrames->resize( timeStepCount );
@@ -450,10 +437,9 @@ public:
if ( scalarResultFrames == nullptr )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" )
.arg( porosityModelName )
.arg( propertyName ) );
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" ).arg( porosityModelName ).arg( propertyName ) );
return true;
}
@@ -500,17 +486,15 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
}
}
if ( !m_requestedTimesteps.size() )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) );
return true;
}
@@ -553,17 +537,17 @@ public:
if ( cellCountFromOctave != activeCellCountReservoir )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "The number of cells in the data coming from octave does not match the case" ) +
":\"" + m_currentReservoir->caseUserDescription() +
"\"\n"
" Octave: " +
QString::number( cellCountFromOctave ) +
"\n"
" " +
m_currentReservoir->caseUserDescription() + ": Active cell count: " +
QString::number( activeCellCountReservoir ) + " Total cell count: " + QString::number( totalCellCount ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "The number of cells in the data coming from octave does not match the case" ) +
":\"" + m_currentReservoir->caseUserDescription() +
"\"\n"
" Octave: " +
QString::number( cellCountFromOctave ) +
"\n"
" " +
m_currentReservoir->caseUserDescription() +
": Active cell count: " + QString::number( activeCellCountReservoir ) +
" Total cell count: " + QString::number( totalCellCount ) );
cellCountFromOctave = 0;
m_invalidActiveCellCountDetected = true;
@@ -611,10 +595,7 @@ public:
internalMatrixData = m_scalarResultsToAdd->at( m_requestedTimesteps[m_currentTimeStepNumberToRead] ).data();
QStringList errorMessages;
if ( !RiaSocketDataTransfer::readBlockDataFromSocket( currentClient,
(char*)( internalMatrixData ),
m_bytesPerTimeStepToRead,
errorMessages ) )
if ( !RiaSocketDataTransfer::readBlockDataFromSocket( currentClient, (char*)( internalMatrixData ), m_bytesPerTimeStepToRead, errorMessages ) )
{
for ( int i = 0; i < errorMessages.size(); i++ )
{
@@ -638,8 +619,7 @@ public:
RimEclipseInputCase* inputRes = dynamic_cast<RimEclipseInputCase*>( m_currentReservoir );
if ( inputRes )
{
RimEclipseInputProperty* inputProperty =
inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
RimEclipseInputProperty* inputProperty = inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
if ( !inputProperty )
{
inputProperty = new RimEclipseInputProperty;
@@ -659,8 +639,7 @@ public:
if ( m_requestedTimesteps.size() == 1 && m_currentEclResultAddress.isValid() )
{
std::vector<std::vector<double>>* scalarResultFrames =
m_currentReservoir->results( m_porosityModelEnum )
->modifiableCellScalarResultTimesteps( m_currentEclResultAddress );
m_currentReservoir->results( m_porosityModelEnum )->modifiableCellScalarResultTimesteps( m_currentEclResultAddress );
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for ( size_t i = 0; i < scalarResultFrames->size(); i++ )
{
@@ -676,9 +655,7 @@ public:
}
}
m_currentReservoir->eclipseCaseData()
->results( m_porosityModelEnum )
->recalculateStatistics( m_currentEclResultAddress );
m_currentReservoir->eclipseCaseData()->results( m_porosityModelEnum )->recalculateStatistics( m_currentEclResultAddress );
}
for ( size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i )
@@ -691,9 +668,7 @@ public:
// It is usually not needed to create new display model, but if any derived geometry based on
// generated data (from Octave) a full display model rebuild is required
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
m_currentReservoir->reservoirViews[i]
->intersectionCollection()
->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
m_currentReservoir->reservoirViews[i]->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}
}
@@ -719,8 +694,8 @@ private:
bool m_invalidActiveCellCountDetected;
};
static bool RiaSetActiveCellProperty_init = RiaSocketCommandFactory::instance()->registerCreator<RiaSetActiveCellProperty>(
RiaSetActiveCellProperty::commandName() );
static bool RiaSetActiveCellProperty_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaSetActiveCellProperty>( RiaSetActiveCellProperty::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -766,9 +741,8 @@ public:
RigGridBase* grid = rimCase->eclipseCaseData()->grid( m_currentGridIndex );
if ( !grid )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the grid index : %1" ).arg( m_currentGridIndex ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the grid index : %1" ).arg( m_currentGridIndex ) );
return true;
}
@@ -789,8 +763,7 @@ public:
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Destination grid size do not match incoming grid size for grid index : %1" )
.arg( m_currentGridIndex ) );
RiaSocketServer::tr( "Destination grid size do not match incoming grid size for grid index : %1" ).arg( m_currentGridIndex ) );
return true;
}
@@ -799,9 +772,8 @@ public:
if ( m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0 )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Zero data to read for " ) + ":\"" +
m_currentReservoir->caseUserDescription() + "\"\n" );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) + RiaSocketServer::tr( "Zero data to read for " ) +
":\"" + m_currentReservoir->caseUserDescription() + "\"\n" );
return true;
}
@@ -818,9 +790,8 @@ public:
}
m_currentResultAddress = resAddr;
scalarResultFrames =
rimCase->results( m_porosityModelEnum )->modifiableCellScalarResultTimesteps( m_currentResultAddress );
size_t timeStepCount = rimCase->results( m_porosityModelEnum )->maxTimeStepCount();
scalarResultFrames = rimCase->results( m_porosityModelEnum )->modifiableCellScalarResultTimesteps( m_currentResultAddress );
size_t timeStepCount = rimCase->results( m_porosityModelEnum )->maxTimeStepCount();
scalarResultFrames->resize( timeStepCount );
m_currentPropertyName = propertyName;
@@ -828,10 +799,9 @@ public:
if ( scalarResultFrames == nullptr )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" )
.arg( porosityModelName )
.arg( propertyName ) );
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Could not find the %1 model property named: \"%2\"" ).arg( porosityModelName ).arg( propertyName ) );
return true;
}
@@ -867,18 +837,16 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetActiveCellProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
return true;
}
}
if ( !m_requestedTimesteps.size() )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) );
return true;
}
@@ -911,9 +879,8 @@ public:
RigGridBase* grid = m_currentReservoir->eclipseCaseData()->grid( m_currentGridIndex );
if ( !grid )
{
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "No grid found" ) + ":\"" +
m_currentReservoir->caseUserDescription() + "\"\n" );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) + RiaSocketServer::tr( "No grid found" ) +
":\"" + m_currentReservoir->caseUserDescription() + "\"\n" );
m_invalidDataDetected = true;
currentClient->abort(); // Hmmm... should we not let the server handle this ?
@@ -933,11 +900,10 @@ public:
if ( cellCountFromOctave != grid->cellCount() )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Mismatch between expected and received data. Expected : %1, Received : %2" )
.arg( grid->cellCount() )
.arg( cellCountFromOctave ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
RiaSocketServer::tr( "Mismatch between expected and received data. Expected : %1, Received : %2" )
.arg( grid->cellCount() )
.arg( cellCountFromOctave ) );
m_invalidDataDetected = true;
currentClient->abort();
@@ -1024,8 +990,7 @@ public:
RimEclipseInputCase* inputRes = dynamic_cast<RimEclipseInputCase*>( m_currentReservoir );
if ( inputRes )
{
RimEclipseInputProperty* inputProperty =
inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
RimEclipseInputProperty* inputProperty = inputRes->inputPropertyCollection()->findInputProperty( m_currentPropertyName );
if ( !inputProperty )
{
inputProperty = new RimEclipseInputProperty;
@@ -1078,9 +1043,7 @@ public:
// It is usually not needed to create new display model, but if any derived geometry based on
// generated data (from Octave) a full display model rebuild is required
m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw();
m_currentReservoir->reservoirViews[i]
->intersectionCollection()
->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
m_currentReservoir->reservoirViews[i]->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}
}
@@ -1232,9 +1195,7 @@ public:
if ( args.size() < 5 )
{
// Select all
for ( size_t tsIdx = 0;
tsIdx < rimCase->results( porosityModel )->timeStepCount( RigEclipseResultAddress( propertyName ) );
++tsIdx )
for ( size_t tsIdx = 0; tsIdx < rimCase->results( porosityModel )->timeStepCount( RigEclipseResultAddress( propertyName ) ); ++tsIdx )
{
requestedTimesteps.push_back( tsIdx );
}
@@ -1259,9 +1220,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested time steps." ) );
}
}
if ( !( rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid() ) )
@@ -1305,10 +1265,7 @@ public:
valueIndex++;
if ( valueIndex >= valueCount )
{
if ( !RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)values.data(),
valueIndex * sizeof( double ) ) )
if ( !RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)values.data(), valueIndex * sizeof( double ) ) )
{
return false;
}
@@ -1319,10 +1276,7 @@ public:
}
// Write remaining data
if ( !RiaSocketTools::writeBlockData( server,
server->currentClient(),
(const char*)values.data(),
valueIndex * sizeof( double ) ) )
if ( !RiaSocketTools::writeBlockData( server, server->currentClient(), (const char*)values.data(), valueIndex * sizeof( double ) ) )
{
return false;
}
@@ -1363,6 +1317,5 @@ public:
}
};
static bool RiaGetGridPropertyForSelectedCells_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetGridPropertyForSelectedCells>(
RiaGetGridPropertyForSelectedCells::commandName() );
static bool RiaGetGridPropertyForSelectedCells_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetGridPropertyForSelectedCells>(
RiaGetGridPropertyForSelectedCells::commandName() );

View File

@@ -22,10 +22,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaSocketDataTransfer::writeBlockDataToSocket( QTcpSocket* socket,
const char* data,
quint64 bytesToWrite,
QStringList& errorMessages )
bool RiaSocketDataTransfer::writeBlockDataToSocket( QTcpSocket* socket, const char* data, quint64 bytesToWrite, QStringList& errorMessages )
{
quint64 bytesWritten = 0;

View File

@@ -34,7 +34,6 @@ public:
static size_t maximumValueCountInBlock();
public:
static bool
writeBlockDataToSocket( QTcpSocket* socket, const char* data, quint64 bytesToWrite, QStringList& errorMessages );
static bool writeBlockDataToSocket( QTcpSocket* socket, const char* data, quint64 bytesToWrite, QStringList& errorMessages );
static bool readBlockDataFromSocket( QTcpSocket* socket, char* data, quint64 bytesToRead, QStringList& errorMessages );
};

View File

@@ -122,7 +122,7 @@ bool RiaSocketTools::writeBlockData( RiaSocketServer* server, QTcpSocket* socket
cvf::Timer timer;
QStringList errorMessages;
bool writeSucceded = RiaSocketDataTransfer::writeBlockDataToSocket( socket, data, bytesToWrite, errorMessages );
bool writeSucceded = RiaSocketDataTransfer::writeBlockDataToSocket( socket, data, bytesToWrite, errorMessages );
if ( server )
{

View File

@@ -34,8 +34,7 @@ class RiaSocketTools
{
public:
static RimEclipseCase* findCaseFromArgs( RiaSocketServer* server, const QList<QByteArray>& args );
static void
getCaseInfoFromCase( RimCase* rimCase, qint64& caseId, QString& caseName, QString& caseType, qint64& caseGroupId );
static void getCaseInfoFromCase( RimCase* rimCase, qint64& caseId, QString& caseName, QString& caseType, qint64& caseGroupId );
static bool writeBlockData( RiaSocketServer* server, QTcpSocket* socket, const char* data, quint64 bytesToWrite );
};

View File

@@ -82,8 +82,7 @@ public:
}
};
static bool RiaGetWellNames_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellNames>( RiaGetWellNames::commandName() );
static bool RiaGetWellNames_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellNames>( RiaGetWellNames::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -160,9 +159,8 @@ public:
if ( timeStepReadError )
{
server->showErrorMessage(
RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: riGetGridProperty : \n" ) +
RiaSocketServer::tr( "An error occurred while interpreting the requested timesteps." ) );
}
}
@@ -220,8 +218,7 @@ public:
}
};
static bool RiaGetWellStatus_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellStatus>( RiaGetWellStatus::commandName() );
static bool RiaGetWellStatus_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellStatus>( RiaGetWellStatus::commandName() );
//--------------------------------------------------------------------------------------------------
///
@@ -288,8 +285,7 @@ public:
for ( size_t bIdx = 0; bIdx < wellResFrame->m_wellResultBranches.size(); ++bIdx )
{
const std::vector<RigWellResultPoint>& branchResPoints =
wellResFrame->m_wellResultBranches[bIdx].m_branchResultPoints;
const std::vector<RigWellResultPoint>& branchResPoints = wellResFrame->m_wellResultBranches[bIdx].m_branchResultPoints;
for ( size_t rpIdx = 0; rpIdx < branchResPoints.size(); ++rpIdx )
{
const RigWellResultPoint& resPoint = branchResPoints[rpIdx];
@@ -339,5 +335,4 @@ public:
}
};
static bool RiaGetWellCells_init =
RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellCells>( RiaGetWellCells::commandName() );
static bool RiaGetWellCells_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetWellCells>( RiaGetWellCells::commandName() );