Skip to content

Commit

Permalink
Merge pull request #269 from PauloCarvalhoRJ/NextRelease_20210711
Browse files Browse the repository at this point in the history
New release: 6.12
  • Loading branch information
PauloCarvalhoRJ authored Aug 2, 2021
2 parents d155519 + 8369bc6 commit 55c1316
Show file tree
Hide file tree
Showing 64 changed files with 1,776 additions and 285 deletions.
5 changes: 4 additions & 1 deletion GammaRay.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SOURCES += main.cpp\
dialogs/faciestransitionmatrixoptionsdialog.cpp \
dialogs/populatewithproportionsfromvpcdialog.cpp \
dialogs/sectiondialog.cpp \
dialogs/subgriddialog.cpp \
domain/auxiliary/verticalproportioncurvemaker.cpp \
domain/section.cpp \
domain/verticalproportioncurve.cpp \
Expand Down Expand Up @@ -298,6 +299,7 @@ HEADERS += mainwindow.h \
dialogs/faciestransitionmatrixoptionsdialog.h \
dialogs/populatewithproportionsfromvpcdialog.h \
dialogs/sectiondialog.h \
dialogs/subgriddialog.h \
domain/auxiliary/verticalproportioncurvemaker.h \
domain/project.h \
domain/application.h \
Expand Down Expand Up @@ -568,6 +570,7 @@ FORMS += mainwindow.ui \
dialogs/faciestransitionmatrixoptionsdialog.ui \
dialogs/populatewithproportionsfromvpcdialog.ui \
dialogs/sectiondialog.ui \
dialogs/subgriddialog.ui \
gslib/gslibparams/widgets/widgetgslibpardouble.ui \
gslib/gslibparams/widgets/widgetgslibparfile.ui \
gslib/gslibparams/widgets/widgetgslibparinputdata.ui \
Expand Down Expand Up @@ -820,7 +823,7 @@ win32 {
# The application version
# Don't forget to update the Util::importSettingsFromPreviousVersion() method to
# enable the import of registry/user settings of previous versions.
VERSION = 6.9
VERSION = 6.12

# Define a preprocessor macro so we can get the application version in application code.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If you enjoyed this project, you might also enjoy GeostatsPy: https://github.com
Python script to convert Eclipse grids to Paraview-compatible VTU format: https://github.com/BinWang0213/PyGRDECL

VERSION HISTORY:<br>
&nbsp;&nbsp;&nbsp;Version 6.12 - Several new methods to work with grids. Several fixes and enhancements.
&nbsp;&nbsp;&nbsp;Version 6.9 - Export geologic grids as Eclipse grids, multiple other new features, enhancements and fixes.<br>
&nbsp;&nbsp;&nbsp;Version 6.7 - New data type: Geologic section.<br>
&nbsp;&nbsp;&nbsp;Version 6.6 - Mean, median and Gaussian filters, improvements and bug fixes.<br>
Expand Down
17 changes: 17 additions & 0 deletions dialogs/krigingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ void KrigingDialog::onParameters()
//get the selected grid with secondary data (if any)
CartesianGrid* sec_data_grid = (CartesianGrid*)m_cgSelectorSecondary->getSelectedDataFile();

//if a secondary variable (for LVM or KED) was selected, update the min and max values.
if( sec_data_grid ){
double minSecondary = sec_data_grid->min( m_cgSecondaryVariableSelector->getSelectedVariableGEOEASIndex()-1 );
double maxSecondary = sec_data_grid->max( m_cgSecondaryVariableSelector->getSelectedVariableGEOEASIndex()-1 );
data_min = std::min( data_min, minSecondary );
data_max = std::max( data_max, maxSecondary );
}

//-----------------------------set kt3d parameters---------------------------

if( ! m_gpf_kt3d ){
Expand Down Expand Up @@ -399,6 +407,15 @@ void KrigingDialog::preview()
//get the tmp file path created by kte3d with the estimates and kriging variances
QString grid_file_path = m_gpf_kt3d->getParameter<GSLibParFile*>(8)->_path;

//Sanity check
QFile grid_file( grid_file_path );
if( ! grid_file.exists( ) ){
Application::instance()->logError( "KrigingDialog::preview(): output file not generated. "
"Check kt3d parameters and the output message pane for errors"
" issued by kt3d.", true );
return;
}

//create a new grid object corresponding to the file created by kt3d
m_cg_estimation = new CartesianGrid( grid_file_path );

Expand Down
104 changes: 104 additions & 0 deletions dialogs/subgriddialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#include "subgriddialog.h"
#include "ui_subgriddialog.h"

#include "domain/cartesiangrid.h"
#include "domain/application.h"
#include "domain/project.h"
#include "imagejockey/widgets/ijquick3dviewer.h"
#include "widgets/variableselector.h"

SubgridDialog::SubgridDialog(CartesianGrid *cg, QWidget *parent) :
QDialog(parent),
ui(new Ui::SubgridDialog),
m_cg( cg )
{
assert( cg && "SubgridDialog::SubgridDialog(): Cartesian grid cannot be null." );

ui->setupUi(this);

//deletes dialog from memory upon user closing it
this->setAttribute(Qt::WA_DeleteOnClose);

this->setWindowTitle( "Make subgrid" );

ui->spinMaxI->setMinimum( 0 );
ui->spinMaxI->setMaximum( cg->getNI()-1 );
ui->spinMaxI->setValue( cg->getNI()-1 );

ui->spinMinI->setMinimum( 0 );
ui->spinMinI->setMaximum( cg->getNI()-1 );
ui->spinMinI->setValue( 0 );

ui->spinMaxJ->setMinimum( 0 );
ui->spinMaxJ->setMaximum( cg->getNJ()-1 );
ui->spinMaxJ->setValue( cg->getNJ()-1 );

ui->spinMinJ->setMinimum( 0 );
ui->spinMinJ->setMaximum( cg->getNJ()-1 );
ui->spinMinJ->setValue( 0 );

ui->spinMaxK->setMinimum( 0 );
ui->spinMaxK->setMaximum( cg->getNK()-1 );
ui->spinMaxK->setValue( cg->getNK()-1 );

ui->spinMinK->setMinimum( 0 );
ui->spinMinK->setMaximum( cg->getNK()-1 );
ui->spinMinK->setValue( 0 );

ui->txtGridName->setText( cg->getName() + "_subgrid" );

m_previewWidget = new IJQuick3DViewer();
ui->frmDisplay->layout()->addWidget( m_previewWidget );
m_previewWidget->hideDismissButton();

//The list with the secondary data grid variables;
m_variableForPreview = new VariableSelector();
ui->frmCmbVariable->layout()->addWidget( m_variableForPreview );
m_variableForPreview->onListVariables( m_cg );

adjustSize();
}

SubgridDialog::~SubgridDialog()
{
delete ui;
}

void SubgridDialog::onSave()
{
CartesianGrid* subgrid = m_cg->makeSubGrid( ui->spinMinI->value(), ui->spinMaxI->value(),
ui->spinMinJ->value(), ui->spinMaxJ->value(),
ui->spinMinK->value(), ui->spinMaxK->value() );

//save the physical files
subgrid->setPath( Application::instance()->getProject()->getPath() +
'/' + ui->txtGridName->text() );
subgrid->updateMetaDataFile();
subgrid->writeToFS();

//adds the new grid to the project
Application::instance()->getProject()->addDataFile( subgrid );
Application::instance()->refreshProjectTree();

//closes the dialog
accept();
}

void SubgridDialog::onPreview()
{
CartesianGrid* subgrid = m_cg->makeSubGrid( ui->spinMinI->value(), ui->spinMaxI->value(),
ui->spinMinJ->value(), ui->spinMaxJ->value(),
ui->spinMinK->value(), ui->spinMaxK->value() );

uint dataColumn = m_variableForPreview->getSelectedVariableGEOEASIndex() - 1;

spectral::array* data = subgrid->createSpectralArray( dataColumn );

double min = subgrid->min( dataColumn );
double max = subgrid->max( dataColumn );

m_previewWidget->display( *data, min, max, subgrid->getDX(), subgrid->getDY(), subgrid->getDZ() );

delete data;
delete subgrid;
}
34 changes: 34 additions & 0 deletions dialogs/subgriddialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef SUBGRIDDIALOG_H
#define SUBGRIDDIALOG_H

#include <QDialog>

class CartesianGrid;
class IJQuick3DViewer;
class VariableSelector;

namespace Ui {
class SubgridDialog;
}

class SubgridDialog : public QDialog
{
Q_OBJECT

public:
explicit SubgridDialog( CartesianGrid* cg, QWidget *parent = nullptr);
~SubgridDialog();

private:
Ui::SubgridDialog *ui;
CartesianGrid* m_cg;
IJQuick3DViewer* m_previewWidget;
VariableSelector* m_variableForPreview;

private Q_SLOTS:

void onSave();
void onPreview();
};

#endif // SUBGRIDDIALOG_H
Loading

0 comments on commit 55c1316

Please sign in to comment.