mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
commit
6432b69aff
@ -111,6 +111,14 @@ RIApplication::RIApplication(int& argc, char** argv)
|
||||
|
||||
m_socketServer = new RiaSocketServer( this);
|
||||
m_workerProcess = NULL;
|
||||
|
||||
|
||||
m_startupDefaultDirectory = QDir::homePath();
|
||||
|
||||
#ifdef WIN32
|
||||
//m_startupDefaultDirectory += "/My Documents/";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -119,6 +127,7 @@ RIApplication::RIApplication(int& argc, char** argv)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIApplication::~RIApplication()
|
||||
{
|
||||
delete m_preferences;
|
||||
}
|
||||
|
||||
|
||||
@ -282,6 +291,8 @@ bool RIApplication::saveProjectPromptForFileName()
|
||||
{
|
||||
//if (m_project.isNull()) return true;
|
||||
|
||||
RIApplication* app = RIApplication::instance();
|
||||
|
||||
QString startPath;
|
||||
if (!m_project->fileName().isEmpty())
|
||||
{
|
||||
@ -290,7 +301,7 @@ bool RIApplication::saveProjectPromptForFileName()
|
||||
}
|
||||
else
|
||||
{
|
||||
startPath = QDir::currentPath();
|
||||
startPath = app->defaultFileDialogDirectory("BINARY_GRID");
|
||||
}
|
||||
|
||||
startPath += "/ResInsightProject.rip";
|
||||
@ -301,6 +312,9 @@ bool RIApplication::saveProjectPromptForFileName()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remember the directory to next time
|
||||
app->setDefaultFileDialogDirectory("BINARY_GRID", QFileInfo(fileName).absolutePath());
|
||||
|
||||
bool bSaveOk = saveProjectAs(fileName);
|
||||
|
||||
setWindowCaptionFromAppState();
|
||||
@ -591,38 +605,52 @@ bool RIApplication::parseArguments()
|
||||
|
||||
bool isParsingProjectFile = false;
|
||||
bool isParsingCaseNames = false;
|
||||
bool isParsingStartDir = false;
|
||||
bool showHelp = false;
|
||||
|
||||
int i;
|
||||
for (i = 1; i < arguments.size(); i++)
|
||||
{
|
||||
QString arg = arguments[i];
|
||||
bool argParsedAsFlag = false;
|
||||
bool foundKnownOption = false;
|
||||
|
||||
if (arg.toLower() == "-help" || arg.toLower() == "-?")
|
||||
{
|
||||
showHelp = true;
|
||||
foundKnownOption = true;
|
||||
}
|
||||
|
||||
if (arg.toLower() == "-last")
|
||||
{
|
||||
openLatestProject = true;
|
||||
argParsedAsFlag = true;
|
||||
foundKnownOption = true;
|
||||
}
|
||||
else if (arg.toLower() == "-project")
|
||||
{
|
||||
isParsingCaseNames = false;
|
||||
isParsingProjectFile = true;
|
||||
argParsedAsFlag = true;
|
||||
isParsingStartDir = false;
|
||||
|
||||
foundKnownOption = true;
|
||||
}
|
||||
else if (arg.toLower() == "-case")
|
||||
{
|
||||
isParsingCaseNames = true;
|
||||
isParsingProjectFile = false;
|
||||
argParsedAsFlag = true;
|
||||
isParsingStartDir = false;
|
||||
|
||||
foundKnownOption = true;
|
||||
}
|
||||
else if (arg.toLower() == "-startdir")
|
||||
{
|
||||
isParsingCaseNames = false;
|
||||
isParsingProjectFile = false;
|
||||
isParsingStartDir = true;
|
||||
|
||||
foundKnownOption = true;
|
||||
}
|
||||
|
||||
if (!argParsedAsFlag)
|
||||
if (!foundKnownOption)
|
||||
{
|
||||
if (isParsingProjectFile && QFile::exists(arg))
|
||||
{
|
||||
@ -633,6 +661,11 @@ bool RIApplication::parseArguments()
|
||||
{
|
||||
caseNames.append(arg);
|
||||
}
|
||||
|
||||
if (isParsingStartDir)
|
||||
{
|
||||
m_startupDefaultDirectory = arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,6 +681,8 @@ bool RIApplication::parseArguments()
|
||||
"-project <filename> Open project file <filename>\n"
|
||||
"-case <casename> Open Eclipse case <casename>\n"
|
||||
" (do not include .GRID/.EGRID)\n"
|
||||
"-startdir The default directory for open/save commands\n"
|
||||
|
||||
"-help \n"
|
||||
"-? Displays help text\n"
|
||||
"-----------------------------------------------------------------";
|
||||
@ -883,3 +918,28 @@ void RIApplication::terminateProcess()
|
||||
|
||||
m_workerProcess = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RIApplication::defaultFileDialogDirectory(const QString& dialogName)
|
||||
{
|
||||
QString defaultDirectory = m_startupDefaultDirectory;
|
||||
std::map<QString, QString>::iterator it;
|
||||
it = m_fileDialogDefaultDirectories.find(dialogName);
|
||||
|
||||
if ( it != m_fileDialogDefaultDirectories.end())
|
||||
{
|
||||
defaultDirectory = it->second;
|
||||
}
|
||||
|
||||
return defaultDirectory;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIApplication::setDefaultFileDialogDirectory(const QString& dialogName, const QString& defaultDirectory)
|
||||
{
|
||||
m_fileDialogDefaultDirectories[dialogName] = defaultDirectory;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ public:
|
||||
void createLargeResultsMockModel();
|
||||
void createInputMockModel();
|
||||
|
||||
QString defaultFileDialogDirectory(const QString& dialogName);
|
||||
void setDefaultFileDialogDirectory(const QString& dialogName, const QString& defaultDirectory);
|
||||
|
||||
bool openEclipseCaseFromFile(const QString& fileName);
|
||||
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
|
||||
bool openInputEclipseCase(const QString& caseName, const QStringList& caseFileNames);
|
||||
@ -129,4 +132,7 @@ private:
|
||||
caf::UiProcess* m_workerProcess;
|
||||
|
||||
RIPreferences* m_preferences;
|
||||
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
};
|
||||
|
@ -37,13 +37,17 @@ RIPreferences::RIPreferences(void)
|
||||
CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave", "", "", "");
|
||||
octaveExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", "");
|
||||
CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Z scale factor", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
|
||||
CAF_PDM_InitField(&showHud, "showHud", true, "Show 3D Information", "", "", "");
|
||||
CAF_PDM_InitField(&showHud, "showHud", false, "Show 3D Information", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
||||
lastUsedProjectFileName.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&autocomputeSOIL, "autocomputeSOIL", true, "Compute SOIL if not on disk", "", "", "");
|
||||
CAF_PDM_InitField(&autocomputeSOIL, "autocomputeSOIL", true, "SOIL", "", "SOIL = 1.0 - SGAS - SWAT", "");
|
||||
CAF_PDM_InitField(&autocomputeDepthRelatedProperties,"autocomputeDepth", true, "DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -69,3 +73,24 @@ void RIPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QStr
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) const
|
||||
{
|
||||
uiOrdering.add(&navigationPolicy);
|
||||
|
||||
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script configuration");
|
||||
scriptGroup->add(&scriptDirectory);
|
||||
scriptGroup->add(&scriptEditorExecutable);
|
||||
scriptGroup->add(&octaveExecutable);
|
||||
|
||||
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
|
||||
defaultSettingsGroup->add(&defaultScaleFactorZ);
|
||||
defaultSettingsGroup->add(&defaultGridLines);
|
||||
|
||||
caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Compute when loading new case");
|
||||
autoComputeGroup->add(&autocomputeSOIL);
|
||||
autoComputeGroup->add(&autocomputeDepthRelatedProperties);
|
||||
}
|
||||
|
||||
|
@ -36,14 +36,20 @@ public: // Pdm Fields
|
||||
caf::PdmField<QString> scriptEditorExecutable;
|
||||
caf::PdmField<QString> octaveExecutable;
|
||||
|
||||
caf::PdmField<int> defaultScaleFactorZ;
|
||||
caf::PdmField<bool> defaultGridLines;
|
||||
|
||||
caf::PdmField<bool> useShaders;
|
||||
caf::PdmField<bool> showHud;
|
||||
|
||||
caf::PdmField<QString> lastUsedProjectFileName;
|
||||
|
||||
caf::PdmField<bool> autocomputeSOIL;
|
||||
caf::PdmField<bool> autocomputeDepthRelatedProperties;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) const;
|
||||
};
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef USE_ECL_LIB
|
||||
#include "ecl_grid.h"
|
||||
@ -38,6 +39,8 @@
|
||||
#include <fstream>
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Constructor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,6 +66,20 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigReservoi
|
||||
{
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
qint64 coordPos = -1;
|
||||
qint64 zcornPos = -1;
|
||||
qint64 specgridPos = -1;
|
||||
qint64 actnumPos = -1;
|
||||
qint64 mapaxesPos = -1;
|
||||
|
||||
findGridKeywordPositions(fileName, &coordPos, &zcornPos, &specgridPos, &actnumPos, &mapaxesPos);
|
||||
|
||||
if (coordPos < 0 || zcornPos < 0 || specgridPos < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
FILE* gridFilePointer = util_fopen(fileName.toLatin1().data(), "r");
|
||||
if (!gridFilePointer) return false;
|
||||
|
||||
@ -74,6 +91,8 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigReservoi
|
||||
//ecl_kw_type * ecl_kw_fscanf_alloc_grdecl_dynamic__( FILE * stream , const char * kw , bool strict , ecl_type_enum ecl_type);
|
||||
//ecl_grid_type * ecl_grid_alloc_GRDECL_kw( int nx, int ny , int nz , const ecl_kw_type * zcorn_kw , const ecl_kw_type * coord_kw , const ecl_kw_type * actnum_kw , const ecl_kw_type * mapaxes_kw );
|
||||
|
||||
|
||||
|
||||
ecl_kw_type* specGridKw = NULL;
|
||||
ecl_kw_type* zCornKw = NULL;
|
||||
ecl_kw_type* coordKw = NULL;
|
||||
@ -82,19 +101,38 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigReservoi
|
||||
|
||||
// Try to read all the needed keywords. Early exit if some are not found
|
||||
caf::ProgressInfo progress(7, "Read Grid from Eclipse Input file");
|
||||
bool allKwReadOk = true;
|
||||
|
||||
allKwReadOk = allKwReadOk && NULL != (specGridKw = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , "SPECGRID" , false , ECL_INT_TYPE));
|
||||
|
||||
|
||||
bool allKwReadOk = true;
|
||||
bool continueReading = true;
|
||||
|
||||
fseek(gridFilePointer, specgridPos, SEEK_SET);
|
||||
allKwReadOk = allKwReadOk && NULL != (specGridKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_INT_TYPE));
|
||||
progress.setProgress(1);
|
||||
allKwReadOk = allKwReadOk && NULL != (zCornKw = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , "ZCORN" , false , ECL_FLOAT_TYPE));
|
||||
|
||||
fseek(gridFilePointer, zcornPos, SEEK_SET);
|
||||
allKwReadOk = allKwReadOk && NULL != (zCornKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE));
|
||||
progress.setProgress(2);
|
||||
allKwReadOk = allKwReadOk && NULL != (coordKw = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , "COORD" , false , ECL_FLOAT_TYPE));
|
||||
|
||||
fseek(gridFilePointer, coordPos, SEEK_SET);
|
||||
allKwReadOk = allKwReadOk && NULL != (coordKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE));
|
||||
progress.setProgress(3);
|
||||
allKwReadOk = allKwReadOk && NULL != (actNumKw = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , "ACTNUM" , false , ECL_INT_TYPE));
|
||||
|
||||
// If ACTNUM is not defined, this pointer will be NULL, which is a valid condition
|
||||
if (actnumPos >= 0)
|
||||
{
|
||||
fseek(gridFilePointer, actnumPos, SEEK_SET);
|
||||
allKwReadOk = allKwReadOk && NULL != (actNumKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_INT_TYPE));
|
||||
progress.setProgress(4);
|
||||
}
|
||||
|
||||
// If MAPAXES is not defined, this pointer will be NULL, which is a valid condition
|
||||
mapAxesKw = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , "MAPAXES" , false , ECL_FLOAT_TYPE);
|
||||
if (mapaxesPos >= 0)
|
||||
{
|
||||
fseek(gridFilePointer, mapaxesPos, SEEK_SET);
|
||||
mapAxesKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer, false , ECL_FLOAT_TYPE);
|
||||
}
|
||||
|
||||
if (!allKwReadOk)
|
||||
{
|
||||
@ -125,7 +163,7 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigReservoi
|
||||
ecl_kw_free(specGridKw);
|
||||
ecl_kw_free(zCornKw);
|
||||
ecl_kw_free(coordKw);
|
||||
ecl_kw_free(actNumKw);
|
||||
if (actNumKw) ecl_kw_free(actNumKw);
|
||||
if (mapAxesKw) ecl_kw_free(mapAxesKw);
|
||||
|
||||
ecl_grid_free(inputGrid);
|
||||
@ -152,7 +190,7 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
||||
caf::ProgressInfo mainProgress(2, "Reading Eclipse Input properties");
|
||||
caf::ProgressInfo startProgress(knownKeywordSet.size(), "Scanning for known properties");
|
||||
|
||||
std::vector<QString> fileKeywords = RifEclipseInputFileTools::findKeywordsOnFile(fileName);
|
||||
std::vector<RifKeywordAndFilePos> fileKeywords = RifEclipseInputFileTools::findKeywordsOnFile(fileName);
|
||||
|
||||
mainProgress.setProgress(1);
|
||||
caf::ProgressInfo progress(fileKeywords.size(), "Reading properties");
|
||||
@ -168,13 +206,14 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
||||
std::map<QString, QString> newResults;
|
||||
for (size_t i = 0; i < fileKeywords.size(); ++i)
|
||||
{
|
||||
std::cout << fileKeywords[i].toLatin1().data() << std::endl;
|
||||
if (knownKeywordSet.count(fileKeywords[i]))
|
||||
//std::cout << fileKeywords[i].keyword.toLatin1().data() << std::endl;
|
||||
if (knownKeywordSet.count(fileKeywords[i].keyword))
|
||||
{
|
||||
ecl_kw_type* eclKeyWordData = ecl_kw_fscanf_alloc_grdecl_dynamic__( gridFilePointer , fileKeywords[i].toLatin1().data() , false , ECL_FLOAT_TYPE);
|
||||
fseek(gridFilePointer, fileKeywords[i].filePos, SEEK_SET);
|
||||
ecl_kw_type* eclKeyWordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE);
|
||||
if (eclKeyWordData)
|
||||
{
|
||||
QString newResultName = reservoir->mainGrid()->results()->makeResultNameUnique(fileKeywords[i]);
|
||||
QString newResultName = reservoir->mainGrid()->results()->makeResultNameUnique(fileKeywords[i].keyword);
|
||||
|
||||
size_t resultIndex = reservoir->mainGrid()->results()->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); // Should really merge with inputProperty object information because we need to use PropertyName, and not keyword
|
||||
|
||||
@ -184,7 +223,7 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
||||
|
||||
ecl_kw_free(eclKeyWordData);
|
||||
newResults[newResultName] = fileKeywords[i];
|
||||
newResults[newResultName] = fileKeywords[i].keyword;
|
||||
}
|
||||
}
|
||||
progress.setProgress(i);
|
||||
@ -196,45 +235,47 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read all the keywords from a file
|
||||
//
|
||||
// This code was originally written using QTextStream, but due to a bug in Qt version up to 4.8.0
|
||||
// we had to implement the reading using QFile and QFile::readLine
|
||||
//
|
||||
// See:
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-9814
|
||||
//
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RifEclipseInputFileTools::findKeywordsOnFile(const QString &fileName)
|
||||
std::vector< RifKeywordAndFilePos > RifEclipseInputFileTools::findKeywordsOnFile(const QString &fileName)
|
||||
{
|
||||
std::vector<QString> keywords;
|
||||
std::vector< RifKeywordAndFilePos > keywords;
|
||||
|
||||
std::ifstream is(fileName.toLatin1().data());
|
||||
char buf[1024];
|
||||
|
||||
while (is)
|
||||
QFile data(fileName);
|
||||
data.open(QFile::ReadOnly);
|
||||
|
||||
QString line;
|
||||
qint64 filepos = -1;
|
||||
qint64 lineLength = -1;
|
||||
|
||||
do
|
||||
{
|
||||
std::string word;
|
||||
is >> word;
|
||||
if (word.size() && isalpha(word[0]))
|
||||
lineLength = data.readLine(buf, sizeof(buf));
|
||||
if (lineLength > 0)
|
||||
{
|
||||
keywords.push_back(word.c_str());
|
||||
line = QString::fromAscii(buf);
|
||||
if (line.size() && line[0].isLetter())
|
||||
{
|
||||
RifKeywordAndFilePos keyPos;
|
||||
|
||||
filepos = data.pos() - lineLength;
|
||||
keyPos.filePos = filepos;
|
||||
keyPos.keyword = line.left(8).trimmed();
|
||||
keywords.push_back(keyPos);
|
||||
//qDebug() << keyPos.keyword << " - " << keyPos.filePos;
|
||||
}
|
||||
|
||||
is.ignore(20000, '\n');
|
||||
}
|
||||
|
||||
is.close();
|
||||
|
||||
/*
|
||||
FILE* gridFilePointer = util_fopen(fileName.toLatin1().data(), "r");
|
||||
|
||||
if (!gridFilePointer) return keywords;
|
||||
|
||||
char * keyWordString = NULL;
|
||||
|
||||
keyWordString = ecl_kw_grdecl_alloc_next_header(gridFilePointer);
|
||||
|
||||
while(keyWordString)
|
||||
{
|
||||
keywords.push_back(keyWordString);
|
||||
util_realloc(keyWordString, 0, "RifEclipseInputFileTools::findKeywordsOnFile");
|
||||
keyWordString = ecl_kw_grdecl_alloc_next_header(gridFilePointer);
|
||||
}
|
||||
while (lineLength != -1);
|
||||
|
||||
util_fclose(gridFilePointer);
|
||||
*/
|
||||
return keywords;
|
||||
}
|
||||
|
||||
@ -434,3 +475,73 @@ void RifEclipseInputFileTools::writeDataToTextFile(QFile* file, const QString& e
|
||||
|
||||
out << "\n" << "/" << "\n";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseInputFileTools::findGridKeywordPositions(const QString& filename, qint64* coordPos, qint64* zcornPos, qint64* specgridPos, qint64* actnumPos, qint64* mapaxesPos)
|
||||
{
|
||||
CVF_ASSERT(coordPos && zcornPos && specgridPos && actnumPos && mapaxesPos);
|
||||
|
||||
|
||||
std::vector< RifKeywordAndFilePos > keywordsAndFilePos = findKeywordsOnFile(filename);
|
||||
size_t i;
|
||||
for (i = 0; i < keywordsAndFilePos.size(); i++)
|
||||
{
|
||||
if (keywordsAndFilePos[i].keyword == "COORD")
|
||||
{
|
||||
*coordPos = keywordsAndFilePos[i].filePos;
|
||||
}
|
||||
else if (keywordsAndFilePos[i].keyword == "ZCORN")
|
||||
{
|
||||
*zcornPos = keywordsAndFilePos[i].filePos;
|
||||
}
|
||||
else if (keywordsAndFilePos[i].keyword == "SPECGRID")
|
||||
{
|
||||
*specgridPos = keywordsAndFilePos[i].filePos;
|
||||
}
|
||||
else if (keywordsAndFilePos[i].keyword == "ACTNUM")
|
||||
{
|
||||
*actnumPos = keywordsAndFilePos[i].filePos;
|
||||
}
|
||||
else if (keywordsAndFilePos[i].keyword == "MAPAXES")
|
||||
{
|
||||
*mapaxesPos = keywordsAndFilePos[i].filePos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseInputFileTools::readPropertyAtFilePosition(const QString& fileName, RigReservoir* reservoir, const QString& eclipseKeyWord, qint64 filePos, const QString& resultName)
|
||||
{
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r");
|
||||
if (!filePointer) return false;
|
||||
|
||||
fseek(filePointer, filePos, SEEK_SET);
|
||||
ecl_kw_type* eclKeyWordData = ecl_kw_fscanf_alloc_current_grdecl__(filePointer, false , ECL_FLOAT_TYPE);
|
||||
bool isOk = false;
|
||||
if (eclKeyWordData)
|
||||
{
|
||||
QString newResultName = resultName;
|
||||
size_t resultIndex = reservoir->mainGrid()->results()->findScalarResultIndex(newResultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
resultIndex = reservoir->mainGrid()->results()->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName);
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->mainGrid()->results()->cellScalarResults(resultIndex);
|
||||
newPropertyData.resize(1);
|
||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
||||
isOk = true;
|
||||
ecl_kw_free(eclKeyWordData);
|
||||
}
|
||||
|
||||
util_fclose(filePointer);
|
||||
return isOk;
|
||||
}
|
||||
|
@ -23,10 +23,23 @@
|
||||
#include "cvfLibCore.h"
|
||||
#include <map>
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RigReservoir;
|
||||
class QString;
|
||||
class QFile;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Structure used to cache file position of keywords
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
struct RifKeywordAndFilePos
|
||||
{
|
||||
QString keyword;
|
||||
qint64 filePos;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Class for access to Eclipse "keyword" files using libecl
|
||||
@ -43,7 +56,9 @@ public:
|
||||
// Returns map of assigned resultName and Eclipse Keyword.
|
||||
static std::map<QString, QString> readProperties(const QString& fileName, RigReservoir* reservoir);
|
||||
static bool readProperty (const QString& fileName, RigReservoir* reservoir, const QString& eclipseKeyWord, const QString& resultName );
|
||||
static std::vector<QString> findKeywordsOnFile(const QString &fileName);
|
||||
static bool readPropertyAtFilePosition (const QString& fileName, RigReservoir* reservoir, const QString& eclipseKeyWord, qint64 filePos, const QString& resultName );
|
||||
|
||||
static std::vector< RifKeywordAndFilePos > findKeywordsOnFile(const QString &fileName);
|
||||
|
||||
static const std::vector<QString>& knownPropertyKeywords();
|
||||
|
||||
@ -52,4 +67,5 @@ public:
|
||||
|
||||
private:
|
||||
static void writeDataToTextFile(QFile* file, const QString& eclipseKeyWord, const std::vector<double>& resultData);
|
||||
static void findGridKeywordPositions(const QString& filename, qint64* coordPos, qint64* zcornPos, qint64* specgridPos, qint64* actnumPos, qint64* mapaxesPos);
|
||||
};
|
||||
|
@ -99,7 +99,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
|
||||
QString infoText = QString(
|
||||
"<p><b><center>-- %1 --</center></b><p> "
|
||||
"<b>Cell count:</b> Total: %2 Active: %3 <br>"
|
||||
"<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>"
|
||||
"<b>Main Grid I,J,K:</b> %4, %5, %6 <br>").arg(caseName, totCellCount, activeCellCount, iSize, jSize, kSize);
|
||||
|
||||
if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult())
|
||||
@ -108,11 +108,16 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
double mean;
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean);
|
||||
|
||||
infoText += QString("<blockquote> Min: %1 P10: %2 P90: %3 Max: %4 </blockquote>").arg(min).arg(p10).arg(p90).arg(max);
|
||||
//infoText += QString("<blockquote><b>Min:</b> %1 <b>P10:</b> %2 <b>Mean:</b> %3 <b>P90:</b> %4 <b>Max:</b> %5 </blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
//infoText += QString("<blockquote><pre>Min: %1 P10: %2 Mean: %3 \n P90: %4 Max: %5 </pre></blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
infoText += QString("<table border=0 cellspacing=5 ><tr><td>Min</td><td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
|
||||
"<tr><td>%1</td><td> %2</td><td> %3</td><td> %4</td><td> %5 </td></tr></table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
}
|
||||
|
||||
|
||||
@ -142,13 +147,16 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
{
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
double mean;
|
||||
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean);
|
||||
|
||||
m_reservoirView->viewer()->showHistogram(true);
|
||||
m_reservoirView->viewer()->setHistogram(min, max, m_reservoirView->gridCellResults()->cellScalarValuesHistogram(scalarIndex));
|
||||
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90);
|
||||
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,8 +299,6 @@ void RimCellEdgeResultSlot::updateIgnoredScalarValue()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeResultSlot::minMaxCellEdgeValues(double& min, double& max)
|
||||
{
|
||||
CVF_ASSERT(min && max);
|
||||
|
||||
double globalMin, globalMax;
|
||||
globalMin = HUGE_VAL;
|
||||
globalMax = -HUGE_VAL;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RigGridBase.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
|
||||
|
||||
@ -65,9 +66,15 @@ RimCellPropertyFilter::RimCellPropertyFilter()
|
||||
resultDefinition.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&lowerBound, "LowerBound", 0.0, "Min", "", "", "");
|
||||
lowerBound.setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||
upperBound.setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
updateIconState();
|
||||
|
||||
m_minimumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||
m_maximumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -148,6 +155,9 @@ void RimCellPropertyFilter::setDefaultValues()
|
||||
|
||||
upperBound = max;
|
||||
upperBound.setUiName(QString("Max (%1)").arg(max));
|
||||
|
||||
m_maximumResultValue = max;
|
||||
m_minimumResultValue = min;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -173,3 +183,26 @@ void RimCellPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
uiOrdering.add(&filterMode);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (m_minimumResultValue == cvf::UNDEFINED_DOUBLE || m_maximumResultValue == cvf::UNDEFINED_DOUBLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (field == &lowerBound || field == &upperBound)
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
if (!myAttr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myAttr->m_minimum = m_minimumResultValue;
|
||||
myAttr->m_maximum = m_maximumResultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,11 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) const;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
private:
|
||||
RimCellPropertyFilterCollection* m_parentContainer;
|
||||
double m_minimumResultValue, m_maximumResultValue;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "RIApplication.h"
|
||||
#include "RIPreferences.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimInputReservoir, "RimInputReservoir");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -150,8 +154,8 @@ void RimInputReservoir::openDataFileSet(const QStringList& filenames)
|
||||
bool RimInputReservoir::openEclipseGridFile()
|
||||
{
|
||||
// Early exit if reservoir data is created
|
||||
if (m_rigReservoir.notNull()) return true;
|
||||
|
||||
if (m_rigReservoir.isNull())
|
||||
{
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
|
||||
if (caseName().contains("Input Mock Debug Model"))
|
||||
@ -178,6 +182,14 @@ bool RimInputReservoir::openEclipseGridFile()
|
||||
m_rigReservoir->mainGrid()->results()->setReaderInterface(readerInterface.p());
|
||||
m_rigReservoir->computeFaults();
|
||||
m_rigReservoir->mainGrid()->computeCachedData();
|
||||
}
|
||||
|
||||
RigReservoirCellResults* results = m_rigReservoir->mainGrid()->results();
|
||||
RIApplication* app = RIApplication::instance();
|
||||
if (app->preferences()->autocomputeDepthRelatedProperties)
|
||||
{
|
||||
results->computeDepthRelatedResults();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -220,8 +232,8 @@ void RimInputReservoir::loadAndSyncronizeInputProperties()
|
||||
|
||||
if (isExistingFile)
|
||||
{
|
||||
std::vector<QString> fileKeywords = RifEclipseInputFileTools::findKeywordsOnFile(filenames[i]);
|
||||
for_all(fileKeywords, fkIt) fileKeywordSet.insert(fileKeywords[fkIt]);
|
||||
std::vector< RifKeywordAndFilePos > fileKeywords = RifEclipseInputFileTools::findKeywordsOnFile(filenames[i]);
|
||||
for_all(fileKeywords, fkIt) fileKeywordSet.insert(fileKeywords[fkIt].keyword);
|
||||
}
|
||||
|
||||
// Find the input property objects referring to the file
|
||||
|
@ -50,6 +50,7 @@ template<>
|
||||
void caf::AppEnum< RimReservoirView::MeshModeType >::setUp()
|
||||
{
|
||||
addItem(RimReservoirView::FULL_MESH, "FULL_MESH", "All");
|
||||
addItem(RimReservoirView::FAULTS_MESH, "FAULTS_MESH", "Faults only");
|
||||
addItem(RimReservoirView::NO_MESH, "NO_MESH", "None");
|
||||
setDefault(RimReservoirView::FULL_MESH);
|
||||
}
|
||||
@ -58,7 +59,7 @@ template<>
|
||||
void caf::AppEnum< RimReservoirView::SurfaceModeType >::setUp()
|
||||
{
|
||||
addItem(RimReservoirView::SURFACE, "SURFACE", "All");
|
||||
addItem(RimReservoirView::FAULTS, "FAULTS", "Faults");
|
||||
addItem(RimReservoirView::FAULTS, "FAULTS", "Faults only");
|
||||
addItem(RimReservoirView::NO_SURFACE, "NO_SURFACE", "None");
|
||||
setDefault(RimReservoirView::SURFACE);
|
||||
}
|
||||
@ -80,6 +81,10 @@ CAF_PDM_SOURCE_INIT(RimReservoirView, "ReservoirView");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReservoirView::RimReservoirView()
|
||||
{
|
||||
RIApplication* app = RIApplication::instance();
|
||||
RIPreferences* preferences = app->preferences();
|
||||
CVF_ASSERT(preferences);
|
||||
|
||||
CAF_PDM_InitObject("Reservoir View", ":/ReservoirView.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
|
||||
@ -93,7 +98,11 @@ RimReservoirView::RimReservoirView()
|
||||
overlayInfoConfig->setReservoirView(this);
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString(""), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&scaleZ, "GridZScale", 1.0, "Z Scale", "", "Scales the scene in the Z direction", "");
|
||||
|
||||
double defaultScaleFactor = 1.0;
|
||||
if (preferences) defaultScaleFactor = preferences->defaultScaleFactorZ;
|
||||
CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", "");
|
||||
|
||||
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
||||
showWindow.setUiHidden(true);
|
||||
|
||||
@ -114,7 +123,9 @@ RimReservoirView::RimReservoirView()
|
||||
propertyFilterCollection = new RimCellPropertyFilterCollection();
|
||||
propertyFilterCollection->setReservoirView(this);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&meshMode, "MeshMode", "Grid lines", "", "", "");
|
||||
caf::AppEnum<RimReservoirView::MeshModeType> defaultMeshType = NO_MESH;
|
||||
if (preferences->defaultGridLines) defaultMeshType = FULL_MESH;
|
||||
CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid lines", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid surface", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&maximumFrameRate, "MaximumFrameRate", 10, "Maximum frame rate","", "", "");
|
||||
@ -153,6 +164,7 @@ RimReservoirView::~RimReservoirView()
|
||||
|
||||
delete rangeFilterCollection();
|
||||
delete propertyFilterCollection();
|
||||
delete wellCollection();
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
@ -871,34 +883,29 @@ void RimReservoirView::updateDisplayModelVisibility()
|
||||
{
|
||||
if (m_viewer.isNull()) return;
|
||||
|
||||
bool surfaceVisible = false;
|
||||
bool faultVisible = false;
|
||||
// Initialize the mask to show everything except the the bits controlled here
|
||||
unsigned int mask = 0xffffffff & ~surfaceBit & ~faultBit & ~meshSurfaceBit & ~meshFaultBit ;
|
||||
|
||||
// Then turn the appropriate bits on according to the user settings
|
||||
|
||||
if (surfaceMode == SURFACE)
|
||||
{
|
||||
surfaceVisible = true;
|
||||
faultVisible = true;
|
||||
mask |= surfaceBit;
|
||||
mask |= faultBit;
|
||||
}
|
||||
else if (surfaceMode == FAULTS)
|
||||
{
|
||||
faultVisible = true;
|
||||
mask |= faultBit;
|
||||
}
|
||||
|
||||
unsigned int mask = 0;
|
||||
if (meshMode == FULL_MESH)
|
||||
{
|
||||
if (surfaceVisible) mask |= meshSurfaceBit;
|
||||
if (faultVisible) mask |= meshFaultBit;
|
||||
mask |= meshSurfaceBit;
|
||||
mask |= meshFaultBit;
|
||||
}
|
||||
|
||||
if (surfaceVisible)
|
||||
else if (meshMode == FAULTS_MESH)
|
||||
{
|
||||
mask |= surfaceBit;
|
||||
}
|
||||
|
||||
if (faultVisible)
|
||||
{
|
||||
mask |= faultBit;
|
||||
mask |= meshFaultBit;
|
||||
}
|
||||
|
||||
m_viewer->setEnableMask(mask);
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
enum MeshModeType
|
||||
{
|
||||
FULL_MESH,
|
||||
FAULTS_MESH,
|
||||
NO_MESH
|
||||
};
|
||||
|
||||
|
@ -201,6 +201,28 @@ bool RimUiTreeModelPdm::deleteReservoirView(const QModelIndex& itemIndex)
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeModelPdm::deleteReservoir(const QModelIndex& itemIndex)
|
||||
{
|
||||
CVF_ASSERT(itemIndex.isValid());
|
||||
|
||||
caf::PdmUiTreeItem* uiItem = getTreeItemFromIndex(itemIndex);
|
||||
CVF_ASSERT(uiItem);
|
||||
|
||||
RimReservoir* reservoir = dynamic_cast<RimReservoir*>(uiItem->dataObject().p());
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
// Remove Ui items pointing at the pdm object to delete
|
||||
removeRow(itemIndex.row(), itemIndex.parent());
|
||||
|
||||
RimProject* proj = RIApplication::instance()->project();
|
||||
proj->reservoirs().removeChildObject(reservoir);
|
||||
|
||||
delete reservoir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -419,3 +441,4 @@ void RimUiTreeModelPdm::deleteInputProperty(const QModelIndex& itemIndex)
|
||||
|
||||
delete inputProperty;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
bool deletePropertyFilter(const QModelIndex& itemIndex);
|
||||
bool deleteReservoirView(const QModelIndex& itemIndex);
|
||||
void deleteInputProperty(const QModelIndex& itemIndex);
|
||||
void deleteReservoir(const QModelIndex& itemIndex);
|
||||
|
||||
RimCellPropertyFilter* addPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||
RimCellRangeFilter* addRangeFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||
|
@ -133,13 +133,19 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Delete"), this, SLOT(slotDeleteObjectFromContainer()));
|
||||
menu.addAction(QString("Write"), this, SLOT(slotWriteInputProperty()));
|
||||
menu.addAction(QString("Save Property To File"), this, SLOT(slotWriteInputProperty()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimResultSlot*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Write"), this, SLOT(slotWriteBinaryResultAsInputProperty()));
|
||||
menu.addAction(QString("Save Property To File"), this, SLOT(slotWriteBinaryResultAsInputProperty()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimReservoir*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Close"), this, SLOT(slotCloseCase()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
}
|
||||
@ -452,7 +458,26 @@ void RimUiTreeView::slotExecuteScript()
|
||||
QString octavePath = app->octavePath();
|
||||
if (!octavePath.isEmpty())
|
||||
{
|
||||
// http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options
|
||||
|
||||
// -p path
|
||||
// Add path to the head of the search path for function files. The value of path specified on the command line
|
||||
// will override any value of OCTAVE_PATH found in the environment, but not any commands in the system or
|
||||
// user startup files that set the internal load path through one of the path functions.
|
||||
|
||||
// -q
|
||||
// Don't print the usual greeting and version message at startup.
|
||||
|
||||
|
||||
// TODO: Must rename RimCalcScript::absolutePath to absoluteFileName, as the code below is confusing
|
||||
// absolutePath() is a function in QFileInfo
|
||||
QFileInfo fi(calcScript->absolutePath());
|
||||
QString octaveFunctionSearchPath = fi.absolutePath();
|
||||
|
||||
QStringList arguments;
|
||||
arguments.append("--path");
|
||||
arguments << octaveFunctionSearchPath;
|
||||
|
||||
arguments.append("-q");
|
||||
arguments << calcScript->absolutePath();
|
||||
|
||||
@ -539,9 +564,17 @@ void RimUiTreeView::setModel(QAbstractItemModel* model)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotAddInputProperty()
|
||||
{
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Eclipse Input Property Files", NULL, "All Files (*.* *)");
|
||||
RIApplication* app = RIApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the directory to next time
|
||||
defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", defaultDir);
|
||||
|
||||
|
||||
QModelIndex index = currentIndex();
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
@ -702,3 +735,15 @@ void RimUiTreeView::slotWriteBinaryResultAsInputProperty()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotCloseCase()
|
||||
{
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
if (myModel)
|
||||
{
|
||||
myModel->deleteReservoir(currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,8 @@ private slots:
|
||||
void slotWriteInputProperty();
|
||||
void slotWriteBinaryResultAsInputProperty();
|
||||
|
||||
void slotCloseCase();
|
||||
|
||||
void slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
||||
|
||||
signals:
|
||||
|
@ -106,6 +106,11 @@ void RigReservoirCellResults::minMaxCellScalarValues(size_t scalarResultIndex, s
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (values[i] < min)
|
||||
{
|
||||
min = values[i];
|
||||
@ -172,6 +177,42 @@ void RigReservoirCellResults::p10p90CellScalarValues(size_t scalarResultIndex, d
|
||||
p90 = m_p10p90[scalarResultIndex].second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirCellResults::meanCellScalarValues(size_t scalarResultIndex, double& meanValue)
|
||||
{
|
||||
CVF_ASSERT(scalarResultIndex < resultCount());
|
||||
|
||||
// Extend array and cache vars
|
||||
|
||||
if (scalarResultIndex >= m_meanValues.size() )
|
||||
{
|
||||
m_meanValues.resize(scalarResultIndex+1, HUGE_VAL);
|
||||
}
|
||||
|
||||
if (m_meanValues[scalarResultIndex] != HUGE_VAL)
|
||||
{
|
||||
meanValue = m_meanValues[scalarResultIndex];
|
||||
return;
|
||||
}
|
||||
|
||||
double valueSum = 0.0;
|
||||
size_t count = 0;
|
||||
for (size_t tIdx = 0; tIdx < timeStepCount(scalarResultIndex); tIdx++)
|
||||
{
|
||||
std::vector<double>& values = m_cellScalarResults[scalarResultIndex][tIdx];
|
||||
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
|
||||
{
|
||||
valueSum += values[cIdx];
|
||||
}
|
||||
count += values.size();
|
||||
}
|
||||
|
||||
m_meanValues[scalarResultIndex] = valueSum/count;
|
||||
meanValue = m_meanValues[scalarResultIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -335,40 +376,190 @@ size_t RigReservoirCellResults::findScalarResultIndex(const QString& resultName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirCellResults::loadOrComputeSOIL()
|
||||
{
|
||||
size_t resultGridIndex = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
size_t soilResultGridIndex = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
|
||||
if (resultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
if (soilResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
const std::vector< std::vector<double> >* swat = NULL;
|
||||
const std::vector< std::vector<double> >* sgas = NULL;
|
||||
|
||||
size_t scalarIndexSWAT = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
size_t scalarIndexSGAS = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
|
||||
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T && scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
|
||||
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
size_t timeStepCount = m_resultInfos[scalarIndexSWAT].m_timeStepDates.size();
|
||||
resultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
m_cellScalarResults[resultGridIndex].resize(timeStepCount);
|
||||
swat = &(cellScalarResults(scalarIndexSWAT));
|
||||
}
|
||||
|
||||
const std::vector< std::vector<double> >& sgas = cellScalarResults(scalarIndexSGAS);
|
||||
const std::vector< std::vector<double> >& swat = cellScalarResults(scalarIndexSWAT);
|
||||
std::vector< std::vector<double> >& soil = cellScalarResults(resultGridIndex);
|
||||
size_t scalarIndexSGAS = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
sgas = &(cellScalarResults(scalarIndexSGAS));
|
||||
}
|
||||
|
||||
size_t resultValueCount = sgas[0].size();
|
||||
// Early exit if none of SWAT or SGAS is present
|
||||
if (scalarIndexSWAT == cvf::UNDEFINED_SIZE_T && scalarIndexSGAS == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
size_t soilResultValueCount = 0;
|
||||
size_t soilTimeStepCount = 0;
|
||||
if (swat)
|
||||
{
|
||||
soilResultValueCount = swat->at(0).size();
|
||||
soilTimeStepCount = m_resultInfos[scalarIndexSWAT].m_timeStepDates.size();
|
||||
}
|
||||
|
||||
if (sgas)
|
||||
{
|
||||
soilResultValueCount = qMax(soilResultValueCount, sgas->at(0).size());
|
||||
|
||||
size_t sgasTimeStepCount = m_resultInfos[scalarIndexSGAS].m_timeStepDates.size();
|
||||
soilTimeStepCount = qMax(soilTimeStepCount, sgasTimeStepCount);
|
||||
}
|
||||
|
||||
soilResultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
m_cellScalarResults[soilResultGridIndex].resize(soilTimeStepCount);
|
||||
|
||||
std::vector< std::vector<double> >& soil = cellScalarResults(soilResultGridIndex);
|
||||
|
||||
int timeStepIdx = 0;
|
||||
for (timeStepIdx = 0; timeStepIdx < static_cast<int>(timeStepCount); timeStepIdx++)
|
||||
for (timeStepIdx = 0; timeStepIdx < static_cast<int>(soilTimeStepCount); timeStepIdx++)
|
||||
{
|
||||
soil[timeStepIdx].resize(resultValueCount);
|
||||
soil[timeStepIdx].resize(soilResultValueCount);
|
||||
|
||||
int idx = 0;
|
||||
#pragma omp parallel for
|
||||
for (idx = 0; idx < static_cast<int>(resultValueCount); idx++)
|
||||
for (idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
|
||||
{
|
||||
soil[timeStepIdx][idx] = 1.0 - sgas[timeStepIdx][idx] - swat[timeStepIdx][idx];
|
||||
double soilValue = 1.0;
|
||||
if (sgas)
|
||||
{
|
||||
soilValue -= sgas->at(timeStepIdx)[idx];
|
||||
}
|
||||
|
||||
if (swat)
|
||||
{
|
||||
soilValue -= swat->at(timeStepIdx)[idx];
|
||||
}
|
||||
|
||||
soil[timeStepIdx][idx] = soilValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirCellResults::computeDepthRelatedResults()
|
||||
{
|
||||
size_t depthResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DEPTH");
|
||||
size_t dxResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DX");
|
||||
size_t dyResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DY");
|
||||
size_t dzResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DZ");
|
||||
size_t topsResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "TOPS");
|
||||
size_t bottomResultGridIndex = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "BOTTOM");
|
||||
|
||||
bool computeDepth = false;
|
||||
bool computeDx = false;
|
||||
bool computeDy = false;
|
||||
bool computeDz = false;
|
||||
bool computeTops = false;
|
||||
bool computeBottom = false;
|
||||
|
||||
size_t resultValueCount = m_ownerMainGrid->cells().size();
|
||||
|
||||
if (depthResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
depthResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "DEPTH", resultValueCount);
|
||||
computeDepth = true;
|
||||
}
|
||||
|
||||
if (dxResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
dxResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "DX", resultValueCount);
|
||||
computeDx = true;
|
||||
}
|
||||
|
||||
if (dyResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
dyResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "DY", resultValueCount);
|
||||
computeDy = true;
|
||||
}
|
||||
|
||||
if (dzResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
dzResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "DZ", resultValueCount);
|
||||
computeDz = true;
|
||||
}
|
||||
|
||||
if (topsResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
topsResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "TOPS", resultValueCount);
|
||||
computeTops = true;
|
||||
}
|
||||
|
||||
if (bottomResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
bottomResultGridIndex = addStaticScalarResult(RimDefines::STATIC_NATIVE, "BOTTOM", resultValueCount);
|
||||
computeBottom = true;
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& depth = cellScalarResults(depthResultGridIndex);
|
||||
std::vector< std::vector<double> >& dx = cellScalarResults(dxResultGridIndex);
|
||||
std::vector< std::vector<double> >& dy = cellScalarResults(dyResultGridIndex);
|
||||
std::vector< std::vector<double> >& dz = cellScalarResults(dzResultGridIndex);
|
||||
std::vector< std::vector<double> >& tops = cellScalarResults(topsResultGridIndex);
|
||||
std::vector< std::vector<double> >& bottom = cellScalarResults(bottomResultGridIndex);
|
||||
|
||||
bool computeValuesForActiveCellsOnly = m_ownerMainGrid->numActiveCells() > 0;
|
||||
|
||||
size_t cellIdx = 0;
|
||||
for (cellIdx = 0; cellIdx < m_ownerMainGrid->cells().size(); cellIdx++)
|
||||
{
|
||||
const RigCell& cell = m_ownerMainGrid->cells()[cellIdx];
|
||||
|
||||
if (computeValuesForActiveCellsOnly && !cell.active())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (computeDepth)
|
||||
{
|
||||
depth[0][cellIdx] = cvf::Math::abs(cell.center().z());
|
||||
}
|
||||
|
||||
if (computeDx)
|
||||
{
|
||||
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_I) - cell.faceCenter(cvf::StructGridInterface::POS_I);
|
||||
dx[0][cellIdx] = cellWidth.length();
|
||||
}
|
||||
|
||||
if (computeDy)
|
||||
{
|
||||
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_J) - cell.faceCenter(cvf::StructGridInterface::POS_J);
|
||||
dy[0][cellIdx] = cellWidth.length();
|
||||
}
|
||||
|
||||
if (computeDz)
|
||||
{
|
||||
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_K) - cell.faceCenter(cvf::StructGridInterface::POS_K);
|
||||
dz[0][cellIdx] = cellWidth.length();
|
||||
}
|
||||
|
||||
if (computeTops)
|
||||
{
|
||||
tops[0][cellIdx] = cvf::Math::abs(cell.faceCenter(cvf::StructGridInterface::NEG_K).z());
|
||||
}
|
||||
|
||||
if (computeBottom)
|
||||
{
|
||||
bottom[0][cellIdx] = cvf::Math::abs(cell.faceCenter(cvf::StructGridInterface::POS_K).z());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -558,3 +749,17 @@ void RigReservoirCellResults::clearAllResults()
|
||||
m_cellScalarResults[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a result with given type and name, and allocate one result vector for the static result values
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigReservoirCellResults::addStaticScalarResult(RimDefines::ResultCatType type, const QString& resultName, size_t resultValueCount)
|
||||
{
|
||||
size_t resultIdx = addEmptyScalarResult(type, resultName);
|
||||
|
||||
m_cellScalarResults[resultIdx].push_back(std::vector<double>());
|
||||
m_cellScalarResults[resultIdx][0].resize(resultValueCount, HUGE_VAL);
|
||||
|
||||
return resultIdx;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
void minMaxCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& min, double& max);
|
||||
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex);
|
||||
void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90);
|
||||
void meanCellScalarValues(size_t scalarResultIndex, double& meanValue);
|
||||
|
||||
// Access meta-information about the results
|
||||
size_t resultCount() const;
|
||||
@ -66,16 +67,21 @@ public:
|
||||
void clearAllResults();
|
||||
|
||||
void loadOrComputeSOIL();
|
||||
void computeDepthRelatedResults();
|
||||
|
||||
// Access the results data
|
||||
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex);
|
||||
double cellScalarResult(size_t timeStepIndex, size_t scalarResultIndex, size_t resultValueIndex);
|
||||
|
||||
private:
|
||||
size_t addStaticScalarResult(RimDefines::ResultCatType type, const QString& resultName, size_t resultValueCount);
|
||||
|
||||
private:
|
||||
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results for each timestep for each Result index (ResultVariable)
|
||||
std::vector< std::pair<double, double> > m_maxMinValues; ///< Max min values for each Result index
|
||||
std::vector< std::vector<size_t> > m_histograms; ///< Histogram for each Result Index
|
||||
std::vector< std::pair<double, double> > m_p10p90; ///< P10 and p90 values for each Result Index
|
||||
std::vector< double > m_meanValues; ///< Mean value for each Result Index
|
||||
|
||||
std::vector< std::vector< std::pair<double, double> > > m_maxMinValuesPrTs; ///< Max min values for each timestep and Result index
|
||||
|
||||
@ -125,6 +131,11 @@ public:
|
||||
CVF_ASSERT(m_histogram);
|
||||
for (size_t i = 0; i < data.size(); ++i)
|
||||
{
|
||||
if (data[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
if (maxIndex > 0) index = (size_t)(maxIndex*(data[i] - m_min)/m_range);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "RimReservoir.h"
|
||||
#include "RigReservoir.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
#include <QDebug>
|
||||
#include "RimInputProperty.h"
|
||||
#include "RimInputReservoir.h"
|
||||
#include "RimUiTreeModelPdm.h"
|
||||
@ -46,7 +45,8 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
|
||||
m_currentTimeStepToRead(0),
|
||||
m_currentReservoir(NULL),
|
||||
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_invalidActiveCellCountDetected(false)
|
||||
m_invalidActiveCellCountDetected(false),
|
||||
m_readState(ReadingCommand)
|
||||
{
|
||||
m_errorMessageDialog = new QErrorMessage(RIMainWindow::instance());
|
||||
|
||||
@ -67,7 +67,7 @@ RiaSocketServer::RiaSocketServer(QObject* parent)
|
||||
return;
|
||||
}
|
||||
|
||||
connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(onNewClientConnection()));
|
||||
connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(slotNewClientConnection()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -90,16 +90,31 @@ unsigned short RiaSocketServer::serverPort()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::onNewClientConnection()
|
||||
void RiaSocketServer::slotNewClientConnection()
|
||||
{
|
||||
// If we are currently handling a connection, just ignore the new one until the queue is empty.
|
||||
|
||||
if (m_currentClient != NULL) return;
|
||||
if (m_currentClient != NULL)
|
||||
{
|
||||
if (m_currentClient->state() == QAbstractSocket::ConnectedState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_readState == ReadingPropertyData)
|
||||
{
|
||||
readPropertyDataFromOctave();
|
||||
}
|
||||
|
||||
terminateCurrentConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the first pending connection, and set it as the current Client to handle
|
||||
|
||||
QTcpSocket *newClient = m_tcpServer->nextPendingConnection();
|
||||
|
||||
this->handleClientConnection(newClient);
|
||||
}
|
||||
|
||||
@ -124,13 +139,14 @@ void RiaSocketServer::handleClientConnection(QTcpSocket* clientToHandle)
|
||||
m_currentPropertyName = "";
|
||||
|
||||
connect(m_currentClient, SIGNAL(disconnected()), this, SLOT(slotCurrentClientDisconnected()));
|
||||
m_readState = ReadingCommand;
|
||||
|
||||
if (m_currentClient->bytesAvailable())
|
||||
{
|
||||
this->slotReadCommand();
|
||||
this->readCommandFromOctave();
|
||||
}
|
||||
|
||||
connect(m_currentClient, SIGNAL(readyRead()), this, SLOT(slotReadCommand()));
|
||||
connect(m_currentClient, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -178,7 +194,7 @@ RimReservoir* RiaSocketServer::findReservoir(const QString& caseName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::slotReadCommand()
|
||||
void RiaSocketServer::readCommandFromOctave()
|
||||
{
|
||||
QDataStream socketStream(m_currentClient);
|
||||
socketStream.setVersion(QDataStream::Qt_4_0);
|
||||
@ -210,16 +226,17 @@ void RiaSocketServer::slotReadCommand()
|
||||
|
||||
CVF_ASSERT(args.size() > 0);
|
||||
|
||||
// qDebug() << args;
|
||||
|
||||
bool isGetProperty = args[0] == "GetProperty"; // GetProperty [casename/index] PropertyName
|
||||
bool isSetProperty = args[0] == "SetProperty"; // SetProperty [casename/index] PropertyName
|
||||
bool isGetCellInfo = args[0] == "GetActiveCellInfo"; // GetActiveCellInfo [casename/index]
|
||||
bool isGetGridDim = args[0] == "GetMainGridDimensions"; // GetMainGridDimensions [casename/index]
|
||||
|
||||
|
||||
if (!(isGetProperty || isSetProperty || isGetCellInfo || isGetGridDim))
|
||||
{
|
||||
m_errorMessageDialog->showMessage(tr("ResInsight SocketServer: \n") + tr("Unknown command: %1").arg(args[0].data()));
|
||||
terminateCurrentConnection();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -307,8 +324,6 @@ void RiaSocketServer::slotReadCommand()
|
||||
quint64 timestepByteCount = (quint64)(timestepResultCount*sizeof(double));
|
||||
socketStream << timestepByteCount ;
|
||||
|
||||
// qDebug() << "Trying to read " << (quint64)(scalarResultFrames->front().size()*sizeof(double)) << "bytes of data";
|
||||
|
||||
// Then write the data.
|
||||
|
||||
for (size_t tIdx = 0; tIdx < scalarResultFrames->size(); ++tIdx)
|
||||
@ -326,8 +341,9 @@ void RiaSocketServer::slotReadCommand()
|
||||
}
|
||||
else // Set property
|
||||
{
|
||||
m_readState = ReadingPropertyData;
|
||||
|
||||
// Disconnect the socket from calling this slot again.
|
||||
m_currentClient->disconnect(SIGNAL(readyRead()));
|
||||
m_currentReservoir = reservoir;
|
||||
|
||||
if ( scalarResultFrames != NULL)
|
||||
@ -335,10 +351,8 @@ void RiaSocketServer::slotReadCommand()
|
||||
m_scalarResultsToAdd = scalarResultFrames;
|
||||
if (m_currentClient->bytesAvailable())
|
||||
{
|
||||
this->slotReadPropertyData();
|
||||
this->readPropertyDataFromOctave();
|
||||
}
|
||||
|
||||
connect(m_currentClient, SIGNAL(readyRead()), this, SLOT(slotReadPropertyData()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +416,7 @@ void RiaSocketServer::slotReadCommand()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// This method reads data from octave and puts it into the resInsight Structures
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::slotReadPropertyData()
|
||||
void RiaSocketServer::readPropertyDataFromOctave()
|
||||
{
|
||||
QDataStream socketStream(m_currentClient);
|
||||
socketStream.setVersion(QDataStream::Qt_4_0);
|
||||
@ -530,24 +544,10 @@ void RiaSocketServer::slotCurrentClientDisconnected()
|
||||
&& m_currentClient->bytesAvailable()
|
||||
&& !m_invalidActiveCellCountDetected)
|
||||
{
|
||||
this->slotReadPropertyData();
|
||||
this->readPropertyDataFromOctave();
|
||||
}
|
||||
|
||||
m_currentClient->deleteLater();
|
||||
m_currentClient = NULL;
|
||||
|
||||
// Clean up more state:
|
||||
|
||||
m_currentCommandSize = 0;
|
||||
m_scalarResultsToAdd = NULL;
|
||||
|
||||
m_timeStepCountToRead = 0;
|
||||
m_bytesPerTimeStepToRead = 0;
|
||||
m_currentTimeStepToRead = 0;
|
||||
m_currentReservoir = NULL;
|
||||
m_currentScalarIndex = cvf::UNDEFINED_SIZE_T;
|
||||
m_currentPropertyName = "";
|
||||
m_invalidActiveCellCountDetected = false;
|
||||
terminateCurrentConnection();
|
||||
|
||||
QTcpSocket *newClient = m_tcpServer->nextPendingConnection();
|
||||
|
||||
@ -556,3 +556,58 @@ void RiaSocketServer::slotCurrentClientDisconnected()
|
||||
this->handleClientConnection(newClient);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::terminateCurrentConnection()
|
||||
{
|
||||
if (m_currentClient)
|
||||
{
|
||||
m_currentClient->disconnect(SIGNAL(disconnected()));
|
||||
m_currentClient->disconnect(SIGNAL(readyRead()));
|
||||
m_currentClient->deleteLater();
|
||||
m_currentClient = NULL;
|
||||
}
|
||||
|
||||
// Clean up more state:
|
||||
|
||||
m_currentCommandSize = 0;
|
||||
m_timeStepCountToRead = 0;
|
||||
m_bytesPerTimeStepToRead = 0;
|
||||
m_currentTimeStepToRead = 0;
|
||||
m_scalarResultsToAdd = NULL;
|
||||
m_currentReservoir = NULL;
|
||||
m_currentScalarIndex = cvf::UNDEFINED_SIZE_T;
|
||||
m_currentPropertyName = "";
|
||||
m_invalidActiveCellCountDetected = false;
|
||||
|
||||
m_readState = ReadingCommand;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSocketServer::slotReadyRead()
|
||||
{
|
||||
switch (m_readState)
|
||||
{
|
||||
case ReadingCommand :
|
||||
{
|
||||
readCommandFromOctave();
|
||||
break;
|
||||
}
|
||||
|
||||
case ReadingPropertyData :
|
||||
{
|
||||
readPropertyDataFromOctave();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
CVF_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QAbstractSocket>
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
@ -28,24 +29,32 @@ class QNetworkSession;
|
||||
class QErrorMessage;
|
||||
class RimReservoir;
|
||||
|
||||
|
||||
class RiaSocketServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ReadState {ReadingCommand, ReadingPropertyData};
|
||||
|
||||
public:
|
||||
RiaSocketServer(QObject *parent = 0);
|
||||
~RiaSocketServer();
|
||||
unsigned short serverPort();
|
||||
|
||||
private slots:
|
||||
void onNewClientConnection();
|
||||
void slotReadCommand();
|
||||
void slotReadPropertyData();
|
||||
void slotNewClientConnection();
|
||||
void slotCurrentClientDisconnected();
|
||||
void slotReadyRead();
|
||||
|
||||
private:
|
||||
void readCommandFromOctave();
|
||||
void readPropertyDataFromOctave();
|
||||
|
||||
|
||||
void handleClientConnection( QTcpSocket* clientToHandle);
|
||||
RimReservoir* findReservoir(const QString &casename);
|
||||
void terminateCurrentConnection();
|
||||
|
||||
private:
|
||||
QTcpServer* m_tcpServer;
|
||||
@ -56,6 +65,7 @@ private:
|
||||
|
||||
|
||||
// Vars used for reading data from octave and adding them to the available results
|
||||
ReadState m_readState;
|
||||
quint64 m_timeStepCountToRead;
|
||||
quint64 m_bytesPerTimeStepToRead;
|
||||
size_t m_currentTimeStepToRead;
|
||||
|
@ -291,6 +291,8 @@ void RIMainWindow::createMenus()
|
||||
viewMenu->addAction(m_viewFromEast);
|
||||
viewMenu->addAction(m_viewFromBelow);
|
||||
viewMenu->addAction(m_viewFromAbove);
|
||||
viewMenu->addSeparator();
|
||||
viewMenu->addAction(m_newPropertyView);
|
||||
|
||||
connect(viewMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshViewActions()));
|
||||
|
||||
@ -300,8 +302,6 @@ void RIMainWindow::createMenus()
|
||||
debugMenu->addAction(m_mockResultsModelAction);
|
||||
debugMenu->addAction(m_mockLargeResultsModelAction);
|
||||
debugMenu->addAction(m_mockInputModelAction);
|
||||
debugMenu->addSeparator();
|
||||
debugMenu->addAction(m_newPropertyView);
|
||||
|
||||
connect(debugMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshDebugActions()));
|
||||
|
||||
@ -595,13 +595,19 @@ void RIMainWindow::slotOpenBinaryGridFiles()
|
||||
{
|
||||
if (checkForDocumentModifications())
|
||||
{
|
||||
RIApplication* app = RIApplication::instance();
|
||||
|
||||
#ifdef USE_ECL_LIB
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Open Eclipse File", NULL, "Eclipse Grid Files (*.GRID *.EGRID)");
|
||||
|
||||
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Open Eclipse File", defaultDir, "Eclipse Grid Files (*.GRID *.EGRID)");
|
||||
if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setDefaultFileDialogDirectory("BINARY_GRID", defaultDir);
|
||||
|
||||
#else
|
||||
QStringList fileNames;
|
||||
fileNames << "dummy";
|
||||
#endif
|
||||
RIApplication* app = RIApplication::instance();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < fileNames.size(); i++)
|
||||
@ -624,11 +630,15 @@ void RIMainWindow::slotOpenInputFiles()
|
||||
{
|
||||
if (checkForDocumentModifications())
|
||||
{
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Open Eclipse Input Files", NULL, "Eclipse Input Files and Input Properties (*.GRDECL *)");
|
||||
RIApplication* app = RIApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Open Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties (*.GRDECL *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
RIApplication* app = RIApplication::instance();
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
app->openInputEclipseCase("Eclipse Input Files", fileNames);
|
||||
}
|
||||
}
|
||||
@ -641,10 +651,15 @@ void RIMainWindow::slotOpenProject()
|
||||
{
|
||||
if (checkForDocumentModifications())
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open ResInsight Project", NULL, "ResInsight project (*.rip)");
|
||||
RIApplication* app = RIApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open ResInsight Project", defaultDir, "ResInsight project (*.rip)");
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
RIApplication* app = RIApplication::instance();
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("BINARY_GRID", QFileInfo(fileName).absolutePath());
|
||||
|
||||
app->loadProject(fileName);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,9 @@ RIViewer::RIViewer(const QGLFormat& format, QWidget* parent)
|
||||
m_animationProgress->setPalette(p);
|
||||
m_animationProgress->setFormat("Time Step: %v/%m");
|
||||
m_animationProgress->setTextVisible(true);
|
||||
m_animationProgress->setStyle(new QCDEStyle());
|
||||
|
||||
m_progressBarStyle = new QCDEStyle();
|
||||
m_animationProgress->setStyle(m_progressBarStyle);
|
||||
m_showAnimProgress = false;
|
||||
|
||||
// Histogram
|
||||
@ -114,6 +116,11 @@ RIViewer::~RIViewer()
|
||||
{
|
||||
m_reservoirView->showWindow = false;
|
||||
m_reservoirView->cameraPosition = m_mainCamera->viewMatrix();
|
||||
|
||||
delete m_InfoLabel;
|
||||
delete m_animationProgress;
|
||||
delete m_histogramWidget;
|
||||
delete m_progressBarStyle;
|
||||
}
|
||||
|
||||
|
||||
@ -405,6 +412,12 @@ cvf::Part* RIViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::paintOverlayItems(QPainter* painter)
|
||||
{
|
||||
// No support for overlay items using SW rendering yet.
|
||||
if (!isShadersSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int columnWidth = 200;
|
||||
int margin = 5;
|
||||
int yPos = margin;
|
||||
@ -471,9 +484,10 @@ void RIViewer::setHistogram(double min, double max, const std::vector<size_t>& h
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setHistogramPercentiles(double pmin, double pmax)
|
||||
void RIViewer::setHistogramPercentiles(double pmin, double pmax, double mean)
|
||||
{
|
||||
m_histogramWidget->setPercentiles(pmin, pmax);
|
||||
m_histogramWidget->setMean(mean);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -29,6 +29,7 @@ class RimReservoirView;
|
||||
class QLabel;
|
||||
class QProgressBar;
|
||||
class RiuSimpleHistogramWidget;
|
||||
class QCDEStyle;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -60,7 +61,7 @@ public:
|
||||
void setInfoText(QString text);
|
||||
void showHistogram(bool enable);
|
||||
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setHistogramPercentiles(double pmin, double pmax);
|
||||
void setHistogramPercentiles(double pmin, double pmax, double mean);
|
||||
|
||||
void showAnimationProgress(bool enable);
|
||||
|
||||
@ -88,6 +89,7 @@ private:
|
||||
RiuSimpleHistogramWidget* m_histogramWidget;
|
||||
bool m_showHistogram;
|
||||
|
||||
QCDEStyle* m_progressBarStyle;
|
||||
|
||||
|
||||
cvf::ref<cvf::OverlayScalarMapperLegend> m_legend1;
|
||||
|
@ -10,6 +10,8 @@ QWidget(parent, f)
|
||||
{
|
||||
m_minPercentile = HUGE_VAL;
|
||||
m_maxPercentile = HUGE_VAL;
|
||||
m_mean = HUGE_VAL;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,6 +80,14 @@ void RiuSimpleHistogramWidget::draw(QPainter *painter,int x, int y, int width, i
|
||||
painter->setPen(QColor(255, 0, 0, 200));
|
||||
painter->drawLine(xpos, y+1, xpos, y + height -1);
|
||||
}
|
||||
|
||||
// Vertical lines for percentiles
|
||||
if (m_mean != HUGE_VAL)
|
||||
{
|
||||
int xpos = xPosFromDomainValue(m_mean);
|
||||
painter->setPen(QColor(0, 0, 255, 200));
|
||||
painter->drawLine(xpos, y+1, xpos, y + height -1);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -11,6 +11,7 @@ public:
|
||||
|
||||
void setHistogramData(double min, double max, const std::vector<size_t>& histogram);
|
||||
void setPercentiles(double pmin, double pmax) {m_minPercentile = pmin; m_maxPercentile = pmax;}
|
||||
void setMean(double mean) {m_mean = mean;}
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
@ -28,6 +29,7 @@ private:
|
||||
double m_min;
|
||||
double m_minPercentile;
|
||||
double m_maxPercentile;
|
||||
double m_mean;
|
||||
size_t m_maxHistogramCount;
|
||||
|
||||
double m_width;
|
||||
|
@ -33,8 +33,8 @@ ENDIF()
|
||||
################################################################################
|
||||
|
||||
set(CMAKE_MAJOR_VERSION 0)
|
||||
set(CMAKE_MINOR_VERSION 8)
|
||||
set(CMAKE_PATCH_VERSION 7)
|
||||
set(CMAKE_MINOR_VERSION 9)
|
||||
set(CMAKE_PATCH_VERSION 0)
|
||||
|
||||
set(PRODUCTVER ${CMAKE_MAJOR_VERSION},${CMAKE_MINOR_VERSION},0,${CMAKE_PATCH_VERSION})
|
||||
set(STRPRODUCTVER ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
|
||||
|
2
ThirdParty/Ert-windows-x64/include/buffer.h
vendored
2
ThirdParty/Ert-windows-x64/include/buffer.h
vendored
@ -92,7 +92,7 @@ extern "C" {
|
||||
buffer_type * buffer_fread_alloc(const char * filename);
|
||||
void buffer_fread_realloc(buffer_type * buffer , const char * filename);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size);
|
||||
size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size);
|
||||
#endif
|
||||
|
@ -61,11 +61,15 @@ extern "C" {
|
||||
bool ecl_grid_ijk_valid(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index3(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index1A(const ecl_grid_type * ecl_grid , int active_index);
|
||||
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_kw( int nx, int ny , int nz , const ecl_kw_type * zcorn_kw , const ecl_kw_type * coord_kw , const ecl_kw_type * actnum_kw , const ecl_kw_type * mapaxes_kw );
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_data(int , int , int , const float * , const float * , const int * , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc_GRID_data(int num_coords , int nx, int ny , int nz , int coords_size , int ** coords , float ** corners , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc(const char * );
|
||||
ecl_grid_type * ecl_grid_load_case( const char * case_input );
|
||||
ecl_grid_type * ecl_grid_alloc_rectangular( int nx , int ny , int nz , double dx , double dy , double dz , const int * actnum);
|
||||
ecl_grid_type * ecl_grid_alloc_regular( int nx, int ny , int nz , const double * ivec, const double * jvec , const double * kvec , const int * actnum);
|
||||
|
||||
bool ecl_grid_exists( const char * case_input );
|
||||
char * ecl_grid_alloc_case_filename( const char * case_input );
|
||||
|
||||
@ -148,6 +152,9 @@ extern "C" {
|
||||
ecl_kw_type * ecl_grid_alloc_hostnum_kw( const ecl_grid_type * grid );
|
||||
ecl_kw_type * ecl_grid_alloc_gridhead_kw( int nx, int ny , int nz , int grid_nr);
|
||||
|
||||
void ecl_grid_ri_export( const ecl_grid_type * ecl_grid , double * ri_points);
|
||||
void ecl_grid_cell_ri_export( const ecl_grid_type * ecl_grid , int global_index , double * ri_points);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
61
ThirdParty/Ert-windows-x64/include/ecl_kw.h
vendored
61
ThirdParty/Ert-windows-x64/include/ecl_kw.h
vendored
@ -103,9 +103,6 @@ extern "C" {
|
||||
|
||||
bool ecl_kw_is_grdecl_file(FILE * );
|
||||
bool ecl_kw_is_kw_file(FILE * , bool );
|
||||
void ecl_kw_inplace_sub(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_mul(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_div(ecl_kw_type * , const ecl_kw_type * );
|
||||
|
||||
double ecl_kw_element_sum_float( const ecl_kw_type * ecl_kw );
|
||||
void ecl_kw_inplace_inv(ecl_kw_type * my_kw);
|
||||
@ -113,8 +110,6 @@ extern "C" {
|
||||
void ecl_kw_max_min(const ecl_kw_type * , void * , void *);
|
||||
void * ecl_kw_get_void_ptr(const ecl_kw_type * ecl_kw);
|
||||
|
||||
double ecl_kw_iget_as_double(const ecl_kw_type * , int );
|
||||
|
||||
ecl_kw_type * ecl_kw_buffer_alloc(buffer_type * buffer);
|
||||
void ecl_kw_buffer_store(const ecl_kw_type * ecl_kw , buffer_type * buffer);
|
||||
|
||||
@ -149,29 +144,29 @@ extern "C" {
|
||||
void ecl_kw_copy_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * src_kw);
|
||||
|
||||
bool ecl_kw_assert_binary_numeric( const ecl_kw_type * kw1, const ecl_kw_type * kw2);
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double )
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2)
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double );
|
||||
#undef ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER
|
||||
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor);
|
||||
ECL_KW_SCALE_TYPED_HEADER( int )
|
||||
ECL_KW_SCALE_TYPED_HEADER( float )
|
||||
ECL_KW_SCALE_TYPED_HEADER( double )
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor)
|
||||
ECL_KW_SCALE_TYPED_HEADER( int );
|
||||
ECL_KW_SCALE_TYPED_HEADER( float );
|
||||
ECL_KW_SCALE_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_TYPED_HEADER
|
||||
void ecl_kw_scale_float_or_double( ecl_kw_type * ecl_kw , double scale_factor );
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor);
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor)
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_TYPED_HEADER
|
||||
void ecl_kw_shift_float_or_double( ecl_kw_type * ecl_kw , double shift_value );
|
||||
|
||||
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int);
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int)
|
||||
ECL_KW_IGET_TYPED_HEADER(double);
|
||||
ECL_KW_IGET_TYPED_HEADER(float);
|
||||
ECL_KW_IGET_TYPED_HEADER(int);
|
||||
@ -179,7 +174,7 @@ extern "C" {
|
||||
bool ecl_kw_iget_bool( const ecl_kw_type * ecl_kw , int i );
|
||||
|
||||
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type );
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type )
|
||||
ECL_KW_ISET_TYPED_HEADER(double);
|
||||
ECL_KW_ISET_TYPED_HEADER(float);
|
||||
ECL_KW_ISET_TYPED_HEADER(int);
|
||||
@ -187,7 +182,7 @@ extern "C" {
|
||||
void ecl_kw_iset_bool( ecl_kw_type * ecl_kw , int i , bool bool_value);
|
||||
|
||||
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *);
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *)
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(double);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(float);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(int);
|
||||
@ -195,31 +190,31 @@ extern "C" {
|
||||
#undef ECL_KW_GET_TYPED_PTR_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value);
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value)
|
||||
ECL_KW_SET_INDEXED_HEADER( double );
|
||||
ECL_KW_SET_INDEXED_HEADER( float );
|
||||
ECL_KW_SET_INDEXED_HEADER( int );
|
||||
#undef ECL_KW_SET_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift);
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift)
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale);
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale)
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min);
|
||||
ECL_KW_MAX_MIN_HEADER( int )
|
||||
ECL_KW_MAX_MIN_HEADER( float )
|
||||
ECL_KW_MAX_MIN_HEADER( double )
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min)
|
||||
ECL_KW_MAX_MIN_HEADER( int );
|
||||
ECL_KW_MAX_MIN_HEADER( float );
|
||||
ECL_KW_MAX_MIN_HEADER( double );
|
||||
#undef ECL_KW_MAX_MIN_HEADER
|
||||
|
||||
#include <ecl_kw_grdecl.h>
|
||||
|
@ -255,6 +255,9 @@ extern "C" {
|
||||
|
||||
/* Common keywords */
|
||||
#define SPECGRID_KW "SPECGRID"
|
||||
#define SPECGRID_NX_INDEX 0
|
||||
#define SPECGRID_NY_INDEX 1
|
||||
#define SPECGRID_NZ_INDEX 2
|
||||
#define MAPAXES_KW "MAPAXES" /* Keyword used to transform from grid coordinates to
|
||||
world coordinates. */
|
||||
#define LGR_KW "LGR" /* Name of LGR; for GRID files it can contain two elements,
|
||||
|
@ -44,7 +44,8 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
ecl_smspec_install_gen_key() must be updated.
|
||||
*/
|
||||
const int_vector_type * ecl_smspec_get_index_map( const ecl_smspec_type * smspec );
|
||||
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node);
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
|
||||
void ecl_smspec_add_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node );
|
||||
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
|
||||
bool ecl_smspec_needs_num( ecl_smspec_var_type var_type );
|
||||
@ -112,7 +113,7 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_smspec_init_var( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num, const char * unit );
|
||||
void ecl_smspec_select_matching_general_var_list( const ecl_smspec_type * smspec , const char * pattern , stringlist_type * keys);
|
||||
stringlist_type * ecl_smspec_alloc_matching_general_var_list(const ecl_smspec_type * smspec , const char * pattern);
|
||||
|
||||
|
2
ThirdParty/Ert-windows-x64/include/ecl_sum.h
vendored
2
ThirdParty/Ert-windows-x64/include/ecl_sum.h
vendored
@ -173,6 +173,8 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
void ecl_sum_fwrite( const ecl_sum_type * ecl_sum );
|
||||
void ecl_sum_fwrite_smspec( const ecl_sum_type * ecl_sum );
|
||||
smspec_node_type * ecl_sum_add_var( ecl_sum_type * ecl_sum , const char * keyword , const char * wgname , int num , const char * unit , float default_value);
|
||||
smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default_value);
|
||||
void ecl_sum_init_var( ecl_sum_type * ecl_sum , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num , const char * unit);
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
|
||||
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
|
||||
|
||||
|
1
ThirdParty/Ert-windows-x64/include/matrix.h
vendored
1
ThirdParty/Ert-windows-x64/include/matrix.h
vendored
@ -131,6 +131,7 @@ typedef struct matrix_struct matrix_type;
|
||||
double matrix_trace(const matrix_type *matrix);
|
||||
double matrix_diag_std(const matrix_type * Sk,double mean);
|
||||
double matrix_det3( const matrix_type * A);
|
||||
double matrix_det4( const matrix_type * A);
|
||||
|
||||
#ifdef HAVE_ISFINITE
|
||||
bool matrix_is_finite(const matrix_type * matrix);
|
||||
|
@ -27,8 +27,6 @@ extern "C" {
|
||||
|
||||
typedef struct path_fmt_struct path_fmt_type;
|
||||
|
||||
|
||||
path_fmt_type * path_fmt_safe_cast(const void * arg);
|
||||
path_fmt_type * path_fmt_alloc_directory_fmt(const char * );
|
||||
path_fmt_type * path_fmt_alloc_path_fmt(const char * );
|
||||
path_fmt_type * path_fmt_copyc(const path_fmt_type *);
|
||||
@ -36,6 +34,7 @@ path_fmt_type * path_fmt_scanf_alloc(const char * , int , const node_ctype * ,
|
||||
char * path_fmt_alloc_path(const path_fmt_type * , bool , ...);
|
||||
char * path_fmt_alloc_file(const path_fmt_type * , bool , ...);
|
||||
void path_fmt_free(path_fmt_type * );
|
||||
void path_fmt_free__( void * arg );
|
||||
const char * path_fmt_get_fmt(const path_fmt_type * );
|
||||
void path_fmt_reset_fmt(path_fmt_type * , const char * );
|
||||
void path_fmt_make_path(const path_fmt_type * );
|
||||
|
16
ThirdParty/Ert-windows-x64/include/smspec_node.h
vendored
16
ThirdParty/Ert-windows-x64/include/smspec_node.h
vendored
@ -68,6 +68,15 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
char * smspec_alloc_local_completion_key( const char * join_string, const char * keyword , const char * lgr_name , const char * wgname , int i , int j , int k);
|
||||
|
||||
|
||||
bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num);
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
@ -87,6 +96,7 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
int param_index,
|
||||
float default_value);
|
||||
|
||||
smspec_node_type * smspec_node_alloc_new(int params_index, float default_value);
|
||||
|
||||
void smspec_node_free( smspec_node_type * index );
|
||||
void smspec_node_free__(void * arg);
|
||||
@ -100,12 +110,16 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
void smspec_node_update_wgname( smspec_node_type * index , const char * wgname , const char * key_join_string);
|
||||
const char * smspec_node_get_keyword( const smspec_node_type * smspec_node);
|
||||
const char * smspec_node_get_unit( const smspec_node_type * smspec_node);
|
||||
void smspec_node_set_unit( smspec_node_type * smspec_node , const char * unit );
|
||||
bool smspec_node_is_rate( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_is_total( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_need_nums( const smspec_node_type * smspec_node );
|
||||
float smspec_node_get_default_value( const smspec_node_type * smspec_node );
|
||||
void smspec_node_fprintf( const smspec_node_type * smspec_node , FILE * stream);
|
||||
|
||||
void smspec_node_set_default( smspec_node_type * smspec_node , float default_value);
|
||||
float smspec_node_get_default( const smspec_node_type * smspec_node);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -18,8 +18,8 @@
|
||||
#ifndef __THREAD_POOL_H__
|
||||
#define __THREAD_POOL_H__
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define HAVE_THREAD_POOL
|
||||
#ifdef WITH_PTHREAD
|
||||
#define WITH_THREAD_POOL
|
||||
#include "thread_pool_posix.h"
|
||||
#endif
|
||||
|
||||
|
2
ThirdParty/Ert-windows-x64/include/util.h
vendored
2
ThirdParty/Ert-windows-x64/include/util.h
vendored
@ -405,7 +405,7 @@ const char * util_enum_iget( int index , int size , const util_enum_element_type
|
||||
/*****************************************************************/
|
||||
/* Conditional section below here */
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
void util_compress_buffer(const void * , int , void * , unsigned long * );
|
||||
int util_fread_sizeof_compressed(FILE * stream);
|
||||
void util_fread_compressed(void * , FILE * );
|
||||
|
4
ThirdParty/Ert-windows-x64/include/vector.h
vendored
4
ThirdParty/Ert-windows-x64/include/vector.h
vendored
@ -23,6 +23,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <node_data.h>
|
||||
#include <type_macros.h>
|
||||
|
||||
typedef void ( vector_func_type ) (void * , void *);
|
||||
typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
@ -30,8 +31,8 @@ typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
typedef struct vector_struct vector_type;
|
||||
|
||||
|
||||
|
||||
vector_type * vector_alloc_new();
|
||||
void vector_grow_NULL( vector_type * vector , int new_size );
|
||||
vector_type * vector_alloc_NULL_initialized( int size );
|
||||
|
||||
int vector_append_ref( vector_type * , const void *);
|
||||
@ -77,6 +78,7 @@ vector_type * vector_alloc_copy(const vector_type * src , bool deep_copy);
|
||||
|
||||
void vector_iset_buffer(vector_type * vector , int index , const void * buffer, int buffer_size);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( vector );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
BIN
ThirdParty/Ert-windows-x64/lib/ecl.lib
vendored
BIN
ThirdParty/Ert-windows-x64/lib/ecl.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows-x64/lib/ert_util.lib
vendored
BIN
ThirdParty/Ert-windows-x64/lib/ert_util.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows-x64/lib/geometry.lib
vendored
BIN
ThirdParty/Ert-windows-x64/lib/geometry.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows-x64/lib/well.lib
vendored
BIN
ThirdParty/Ert-windows-x64/lib/well.lib
vendored
Binary file not shown.
2
ThirdParty/Ert-windows/include/buffer.h
vendored
2
ThirdParty/Ert-windows/include/buffer.h
vendored
@ -92,7 +92,7 @@ extern "C" {
|
||||
buffer_type * buffer_fread_alloc(const char * filename);
|
||||
void buffer_fread_realloc(buffer_type * buffer , const char * filename);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size);
|
||||
size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size);
|
||||
#endif
|
||||
|
7
ThirdParty/Ert-windows/include/ecl_grid.h
vendored
7
ThirdParty/Ert-windows/include/ecl_grid.h
vendored
@ -61,11 +61,15 @@ extern "C" {
|
||||
bool ecl_grid_ijk_valid(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index3(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index1A(const ecl_grid_type * ecl_grid , int active_index);
|
||||
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_kw( int nx, int ny , int nz , const ecl_kw_type * zcorn_kw , const ecl_kw_type * coord_kw , const ecl_kw_type * actnum_kw , const ecl_kw_type * mapaxes_kw );
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_data(int , int , int , const float * , const float * , const int * , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc_GRID_data(int num_coords , int nx, int ny , int nz , int coords_size , int ** coords , float ** corners , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc(const char * );
|
||||
ecl_grid_type * ecl_grid_load_case( const char * case_input );
|
||||
ecl_grid_type * ecl_grid_alloc_rectangular( int nx , int ny , int nz , double dx , double dy , double dz , const int * actnum);
|
||||
ecl_grid_type * ecl_grid_alloc_regular( int nx, int ny , int nz , const double * ivec, const double * jvec , const double * kvec , const int * actnum);
|
||||
|
||||
bool ecl_grid_exists( const char * case_input );
|
||||
char * ecl_grid_alloc_case_filename( const char * case_input );
|
||||
|
||||
@ -148,6 +152,9 @@ extern "C" {
|
||||
ecl_kw_type * ecl_grid_alloc_hostnum_kw( const ecl_grid_type * grid );
|
||||
ecl_kw_type * ecl_grid_alloc_gridhead_kw( int nx, int ny , int nz , int grid_nr);
|
||||
|
||||
void ecl_grid_ri_export( const ecl_grid_type * ecl_grid , double * ri_points);
|
||||
void ecl_grid_cell_ri_export( const ecl_grid_type * ecl_grid , int global_index , double * ri_points);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
61
ThirdParty/Ert-windows/include/ecl_kw.h
vendored
61
ThirdParty/Ert-windows/include/ecl_kw.h
vendored
@ -103,9 +103,6 @@ extern "C" {
|
||||
|
||||
bool ecl_kw_is_grdecl_file(FILE * );
|
||||
bool ecl_kw_is_kw_file(FILE * , bool );
|
||||
void ecl_kw_inplace_sub(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_mul(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_div(ecl_kw_type * , const ecl_kw_type * );
|
||||
|
||||
double ecl_kw_element_sum_float( const ecl_kw_type * ecl_kw );
|
||||
void ecl_kw_inplace_inv(ecl_kw_type * my_kw);
|
||||
@ -113,8 +110,6 @@ extern "C" {
|
||||
void ecl_kw_max_min(const ecl_kw_type * , void * , void *);
|
||||
void * ecl_kw_get_void_ptr(const ecl_kw_type * ecl_kw);
|
||||
|
||||
double ecl_kw_iget_as_double(const ecl_kw_type * , int );
|
||||
|
||||
ecl_kw_type * ecl_kw_buffer_alloc(buffer_type * buffer);
|
||||
void ecl_kw_buffer_store(const ecl_kw_type * ecl_kw , buffer_type * buffer);
|
||||
|
||||
@ -149,29 +144,29 @@ extern "C" {
|
||||
void ecl_kw_copy_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * src_kw);
|
||||
|
||||
bool ecl_kw_assert_binary_numeric( const ecl_kw_type * kw1, const ecl_kw_type * kw2);
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double )
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2)
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double );
|
||||
#undef ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER
|
||||
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor);
|
||||
ECL_KW_SCALE_TYPED_HEADER( int )
|
||||
ECL_KW_SCALE_TYPED_HEADER( float )
|
||||
ECL_KW_SCALE_TYPED_HEADER( double )
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor)
|
||||
ECL_KW_SCALE_TYPED_HEADER( int );
|
||||
ECL_KW_SCALE_TYPED_HEADER( float );
|
||||
ECL_KW_SCALE_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_TYPED_HEADER
|
||||
void ecl_kw_scale_float_or_double( ecl_kw_type * ecl_kw , double scale_factor );
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor);
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor)
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_TYPED_HEADER
|
||||
void ecl_kw_shift_float_or_double( ecl_kw_type * ecl_kw , double shift_value );
|
||||
|
||||
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int);
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int)
|
||||
ECL_KW_IGET_TYPED_HEADER(double);
|
||||
ECL_KW_IGET_TYPED_HEADER(float);
|
||||
ECL_KW_IGET_TYPED_HEADER(int);
|
||||
@ -179,7 +174,7 @@ extern "C" {
|
||||
bool ecl_kw_iget_bool( const ecl_kw_type * ecl_kw , int i );
|
||||
|
||||
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type );
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type )
|
||||
ECL_KW_ISET_TYPED_HEADER(double);
|
||||
ECL_KW_ISET_TYPED_HEADER(float);
|
||||
ECL_KW_ISET_TYPED_HEADER(int);
|
||||
@ -187,7 +182,7 @@ extern "C" {
|
||||
void ecl_kw_iset_bool( ecl_kw_type * ecl_kw , int i , bool bool_value);
|
||||
|
||||
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *);
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *)
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(double);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(float);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(int);
|
||||
@ -195,31 +190,31 @@ extern "C" {
|
||||
#undef ECL_KW_GET_TYPED_PTR_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value);
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value)
|
||||
ECL_KW_SET_INDEXED_HEADER( double );
|
||||
ECL_KW_SET_INDEXED_HEADER( float );
|
||||
ECL_KW_SET_INDEXED_HEADER( int );
|
||||
#undef ECL_KW_SET_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift);
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift)
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale);
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale)
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min);
|
||||
ECL_KW_MAX_MIN_HEADER( int )
|
||||
ECL_KW_MAX_MIN_HEADER( float )
|
||||
ECL_KW_MAX_MIN_HEADER( double )
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min)
|
||||
ECL_KW_MAX_MIN_HEADER( int );
|
||||
ECL_KW_MAX_MIN_HEADER( float );
|
||||
ECL_KW_MAX_MIN_HEADER( double );
|
||||
#undef ECL_KW_MAX_MIN_HEADER
|
||||
|
||||
#include <ecl_kw_grdecl.h>
|
||||
|
@ -255,6 +255,9 @@ extern "C" {
|
||||
|
||||
/* Common keywords */
|
||||
#define SPECGRID_KW "SPECGRID"
|
||||
#define SPECGRID_NX_INDEX 0
|
||||
#define SPECGRID_NY_INDEX 1
|
||||
#define SPECGRID_NZ_INDEX 2
|
||||
#define MAPAXES_KW "MAPAXES" /* Keyword used to transform from grid coordinates to
|
||||
world coordinates. */
|
||||
#define LGR_KW "LGR" /* Name of LGR; for GRID files it can contain two elements,
|
||||
|
5
ThirdParty/Ert-windows/include/ecl_smspec.h
vendored
5
ThirdParty/Ert-windows/include/ecl_smspec.h
vendored
@ -44,7 +44,8 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
ecl_smspec_install_gen_key() must be updated.
|
||||
*/
|
||||
const int_vector_type * ecl_smspec_get_index_map( const ecl_smspec_type * smspec );
|
||||
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node);
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
|
||||
void ecl_smspec_add_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node );
|
||||
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
|
||||
bool ecl_smspec_needs_num( ecl_smspec_var_type var_type );
|
||||
@ -112,7 +113,7 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_smspec_init_var( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num, const char * unit );
|
||||
void ecl_smspec_select_matching_general_var_list( const ecl_smspec_type * smspec , const char * pattern , stringlist_type * keys);
|
||||
stringlist_type * ecl_smspec_alloc_matching_general_var_list(const ecl_smspec_type * smspec , const char * pattern);
|
||||
|
||||
|
2
ThirdParty/Ert-windows/include/ecl_sum.h
vendored
2
ThirdParty/Ert-windows/include/ecl_sum.h
vendored
@ -173,6 +173,8 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
void ecl_sum_fwrite( const ecl_sum_type * ecl_sum );
|
||||
void ecl_sum_fwrite_smspec( const ecl_sum_type * ecl_sum );
|
||||
smspec_node_type * ecl_sum_add_var( ecl_sum_type * ecl_sum , const char * keyword , const char * wgname , int num , const char * unit , float default_value);
|
||||
smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default_value);
|
||||
void ecl_sum_init_var( ecl_sum_type * ecl_sum , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num , const char * unit);
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
|
||||
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
|
||||
|
||||
|
1
ThirdParty/Ert-windows/include/matrix.h
vendored
1
ThirdParty/Ert-windows/include/matrix.h
vendored
@ -131,6 +131,7 @@ typedef struct matrix_struct matrix_type;
|
||||
double matrix_trace(const matrix_type *matrix);
|
||||
double matrix_diag_std(const matrix_type * Sk,double mean);
|
||||
double matrix_det3( const matrix_type * A);
|
||||
double matrix_det4( const matrix_type * A);
|
||||
|
||||
#ifdef HAVE_ISFINITE
|
||||
bool matrix_is_finite(const matrix_type * matrix);
|
||||
|
3
ThirdParty/Ert-windows/include/path_fmt.h
vendored
3
ThirdParty/Ert-windows/include/path_fmt.h
vendored
@ -27,8 +27,6 @@ extern "C" {
|
||||
|
||||
typedef struct path_fmt_struct path_fmt_type;
|
||||
|
||||
|
||||
path_fmt_type * path_fmt_safe_cast(const void * arg);
|
||||
path_fmt_type * path_fmt_alloc_directory_fmt(const char * );
|
||||
path_fmt_type * path_fmt_alloc_path_fmt(const char * );
|
||||
path_fmt_type * path_fmt_copyc(const path_fmt_type *);
|
||||
@ -36,6 +34,7 @@ path_fmt_type * path_fmt_scanf_alloc(const char * , int , const node_ctype * ,
|
||||
char * path_fmt_alloc_path(const path_fmt_type * , bool , ...);
|
||||
char * path_fmt_alloc_file(const path_fmt_type * , bool , ...);
|
||||
void path_fmt_free(path_fmt_type * );
|
||||
void path_fmt_free__( void * arg );
|
||||
const char * path_fmt_get_fmt(const path_fmt_type * );
|
||||
void path_fmt_reset_fmt(path_fmt_type * , const char * );
|
||||
void path_fmt_make_path(const path_fmt_type * );
|
||||
|
16
ThirdParty/Ert-windows/include/smspec_node.h
vendored
16
ThirdParty/Ert-windows/include/smspec_node.h
vendored
@ -68,6 +68,15 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
char * smspec_alloc_local_completion_key( const char * join_string, const char * keyword , const char * lgr_name , const char * wgname , int i , int j , int k);
|
||||
|
||||
|
||||
bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num);
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
@ -87,6 +96,7 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
int param_index,
|
||||
float default_value);
|
||||
|
||||
smspec_node_type * smspec_node_alloc_new(int params_index, float default_value);
|
||||
|
||||
void smspec_node_free( smspec_node_type * index );
|
||||
void smspec_node_free__(void * arg);
|
||||
@ -100,12 +110,16 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
void smspec_node_update_wgname( smspec_node_type * index , const char * wgname , const char * key_join_string);
|
||||
const char * smspec_node_get_keyword( const smspec_node_type * smspec_node);
|
||||
const char * smspec_node_get_unit( const smspec_node_type * smspec_node);
|
||||
void smspec_node_set_unit( smspec_node_type * smspec_node , const char * unit );
|
||||
bool smspec_node_is_rate( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_is_total( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_need_nums( const smspec_node_type * smspec_node );
|
||||
float smspec_node_get_default_value( const smspec_node_type * smspec_node );
|
||||
void smspec_node_fprintf( const smspec_node_type * smspec_node , FILE * stream);
|
||||
|
||||
void smspec_node_set_default( smspec_node_type * smspec_node , float default_value);
|
||||
float smspec_node_get_default( const smspec_node_type * smspec_node);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
4
ThirdParty/Ert-windows/include/thread_pool.h
vendored
4
ThirdParty/Ert-windows/include/thread_pool.h
vendored
@ -18,8 +18,8 @@
|
||||
#ifndef __THREAD_POOL_H__
|
||||
#define __THREAD_POOL_H__
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define HAVE_THREAD_POOL
|
||||
#ifdef WITH_PTHREAD
|
||||
#define WITH_THREAD_POOL
|
||||
#include "thread_pool_posix.h"
|
||||
#endif
|
||||
|
||||
|
2
ThirdParty/Ert-windows/include/util.h
vendored
2
ThirdParty/Ert-windows/include/util.h
vendored
@ -405,7 +405,7 @@ const char * util_enum_iget( int index , int size , const util_enum_element_type
|
||||
/*****************************************************************/
|
||||
/* Conditional section below here */
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
void util_compress_buffer(const void * , int , void * , unsigned long * );
|
||||
int util_fread_sizeof_compressed(FILE * stream);
|
||||
void util_fread_compressed(void * , FILE * );
|
||||
|
4
ThirdParty/Ert-windows/include/vector.h
vendored
4
ThirdParty/Ert-windows/include/vector.h
vendored
@ -23,6 +23,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <node_data.h>
|
||||
#include <type_macros.h>
|
||||
|
||||
typedef void ( vector_func_type ) (void * , void *);
|
||||
typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
@ -30,8 +31,8 @@ typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
typedef struct vector_struct vector_type;
|
||||
|
||||
|
||||
|
||||
vector_type * vector_alloc_new();
|
||||
void vector_grow_NULL( vector_type * vector , int new_size );
|
||||
vector_type * vector_alloc_NULL_initialized( int size );
|
||||
|
||||
int vector_append_ref( vector_type * , const void *);
|
||||
@ -77,6 +78,7 @@ vector_type * vector_alloc_copy(const vector_type * src , bool deep_copy);
|
||||
|
||||
void vector_iset_buffer(vector_type * vector , int index , const void * buffer, int buffer_size);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( vector );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
BIN
ThirdParty/Ert-windows/lib/ecl.lib
vendored
BIN
ThirdParty/Ert-windows/lib/ecl.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows/lib/ert_util.lib
vendored
BIN
ThirdParty/Ert-windows/lib/ert_util.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows/lib/geometry.lib
vendored
BIN
ThirdParty/Ert-windows/lib/geometry.lib
vendored
Binary file not shown.
BIN
ThirdParty/Ert-windows/lib/well.lib
vendored
BIN
ThirdParty/Ert-windows/lib/well.lib
vendored
Binary file not shown.
2
ThirdParty/Ert/include/buffer.h
vendored
2
ThirdParty/Ert/include/buffer.h
vendored
@ -92,7 +92,7 @@ extern "C" {
|
||||
buffer_type * buffer_fread_alloc(const char * filename);
|
||||
void buffer_fread_realloc(buffer_type * buffer , const char * filename);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size);
|
||||
size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size);
|
||||
#endif
|
||||
|
7
ThirdParty/Ert/include/ecl_grid.h
vendored
7
ThirdParty/Ert/include/ecl_grid.h
vendored
@ -61,11 +61,15 @@ extern "C" {
|
||||
bool ecl_grid_ijk_valid(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index3(const ecl_grid_type * , int , int , int );
|
||||
int ecl_grid_get_global_index1A(const ecl_grid_type * ecl_grid , int active_index);
|
||||
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_kw( int nx, int ny , int nz , const ecl_kw_type * zcorn_kw , const ecl_kw_type * coord_kw , const ecl_kw_type * actnum_kw , const ecl_kw_type * mapaxes_kw );
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_data(int , int , int , const float * , const float * , const int * , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc_GRID_data(int num_coords , int nx, int ny , int nz , int coords_size , int ** coords , float ** corners , const float * mapaxes);
|
||||
ecl_grid_type * ecl_grid_alloc(const char * );
|
||||
ecl_grid_type * ecl_grid_load_case( const char * case_input );
|
||||
ecl_grid_type * ecl_grid_alloc_rectangular( int nx , int ny , int nz , double dx , double dy , double dz , const int * actnum);
|
||||
ecl_grid_type * ecl_grid_alloc_regular( int nx, int ny , int nz , const double * ivec, const double * jvec , const double * kvec , const int * actnum);
|
||||
|
||||
bool ecl_grid_exists( const char * case_input );
|
||||
char * ecl_grid_alloc_case_filename( const char * case_input );
|
||||
|
||||
@ -148,6 +152,9 @@ extern "C" {
|
||||
ecl_kw_type * ecl_grid_alloc_hostnum_kw( const ecl_grid_type * grid );
|
||||
ecl_kw_type * ecl_grid_alloc_gridhead_kw( int nx, int ny , int nz , int grid_nr);
|
||||
|
||||
void ecl_grid_ri_export( const ecl_grid_type * ecl_grid , double * ri_points);
|
||||
void ecl_grid_cell_ri_export( const ecl_grid_type * ecl_grid , int global_index , double * ri_points);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
61
ThirdParty/Ert/include/ecl_kw.h
vendored
61
ThirdParty/Ert/include/ecl_kw.h
vendored
@ -103,9 +103,6 @@ extern "C" {
|
||||
|
||||
bool ecl_kw_is_grdecl_file(FILE * );
|
||||
bool ecl_kw_is_kw_file(FILE * , bool );
|
||||
void ecl_kw_inplace_sub(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_mul(ecl_kw_type * , const ecl_kw_type * );
|
||||
void ecl_kw_inplace_div(ecl_kw_type * , const ecl_kw_type * );
|
||||
|
||||
double ecl_kw_element_sum_float( const ecl_kw_type * ecl_kw );
|
||||
void ecl_kw_inplace_inv(ecl_kw_type * my_kw);
|
||||
@ -113,8 +110,6 @@ extern "C" {
|
||||
void ecl_kw_max_min(const ecl_kw_type * , void * , void *);
|
||||
void * ecl_kw_get_void_ptr(const ecl_kw_type * ecl_kw);
|
||||
|
||||
double ecl_kw_iget_as_double(const ecl_kw_type * , int );
|
||||
|
||||
ecl_kw_type * ecl_kw_buffer_alloc(buffer_type * buffer);
|
||||
void ecl_kw_buffer_store(const ecl_kw_type * ecl_kw , buffer_type * buffer);
|
||||
|
||||
@ -149,29 +144,29 @@ extern "C" {
|
||||
void ecl_kw_copy_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * src_kw);
|
||||
|
||||
bool ecl_kw_assert_binary_numeric( const ecl_kw_type * kw1, const ecl_kw_type * kw2);
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float )
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double )
|
||||
#define ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( ctype ) bool ecl_kw_assert_binary_ ## ctype( const ecl_kw_type * kw1 , const ecl_kw_type * kw2)
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( int );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( float );
|
||||
ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER( double );
|
||||
#undef ECL_KW_ASSERT_TYPED_BINARY_OP_HEADER
|
||||
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor);
|
||||
ECL_KW_SCALE_TYPED_HEADER( int )
|
||||
ECL_KW_SCALE_TYPED_HEADER( float )
|
||||
ECL_KW_SCALE_TYPED_HEADER( double )
|
||||
#define ECL_KW_SCALE_TYPED_HEADER( ctype ) void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor)
|
||||
ECL_KW_SCALE_TYPED_HEADER( int );
|
||||
ECL_KW_SCALE_TYPED_HEADER( float );
|
||||
ECL_KW_SCALE_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_TYPED_HEADER
|
||||
void ecl_kw_scale_float_or_double( ecl_kw_type * ecl_kw , double scale_factor );
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor);
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float )
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_TYPED_HEADER( ctype ) void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_factor)
|
||||
ECL_KW_SHIFT_TYPED_HEADER( int );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( float );
|
||||
ECL_KW_SHIFT_TYPED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_TYPED_HEADER
|
||||
void ecl_kw_shift_float_or_double( ecl_kw_type * ecl_kw , double shift_value );
|
||||
|
||||
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int);
|
||||
#define ECL_KW_IGET_TYPED_HEADER(type) type ecl_kw_iget_ ## type(const ecl_kw_type * , int)
|
||||
ECL_KW_IGET_TYPED_HEADER(double);
|
||||
ECL_KW_IGET_TYPED_HEADER(float);
|
||||
ECL_KW_IGET_TYPED_HEADER(int);
|
||||
@ -179,7 +174,7 @@ extern "C" {
|
||||
bool ecl_kw_iget_bool( const ecl_kw_type * ecl_kw , int i );
|
||||
|
||||
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type );
|
||||
#define ECL_KW_ISET_TYPED_HEADER(type) void ecl_kw_iset_ ## type(ecl_kw_type * , int , type )
|
||||
ECL_KW_ISET_TYPED_HEADER(double);
|
||||
ECL_KW_ISET_TYPED_HEADER(float);
|
||||
ECL_KW_ISET_TYPED_HEADER(int);
|
||||
@ -187,7 +182,7 @@ extern "C" {
|
||||
void ecl_kw_iset_bool( ecl_kw_type * ecl_kw , int i , bool bool_value);
|
||||
|
||||
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *);
|
||||
#define ECL_KW_GET_TYPED_PTR_HEADER(type) type * ecl_kw_get_ ## type ## _ptr(const ecl_kw_type *)
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(double);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(float);
|
||||
ECL_KW_GET_TYPED_PTR_HEADER(int);
|
||||
@ -195,31 +190,31 @@ extern "C" {
|
||||
#undef ECL_KW_GET_TYPED_PTR_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value);
|
||||
#define ECL_KW_SET_INDEXED_HEADER(ctype ) void ecl_kw_set_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype value)
|
||||
ECL_KW_SET_INDEXED_HEADER( double );
|
||||
ECL_KW_SET_INDEXED_HEADER( float );
|
||||
ECL_KW_SET_INDEXED_HEADER( int );
|
||||
#undef ECL_KW_SET_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift);
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float )
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SHIFT_INDEXED_HEADER(ctype) void ecl_kw_shift_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype shift)
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( int );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( float );
|
||||
ECL_KW_SHIFT_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SHIFT_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale);
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float )
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double )
|
||||
#define ECL_KW_SCALE_INDEXED_HEADER(ctype) void ecl_kw_scale_indexed_ ## ctype( ecl_kw_type * ecl_kw, const int_vector_type * index_list , ctype scale)
|
||||
ECL_KW_SCALE_INDEXED_HEADER( int );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( float );
|
||||
ECL_KW_SCALE_INDEXED_HEADER( double );
|
||||
#undef ECL_KW_SCALE_INDEXED_HEADER
|
||||
|
||||
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min);
|
||||
ECL_KW_MAX_MIN_HEADER( int )
|
||||
ECL_KW_MAX_MIN_HEADER( float )
|
||||
ECL_KW_MAX_MIN_HEADER( double )
|
||||
#define ECL_KW_MAX_MIN_HEADER( ctype ) void ecl_kw_max_min_ ## ctype( const ecl_kw_type * ecl_kw , ctype * _max , ctype * _min)
|
||||
ECL_KW_MAX_MIN_HEADER( int );
|
||||
ECL_KW_MAX_MIN_HEADER( float );
|
||||
ECL_KW_MAX_MIN_HEADER( double );
|
||||
#undef ECL_KW_MAX_MIN_HEADER
|
||||
|
||||
#include <ecl_kw_grdecl.h>
|
||||
|
3
ThirdParty/Ert/include/ecl_kw_magic.h
vendored
3
ThirdParty/Ert/include/ecl_kw_magic.h
vendored
@ -255,6 +255,9 @@ extern "C" {
|
||||
|
||||
/* Common keywords */
|
||||
#define SPECGRID_KW "SPECGRID"
|
||||
#define SPECGRID_NX_INDEX 0
|
||||
#define SPECGRID_NY_INDEX 1
|
||||
#define SPECGRID_NZ_INDEX 2
|
||||
#define MAPAXES_KW "MAPAXES" /* Keyword used to transform from grid coordinates to
|
||||
world coordinates. */
|
||||
#define LGR_KW "LGR" /* Name of LGR; for GRID files it can contain two elements,
|
||||
|
5
ThirdParty/Ert/include/ecl_smspec.h
vendored
5
ThirdParty/Ert/include/ecl_smspec.h
vendored
@ -44,7 +44,8 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
ecl_smspec_install_gen_key() must be updated.
|
||||
*/
|
||||
const int_vector_type * ecl_smspec_get_index_map( const ecl_smspec_type * smspec );
|
||||
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node);
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
|
||||
void ecl_smspec_add_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node );
|
||||
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
|
||||
bool ecl_smspec_needs_num( ecl_smspec_var_type var_type );
|
||||
@ -112,7 +113,7 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_smspec_init_var( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num, const char * unit );
|
||||
void ecl_smspec_select_matching_general_var_list( const ecl_smspec_type * smspec , const char * pattern , stringlist_type * keys);
|
||||
stringlist_type * ecl_smspec_alloc_matching_general_var_list(const ecl_smspec_type * smspec , const char * pattern);
|
||||
|
||||
|
2
ThirdParty/Ert/include/ecl_sum.h
vendored
2
ThirdParty/Ert/include/ecl_sum.h
vendored
@ -173,6 +173,8 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
void ecl_sum_fwrite( const ecl_sum_type * ecl_sum );
|
||||
void ecl_sum_fwrite_smspec( const ecl_sum_type * ecl_sum );
|
||||
smspec_node_type * ecl_sum_add_var( ecl_sum_type * ecl_sum , const char * keyword , const char * wgname , int num , const char * unit , float default_value);
|
||||
smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default_value);
|
||||
void ecl_sum_init_var( ecl_sum_type * ecl_sum , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num , const char * unit);
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
|
||||
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
|
||||
|
||||
|
1
ThirdParty/Ert/include/matrix.h
vendored
1
ThirdParty/Ert/include/matrix.h
vendored
@ -131,6 +131,7 @@ typedef struct matrix_struct matrix_type;
|
||||
double matrix_trace(const matrix_type *matrix);
|
||||
double matrix_diag_std(const matrix_type * Sk,double mean);
|
||||
double matrix_det3( const matrix_type * A);
|
||||
double matrix_det4( const matrix_type * A);
|
||||
|
||||
#ifdef HAVE_ISFINITE
|
||||
bool matrix_is_finite(const matrix_type * matrix);
|
||||
|
3
ThirdParty/Ert/include/path_fmt.h
vendored
3
ThirdParty/Ert/include/path_fmt.h
vendored
@ -27,8 +27,6 @@ extern "C" {
|
||||
|
||||
typedef struct path_fmt_struct path_fmt_type;
|
||||
|
||||
|
||||
path_fmt_type * path_fmt_safe_cast(const void * arg);
|
||||
path_fmt_type * path_fmt_alloc_directory_fmt(const char * );
|
||||
path_fmt_type * path_fmt_alloc_path_fmt(const char * );
|
||||
path_fmt_type * path_fmt_copyc(const path_fmt_type *);
|
||||
@ -36,6 +34,7 @@ path_fmt_type * path_fmt_scanf_alloc(const char * , int , const node_ctype * ,
|
||||
char * path_fmt_alloc_path(const path_fmt_type * , bool , ...);
|
||||
char * path_fmt_alloc_file(const path_fmt_type * , bool , ...);
|
||||
void path_fmt_free(path_fmt_type * );
|
||||
void path_fmt_free__( void * arg );
|
||||
const char * path_fmt_get_fmt(const path_fmt_type * );
|
||||
void path_fmt_reset_fmt(path_fmt_type * , const char * );
|
||||
void path_fmt_make_path(const path_fmt_type * );
|
||||
|
16
ThirdParty/Ert/include/smspec_node.h
vendored
16
ThirdParty/Ert/include/smspec_node.h
vendored
@ -68,6 +68,15 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
char * smspec_alloc_local_completion_key( const char * join_string, const char * keyword , const char * lgr_name , const char * wgname , int i , int j , int k);
|
||||
|
||||
|
||||
bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num);
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
@ -87,6 +96,7 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
int param_index,
|
||||
float default_value);
|
||||
|
||||
smspec_node_type * smspec_node_alloc_new(int params_index, float default_value);
|
||||
|
||||
void smspec_node_free( smspec_node_type * index );
|
||||
void smspec_node_free__(void * arg);
|
||||
@ -100,12 +110,16 @@ typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
|
||||
void smspec_node_update_wgname( smspec_node_type * index , const char * wgname , const char * key_join_string);
|
||||
const char * smspec_node_get_keyword( const smspec_node_type * smspec_node);
|
||||
const char * smspec_node_get_unit( const smspec_node_type * smspec_node);
|
||||
void smspec_node_set_unit( smspec_node_type * smspec_node , const char * unit );
|
||||
bool smspec_node_is_rate( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_is_total( const smspec_node_type * smspec_node );
|
||||
bool smspec_node_need_nums( const smspec_node_type * smspec_node );
|
||||
float smspec_node_get_default_value( const smspec_node_type * smspec_node );
|
||||
void smspec_node_fprintf( const smspec_node_type * smspec_node , FILE * stream);
|
||||
|
||||
void smspec_node_set_default( smspec_node_type * smspec_node , float default_value);
|
||||
float smspec_node_get_default( const smspec_node_type * smspec_node);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
4
ThirdParty/Ert/include/thread_pool.h
vendored
4
ThirdParty/Ert/include/thread_pool.h
vendored
@ -18,8 +18,8 @@
|
||||
#ifndef __THREAD_POOL_H__
|
||||
#define __THREAD_POOL_H__
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define HAVE_THREAD_POOL
|
||||
#ifdef WITH_PTHREAD
|
||||
#define WITH_THREAD_POOL
|
||||
#include "thread_pool_posix.h"
|
||||
#endif
|
||||
|
||||
|
2
ThirdParty/Ert/include/util.h
vendored
2
ThirdParty/Ert/include/util.h
vendored
@ -405,7 +405,7 @@ const char * util_enum_iget( int index , int size , const util_enum_element_type
|
||||
/*****************************************************************/
|
||||
/* Conditional section below here */
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifdef WITH_ZLIB
|
||||
void util_compress_buffer(const void * , int , void * , unsigned long * );
|
||||
int util_fread_sizeof_compressed(FILE * stream);
|
||||
void util_fread_compressed(void * , FILE * );
|
||||
|
4
ThirdParty/Ert/include/vector.h
vendored
4
ThirdParty/Ert/include/vector.h
vendored
@ -23,6 +23,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <node_data.h>
|
||||
#include <type_macros.h>
|
||||
|
||||
typedef void ( vector_func_type ) (void * , void *);
|
||||
typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
@ -30,8 +31,8 @@ typedef int ( vector_cmp_ftype) (const void * , const void *);
|
||||
typedef struct vector_struct vector_type;
|
||||
|
||||
|
||||
|
||||
vector_type * vector_alloc_new();
|
||||
void vector_grow_NULL( vector_type * vector , int new_size );
|
||||
vector_type * vector_alloc_NULL_initialized( int size );
|
||||
|
||||
int vector_append_ref( vector_type * , const void *);
|
||||
@ -77,6 +78,7 @@ vector_type * vector_alloc_copy(const vector_type * src , bool deep_copy);
|
||||
|
||||
void vector_iset_buffer(vector_type * vector , int index , const void * buffer, int buffer_size);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( vector );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
BIN
ThirdParty/Ert/lib/libecl.a
vendored
BIN
ThirdParty/Ert/lib/libecl.a
vendored
Binary file not shown.
BIN
ThirdParty/Ert/lib/libert_util.a
vendored
BIN
ThirdParty/Ert/lib/libert_util.a
vendored
Binary file not shown.
BIN
ThirdParty/Ert/lib/libgeometry.a
vendored
BIN
ThirdParty/Ert/lib/libgeometry.a
vendored
Binary file not shown.
BIN
ThirdParty/Ert/lib/libwell.a
vendored
BIN
ThirdParty/Ert/lib/libwell.a
vendored
Binary file not shown.
@ -37,7 +37,8 @@ ScalarMapperRangeBased::ScalarMapperRangeBased()
|
||||
m_rangeMax(cvf::UNDEFINED_DOUBLE),
|
||||
m_decadeLevelCount(1),
|
||||
m_levelCount(8),
|
||||
m_textureSize(2048) // Large enough, I guess and a power of two
|
||||
m_textureSize(2048), // Large enough, I guess and a power of two
|
||||
m_adjustLevels(true)
|
||||
{
|
||||
m_colors.resize(m_textureSize);
|
||||
m_colors.setAll(Color3ub::WHITE);
|
||||
|
@ -99,7 +99,7 @@ void AnimationToolBar::init()
|
||||
addAction(m_animSkipToStartAction);
|
||||
addAction(m_animStepBackwardAction);
|
||||
addAction(m_animPlayBwdAction );
|
||||
addAction(m_animStopAction);
|
||||
//addAction(m_animStopAction);
|
||||
addAction(m_animPauseAction);
|
||||
addAction(m_animPlayAction);
|
||||
addAction(m_animStepForwardAction);
|
||||
|
@ -19,6 +19,8 @@ set( QOBJECT_HEADERS
|
||||
cafPdmUiFilePathEditor.h
|
||||
cafPdmUiListEditor.h
|
||||
cafPdmUiSliderEditor.h
|
||||
cafPdmUiDoubleSliderEditor.h
|
||||
|
||||
cafPdmUiColorEditor.h
|
||||
|
||||
cafPdmUiPropertyView.h
|
||||
@ -43,6 +45,7 @@ add_library( ${PROJECT_NAME}
|
||||
cafPdmUiFilePathEditor.cpp
|
||||
cafPdmUiListEditor.cpp
|
||||
cafPdmUiSliderEditor.cpp
|
||||
cafPdmUiDoubleSliderEditor.cpp
|
||||
cafPdmUiColorEditor.cpp
|
||||
|
||||
cafPdmUiPropertyView.cpp
|
||||
|
@ -57,6 +57,7 @@ void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
m_label->setVisible(!field()->isUiHidden(uiConfigName));
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
|
||||
|
218
cafUserInterface/cafPdmUiDoubleSliderEditor.cpp
Normal file
218
cafUserInterface/cafPdmUiDoubleSliderEditor.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cafFactory.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class PdmDoubleValidator : public QDoubleValidator
|
||||
{
|
||||
public:
|
||||
PdmDoubleValidator(QObject * parent = 0) : QDoubleValidator(parent)
|
||||
{
|
||||
}
|
||||
|
||||
PdmDoubleValidator(double bottom, double top, int decimals, QObject * parent)
|
||||
: QDoubleValidator(bottom, top, decimals, parent)
|
||||
{
|
||||
}
|
||||
|
||||
~PdmDoubleValidator()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
virtual void fixup(QString& stringValue) const
|
||||
{
|
||||
double doubleValue = stringValue.toDouble();
|
||||
doubleValue = qBound(bottom(), doubleValue, top());
|
||||
|
||||
stringValue = QString::number(doubleValue, 'g', decimals());
|
||||
}
|
||||
};
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiDoubleSliderEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
assert(!m_lineEdit.isNull());
|
||||
|
||||
QIcon ic = field()->uiIcon(uiConfigName);
|
||||
if (!ic.isNull())
|
||||
{
|
||||
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_label->setText(field()->uiName(uiConfigName));
|
||||
}
|
||||
|
||||
m_label->setVisible(!field()->isUiHidden(uiConfigName));
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
|
||||
m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_slider->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &m_attributes);
|
||||
|
||||
PdmDoubleValidator* pdmValidator = new PdmDoubleValidator(m_attributes.m_minimum, m_attributes.m_maximum, m_attributes.m_decimals, this);
|
||||
m_lineEdit->setValidator(pdmValidator);
|
||||
|
||||
QString textValue = field()->uiValue().toString();
|
||||
pdmValidator->fixup(textValue);
|
||||
|
||||
m_lineEdit->setText(textValue);
|
||||
updateSliderPosition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiDoubleSliderEditor::createEditorWidget(QWidget * parent)
|
||||
{
|
||||
QWidget* containerWidget = new QWidget(parent);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setMargin(0);
|
||||
containerWidget->setLayout(layout);
|
||||
|
||||
m_lineEdit = new QLineEdit(containerWidget);
|
||||
m_lineEdit->setMaximumWidth(100);
|
||||
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
|
||||
|
||||
m_slider = new QSlider(Qt::Horizontal, containerWidget);
|
||||
layout->addWidget(m_lineEdit);
|
||||
layout->addWidget(m_slider);
|
||||
|
||||
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderValueChanged(int)));
|
||||
|
||||
return containerWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiDoubleSliderEditor::createLabelWidget(QWidget * parent)
|
||||
{
|
||||
m_label = new QLabel(parent);
|
||||
return m_label;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDoubleSliderEditor::slotEditingFinished()
|
||||
{
|
||||
updateSliderPosition();
|
||||
|
||||
writeValueToField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDoubleSliderEditor::slotSliderValueChanged(int value)
|
||||
{
|
||||
double newDoubleValue = convertFromSliderValue(value);
|
||||
m_lineEdit->setText(QString::number(newDoubleValue));
|
||||
|
||||
writeValueToField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDoubleSliderEditor::updateSliderPosition()
|
||||
{
|
||||
QString textValue = m_lineEdit->text();
|
||||
|
||||
bool convertOk = false;
|
||||
double newSliderValue = textValue.toDouble(&convertOk);
|
||||
|
||||
int newSliderPosition = convertToSliderValue(newSliderValue);
|
||||
if (m_slider->value() != newSliderPosition)
|
||||
{
|
||||
m_slider->blockSignals(true);
|
||||
m_slider->setValue(newSliderPosition);
|
||||
m_slider->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDoubleSliderEditor::writeValueToField()
|
||||
{
|
||||
QString textValue = m_lineEdit->text();
|
||||
QVariant v;
|
||||
v = textValue;
|
||||
this->setValueToField(v);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int PdmUiDoubleSliderEditor::convertToSliderValue(double value)
|
||||
{
|
||||
double exactSliderValue = m_slider->maximum() * (value - m_attributes.m_minimum) / (m_attributes.m_maximum - m_attributes.m_minimum);
|
||||
|
||||
int sliderValue = static_cast<int>(exactSliderValue);
|
||||
sliderValue = qBound(m_slider->minimum(), sliderValue, m_slider->maximum());
|
||||
|
||||
return sliderValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double PdmUiDoubleSliderEditor::convertFromSliderValue(int sliderValue)
|
||||
{
|
||||
double newDoubleValue = m_attributes.m_minimum + sliderValue * (m_attributes.m_maximum - m_attributes.m_minimum) / m_slider->maximum();
|
||||
newDoubleValue = qBound(m_attributes.m_minimum, newDoubleValue, m_attributes.m_maximum);
|
||||
|
||||
return newDoubleValue;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace caf
|
90
cafUserInterface/cafPdmUiDoubleSliderEditor.h
Normal file
90
cafUserInterface/cafPdmUiDoubleSliderEditor.h
Normal file
@ -0,0 +1,90 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#include <QLineEdit>
|
||||
#include <QGroupBox>
|
||||
#include <QSlider>
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class PdmUiDoubleSliderEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
PdmUiDoubleSliderEditorAttribute()
|
||||
{
|
||||
m_minimum = 0;
|
||||
m_maximum = 10;
|
||||
m_decimals = 6;
|
||||
}
|
||||
|
||||
public:
|
||||
double m_minimum;
|
||||
double m_maximum;
|
||||
int m_decimals;
|
||||
};
|
||||
|
||||
|
||||
class PdmUiDoubleSliderEditor : public PdmUiFieldEditorHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
|
||||
|
||||
public:
|
||||
PdmUiDoubleSliderEditor() {}
|
||||
virtual ~PdmUiDoubleSliderEditor() {}
|
||||
|
||||
protected:
|
||||
virtual void configureAndUpdateUi(const QString& uiConfigName);
|
||||
virtual QWidget* createEditorWidget(QWidget * parent);
|
||||
virtual QWidget* createLabelWidget(QWidget * parent);
|
||||
|
||||
protected slots:
|
||||
void slotEditingFinished();
|
||||
void slotSliderValueChanged(int value);
|
||||
|
||||
private:
|
||||
void updateSliderPosition();
|
||||
void writeValueToField();
|
||||
|
||||
int convertToSliderValue(double value);
|
||||
double convertFromSliderValue(int sliderValue);
|
||||
|
||||
private:
|
||||
QPointer<QLineEdit> m_lineEdit;
|
||||
QPointer<QSlider> m_slider;
|
||||
QPointer<QLabel> m_label;
|
||||
|
||||
PdmUiDoubleSliderEditorAttribute m_attributes;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace caf
|
@ -122,11 +122,21 @@ void PdmUiFilePathEditor::slotEditingFinished()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiFilePathEditor::fileSelectionClicked()
|
||||
{
|
||||
QString defaultPath;
|
||||
if ( m_lineEdit->text().isEmpty())
|
||||
{
|
||||
defaultPath = QDir::homePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultPath = m_lineEdit->text();
|
||||
}
|
||||
|
||||
if (m_attributes.m_selectDirectory)
|
||||
{
|
||||
QString directoryPath = QFileDialog::getExistingDirectory(m_lineEdit,
|
||||
tr("Get existing directory"),
|
||||
m_lineEdit->text(),
|
||||
defaultPath,
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if (!directoryPath.isEmpty())
|
||||
@ -140,11 +150,11 @@ void PdmUiFilePathEditor::fileSelectionClicked()
|
||||
QString filePath;
|
||||
if (m_attributes.m_selectSaveFileName)
|
||||
{
|
||||
filePath = QFileDialog::getSaveFileName(m_lineEdit, tr("Save File"), m_lineEdit->text(), m_attributes.m_fileSelectionFilter);
|
||||
filePath = QFileDialog::getSaveFileName(m_lineEdit, tr("Save File"), defaultPath, m_attributes.m_fileSelectionFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
filePath = QFileDialog::getOpenFileName(m_lineEdit, tr("Choose a file"), m_lineEdit->text(), m_attributes.m_fileSelectionFilter);
|
||||
filePath = QFileDialog::getOpenFileName(m_lineEdit, tr("Choose a file"), defaultPath, m_attributes.m_fileSelectionFilter);
|
||||
}
|
||||
|
||||
if (!filePath.isEmpty())
|
||||
|
@ -263,6 +263,8 @@ static bool isWrongThread()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void ProgressInfoStatic::start(int maxProgressValue, const QString& title)
|
||||
{
|
||||
if (!qApp) return;
|
||||
|
||||
if (isWrongThread()) return;
|
||||
|
||||
if (!maxProgressStack().size())
|
||||
|
@ -315,7 +315,17 @@ bool UiTreeModelPdm::removeRows(int position, int rows, const QModelIndex &paren
|
||||
{
|
||||
if (rows <= 0) return true;
|
||||
|
||||
PdmUiTreeItem* parentItem = getTreeItemFromIndex(parent);
|
||||
PdmUiTreeItem* parentItem = NULL;
|
||||
if (parent.isValid())
|
||||
{
|
||||
parentItem = getTreeItemFromIndex(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
parentItem = m_root;
|
||||
}
|
||||
|
||||
if (!parentItem) return true;
|
||||
|
||||
bool success = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user