[us-commits] r2806 - trunk/programs/us_density_match
svn at svn.aucsolutions.com
svn at svn.aucsolutions.com
Sun Aug 11 16:59:56 MDT 2019
Author: gegorbet
Date: 2019-08-11 22:59:54 +0000 (Sun, 11 Aug 2019)
New Revision: 2806
Added:
trunk/programs/us_density_match/us_model_params.cpp
trunk/programs/us_density_match/us_model_params.h
Modified:
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
trunk/programs/us_density_match/us_density_match.pro
trunk/programs/us_density_match/us_remove_models.cpp
trunk/programs/us_density_match/us_remove_models.h
Log:
more density_match progress, incl new us_model_parms dialog
Modified: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -4,6 +4,7 @@
#include "us_density_match.h"
#include "us_remove_models.h"
+#include "us_model_params.h"
#include "us_select_runs.h"
#include "us_model.h"
#include "us_license_t.h"
@@ -74,16 +75,6 @@
us_checkbox( tr( "Save Plot(s)" ), ck_savepl, false );
us_checkbox( tr( "Local Save Only" ), ck_locsave, true );
-#if 0
- QLabel* lb_curr_distr = us_label( tr( "Current Distro:" ) );
- lb_curr_distr->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
-
- ct_curr_distr = us_counter( 3, 0.0, 10.0, 0.0 );
- ct_curr_distr->setSingleStep( 1 );
- connect( ct_curr_distr, SIGNAL( valueChanged ( double ) ),
- this, SLOT( update_curr_distr( double ) ) );
-#endif
-
te_distr_info = us_textedit();
te_distr_info->setText ( tr( "Run: runID.triple (method)\n" )
+ tr( " analysisID" ) );
@@ -98,17 +89,20 @@
QGridLayout* gl_x_rh = us_radiobutton( tr( "Rh" ), rb_x_rh, false );
QGridLayout* gl_x_vbar = us_radiobutton( tr( "vbar"), rb_x_vbar, false );
QGridLayout* gl_x_s = us_radiobutton( tr( "s" ), rb_x_s, false );
+ QGridLayout* gl_x_d = us_radiobutton( tr( "D" ), rb_x_d, false );
bg_x_axis->addButton( rb_x_mass, ATTR_W );
bg_x_axis->addButton( rb_x_ff0, ATTR_K );
bg_x_axis->addButton( rb_x_rh, ATTR_R );
bg_x_axis->addButton( rb_x_vbar, ATTR_V );
bg_x_axis->addButton( rb_x_s, ATTR_S );
+ bg_x_axis->addButton( rb_x_d, ATTR_D );
rb_x_mass->setChecked( true );
rb_x_mass->setToolTip( tr( "Set X axis to Molar Mass" ) );
rb_x_ff0 ->setToolTip( tr( "Set X axis to Frictional Ratio" ) );
rb_x_rh ->setToolTip( tr( "Set X axis to Hydrodynamic Radius" ) );
rb_x_vbar->setToolTip( tr( "Set X axis to Partial Specific Volume" ) );
rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
+ rb_x_d ->setToolTip( tr( "Set X axis to Diffusion Coefficient" ) );
connect( bg_x_axis, SIGNAL( buttonReleased( int ) ),
this, SLOT ( select_x_axis ( int ) ) );
@@ -143,6 +137,16 @@
connect( pb_rmvdist, SIGNAL( clicked() ),
this, SLOT( remove_distro() ) );
+ pb_mdlpars = us_pushbutton( tr( "Set Model Parameters" ) );
+ pb_mdlpars->setEnabled( true );
+ connect( pb_mdlpars, SIGNAL( clicked() ),
+ this, SLOT( set_mparms() ) );
+
+ pb_save = us_pushbutton( tr( "Save" ) );
+ pb_save ->setEnabled( true );
+ connect( pb_save, SIGNAL( clicked() ),
+ this, SLOT( save() ) );
+
pb_help = us_pushbutton( tr( "Help" ) );
pb_help->setEnabled( true );
connect( pb_help, SIGNAL( clicked() ),
@@ -162,12 +166,15 @@
spec->addWidget( pb_rmvdist, s_row++, 4, 1, 4 );
spec->addWidget( pb_refresh, s_row, 0, 1, 4 );
spec->addWidget( pb_reset, s_row++, 4, 1, 4 );
+ spec->addWidget( pb_mdlpars, s_row, 0, 1, 4 );
+ spec->addWidget( pb_save, s_row++, 4, 1, 4 );
spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
spec->addLayout( gl_x_mass, s_row, 2, 1, 2 );
spec->addLayout( gl_x_ff0, s_row, 4, 1, 2 );
spec->addLayout( gl_x_rh, s_row++, 6, 1, 2 );
spec->addLayout( gl_x_vbar, s_row, 2, 1, 2 );
- spec->addLayout( gl_x_s, s_row++, 4, 1, 2 );
+ spec->addLayout( gl_x_s, s_row, 4, 1, 2 );
+ spec->addLayout( gl_x_d, s_row++, 6, 1, 2 );
spec->addWidget( ck_savepl, s_row, 0, 1, 4 );
spec->addWidget( ck_locsave, s_row++, 4, 1, 4 );
spec->addWidget( te_distr_info, s_row, 0, 2, 8 ); s_row += 2;
@@ -255,7 +262,7 @@
need_save = false;
- plot_x = ATTR_S;
+ plot_x = ATTR_V;
// resolu = 90.0;
// ct_resolu->setRange( 1.0, 100.0 );
// ct_resolu->setSingleStep( 1.0 );
@@ -316,12 +323,15 @@
alldis.clear();
pfilts.clear();
-// pb_pltall ->setEnabled( false );
pb_refresh->setEnabled( false );
pb_rmvdist->setEnabled( false );
le_prefilt->setText( tr( "(no prefilter)" ) );
}
+void US_Density_Match::save( void )
+{
+}
+
// plot the data
void US_Density_Match::plot_data( void )
{
@@ -543,7 +553,6 @@
{
// Get a model description or set of descriptions for distribution data
QList< US_Model > models;
- QStringList mdescs;
bool loadDB = dkdb_cntrls->db();
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
@@ -568,7 +577,16 @@
need_save = ck_savepl->isChecked() && !cont_loop;
pb_rmvdist->setEnabled( models.count() > 0 );
- update_curr_distr( (double)alldis.size() );
+ // Notify user of need to set D2O-percent, label, density model values
+ QString qmsg = tr( "%1 models are loaded. In the dialog to follow,\n"
+ "you must set D2O Percent values for each,\n"
+ "then review and set Label and Density values for them.\n"
+ "Begin with the model(s) with 0% D2O." )
+ .arg( alldis.size() );
+ QMessageBox::warning( this, tr( "Model Parameters" ), qmsg );
+
+ // Set model distributions parameters
+ set_mparms();
}
// Create distributions from a loaded model
@@ -651,6 +669,8 @@
US_DataIO::loadData( edir, efname, edata );
DbgLv(1) << "LD: edata: desc run cell chan"
<< edata.description << edata.runID << edata.cell << edata.channel;
+ tsys.label = edata.description;
+ tsys.d2opct = -1.0;
// Now, get associated solution,buffer values
QString soluID;
@@ -663,8 +683,9 @@
DbgLv(1) << "LD: solvals CALL";
US_SolutionVals::values( dbP, &edata,
soluID, cvbar20, bdens, bvisc, cmprss, bmanu, errmsg );
-DbgLv(1) << "LD: solval: bdens soluID errmsg"
- << bdens << soluID << errmsg;
+ tsys.bdensity = bdens.toDouble();
+DbgLv(1) << "LD: solval: bdens soluID bdensity"
+ << bdens << soluID << tsys.bdensity;
te_distr_info->setText( tr( "Run: " ) + tsys.run_name
@@ -713,7 +734,7 @@
// Create version of distribution with boundary fraction
- wk_distro.clear();
+ tsys.bo_distro.clear();
double sum_co = 0.0;
for ( int jj = 0; jj < nsolnm; jj++ )
@@ -722,10 +743,10 @@
sum_co += sol_nm.c;
sol_bf = sol_nm;
sol_bf.f = sum_co;
- wk_distro << sol_bf;
+ tsys.bo_distro << sol_bf;
if ( jj<3 || (jj+4)>nsolnm )
DbgLv(1) << "LD: jj" << jj << "solb s,d,c,f"
- << sol_bf.d << sol_bf.d << sol_bf.c << sol_bf.f;
+ << sol_bf.s << sol_bf.d << sol_bf.c << sol_bf.f;
}
// Update current distribution record
@@ -767,7 +788,7 @@
if ( curr_distr == alldis.size() )
curr_distr--;
- need_save = ck_savepl->isChecked() && !cont_loop;
+// need_save = ck_savepl->isChecked() && !cont_loop;
}
void US_Density_Match::set_limits()
@@ -838,10 +859,12 @@
kmax = qFloor( kmax / kinc ) * kinc + kinc;
DbgLv(1) << "SL: setVal kmin kmax" << kmin << kmax;
+#if 0
ct_plt_smin->setValue( smin );
ct_plt_smax->setValue( smax );
ct_plt_kmin->setValue( kmin );
ct_plt_kmax->setValue( kmax );
+#endif
plt_smin = smin;
plt_smax = smax;
@@ -850,10 +873,12 @@
}
else
{
+#if 0
plt_smin = ct_plt_smin->value();
plt_smax = ct_plt_smax->value();
plt_kmin = ct_plt_kmin->value();
plt_kmax = ct_plt_kmax->value();
+#endif
}
DbgLv(1) << "SL: plt_smin _smax _kmin _kmax" << plt_smin << plt_smax
<< plt_kmin << plt_kmax;
@@ -967,7 +992,7 @@
// Remove distribution(s) from the models list
void US_Density_Match::remove_distro( void )
{
-qDebug() << "Remove Distros";
+qDebug() << "rmvdis:Remove Distros";
US_RemoveModels rmvd( alldis );
if ( rmvd.exec() == QDialog::Accepted )
@@ -981,15 +1006,51 @@
}
curr_distr = 0;
- ct_curr_distr->setRange( 1, jd );
- ct_curr_distr->setSingleStep( 1.0 );
- ct_curr_distr->setValue( 1 );
- ct_curr_distr->setEnabled( true );
+qDebug() << "rmvdis:Accepted";
}
+qDebug() << "rmvdis:plot_data";
plot_data();
+qDebug() << "rmvdis:DONE";
}
+// Set/modify model distribution parameters
+void US_Density_Match::set_mparms( void )
+{
+qDebug() << "mdlpar:Set Model Parameters";
+ US_ModelParams mpdiag( alldis, this );
+
+ if ( mpdiag.exec() == QDialog::Accepted )
+ { // Redo text box summarizing models; calculate vectors
+ QString dinfo;
+ QString mdesc = mdescs[ 0 ].section( mdescs[ 0 ].left( 1 ), 1, 1 );
+// int kk = mdesc.indexOf( "-run" );
+// mdesc = ( kk > 0 ) ? QString( mdesc ).mid( ( kk + 1 ) )
+// : mdesc;
+ mdesc = QString( mdesc ).left( 50 );
+ dinfo = tr( "Run:\n " ) + mdesc + "...\n\n"
+ + tr( " D2O Percent Density Label MDescr.\n" );
+
+ for ( int jj = 0; jj < alldis.size(); jj++ )
+ {
+ double d2opct = alldis[ jj ].d2opct;
+ double bdens = alldis[ jj ].bdensity;
+ QString mlab = alldis[ jj ].label;
+ mdesc = mdescs[ jj ].section( mdescs[ jj ].left( 1 ), 1, 1 );
+ mdesc = alldis[ jj ].run_name;
+ int kk = mdesc.indexOf( "-run" );
+ mdesc = ( kk > 0 )
+ ? "..." + QString( mdesc ).mid( ( kk + 1 ), 20 )
+ + "..."
+ : mdesc;
+ dinfo += QString().sprintf( "%.1f %f ", d2opct, bdens )
+ + mlab + " " + mdesc + "\n";
+ }
+
+ te_distr_info->setText( dinfo );
+ }
+}
+
// Select coordinate for horizontal axis
void US_Density_Match::select_x_axis( int ival )
{
@@ -1038,7 +1099,7 @@
build_bf_distro();
- set_limits();
+// set_limits();
plot_data();
}
Modified: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -6,24 +6,23 @@
#include "us_help.h"
#include "us_editor.h"
#include "us_model_loader.h"
+#include "us_solute.h"
+#include "us_spectrodata.h"
#include "us_plot.h"
-#include "us_colorgradIO.h"
-#include "us_spectrodata.h"
#include "qwt_plot_marker.h"
-#include "qwt_plot_spectrogram.h"
#include "qwt_plot_layout.h"
#include "qwt_plot_zoomer.h"
#include "qwt_plot_panner.h"
#include "qwt_scale_widget.h"
#include "qwt_scale_draw.h"
-#include "qwt_color_map.h"
//!< \brief Distribution structure
typedef struct distro_sys
{
QList< S_Solute > in_distro; // Raw input distribution
QList< S_Solute > nm_distro; // Normalized concentration distro
+ QList< S_Solute > bo_distro; // Boundary distro w/ orig points
QList< S_Solute > bf_distro; // Boundary fractions distro
QString run_name;
QString analys_name;
@@ -35,6 +34,7 @@
int plot_x;
int solutionID;
double d2opct;
+ double bdensity;
} DisSys;
//! \brief Less-than function for sorting distributions
@@ -97,6 +97,8 @@
QPushButton* pb_help;
QPushButton* pb_close;
QPushButton* pb_rmvdist;
+ QPushButton* pb_mdlpars;
+ QPushButton* pb_save;
QCheckBox* ck_autosxy;
QCheckBox* ck_autoscz;
@@ -112,11 +114,20 @@
QRadioButton* rb_x_rh;
QRadioButton* rb_x_vbar;
QRadioButton* rb_x_s;
+ QRadioButton* rb_x_d;
QButtonGroup* bg_x_axis;
- QList< DisSys > alldis;
+ QVector< DisSys > alldis;
+ QVector< double > v_bfracs;
+ QVector< double > v_vbars;
+ QVector< double > v_mmass;
+ QVector< double > v_frats;
+ QVector< double > v_hrads;
+ QVector< QVector< double > > v_sedcs;
+ QVector< QVector< double > > v_difcs;
+
double resolu;
double plt_smin;
double plt_smax;
@@ -148,6 +159,7 @@
QString mfilter;
QStringList pfilts;
+ QStringList mdescs;
private slots:
@@ -168,12 +180,14 @@
void select_prefilt( void );
void load_distro( void );
void load_distro( US_Model, QString );
- void plotall( void );
- void reset( void );
- void set_limits( void );
- void sort_distro( QList< S_Solute >&, bool );
- void remove_distro( void );
- void select_x_axis( int );
+ void plotall( void );
+ void reset( void );
+ void save( void );
+ void set_limits ( void );
+ void sort_distro ( QList< S_Solute >&, bool );
+ void remove_distro ( void );
+ void set_mparms ( void );
+ void select_x_axis ( int );
void build_bf_distro( void );
QString anno_title ( int );
Modified: trunk/programs/us_density_match/us_density_match.pro
===================================================================
--- trunk/programs/us_density_match/us_density_match.pro 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.pro 2019-08-11 22:59:54 UTC (rev 2806)
@@ -5,8 +5,10 @@
TARGET = us_density_match
HEADERS = us_density_match.h \
- us_remove_models.h
+ us_remove_models.h \
+ us_model_params.h
SOURCES = us_density_match.cpp \
- us_remove_models.cpp
+ us_remove_models.cpp \
+ us_model_params.cpp
Added: trunk/programs/us_density_match/us_model_params.cpp
===================================================================
--- trunk/programs/us_density_match/us_model_params.cpp (rev 0)
+++ trunk/programs/us_density_match/us_model_params.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -0,0 +1,273 @@
+//! \file us_model_params.cpp
+
+#include "us_model_params.h"
+#include "us_gui_settings.h"
+
+// Constructor: remove-distributions dialog widget
+US_ModelParams::US_ModelParams( QVector< DisSys >& adistros,
+ QWidget* p ) : US_WidgetsDialog( p, 0 ), distros( adistros )
+{
+ setObjectName( "US_ModelParams" );
+ setPalette( US_GuiSettings::frameColor() );
+ setFont( QFont( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() ) );
+
+ // Lay out the GUI
+ setWindowTitle( tr( "Distribution Parameters" ) );
+
+ mainLayout = new QGridLayout( this );
+
+ mainLayout->setSpacing ( 2 );
+ mainLayout->setContentsMargins( 2, 2, 2, 2 );
+
+ QLabel* lb_mtitle = us_banner( tr( "Modify Model D2O Percent, Density,"
+ " Label" ) );
+
+ pb_help = us_pushbutton( tr( "Help" ) );
+ pb_cancel = us_pushbutton( tr( "Cancel" ) );
+ pb_accept = us_pushbutton( tr( "Accept" ) );
+ pb_compute = us_pushbutton( tr( "Compute Densities" ) );
+
+
+ // Build lists of model parameters
+ nd_orig = distros.count();
+ int maxdlen = 0;
+
+ for ( int jj = 0; jj < nd_orig; jj++ )
+ {
+ QString runid = distros[ jj ].run_name;
+ QString analy = distros[ jj ].analys_name;
+ QString method = distros[ jj ].method;
+ QString mlabel = distros[ jj ].label;
+ QString edid = analy.section( "_", 0, -4 );
+ QString anid = analy.section( "_", -3, -3 );
+ QString iter = analy.section( "_", -2, -1 );
+ QString mdesc = runid + "." + edid + "_" + anid + "_" + method
+ + "_" + iter;
+
+ mdescrs << mdesc;
+ d2opcts << distros[ jj ].d2opct;
+ bdensts << distros[ jj ].bdensity;
+ modelids << tr( "Model %1" ).arg( ( jj + 1 ) );
+ mlabels << mlabel;
+// labels << QLabel( mlabel );
+
+ maxdlen = qMax( maxdlen, mdesc.length() );
+ }
+
+ // Fill in the bulk of GUI elements, including model table
+ int row = 0;
+ mainLayout ->addWidget( lb_mtitle, row++, 0, 1, 8 );
+ row += 9;
+ QLabel* lb_hdr1 = us_banner( tr( "Model ndx" ) );
+ QLabel* lb_hdr2 = us_banner( tr( "D2O Percent" ) );
+ QLabel* lb_hdr3 = us_banner( tr( "Density (g/l)" ) );
+ QLabel* lb_hdr4 = us_banner( tr( "Label" ) );
+ QLabel* lb_hdr5 = us_banner( tr( "Description" ) );
+ mainLayout->addWidget( lb_hdr1, row, 0, 1, 1 );
+ mainLayout->addWidget( lb_hdr2, row, 1, 1, 1 );
+ mainLayout->addWidget( lb_hdr3, row, 2, 1, 1 );
+ mainLayout->addWidget( lb_hdr4, row, 3, 1, 2 );
+ mainLayout->addWidget( lb_hdr5, row++, 5, 1, 3 );
+ for ( int jj = 0; jj < nd_orig; jj++ )
+ {
+ QString modelid = modelids[ jj ];
+ double d2opc = d2opcts[ jj ];
+ double bdens = bdensts[ jj ];
+ QString sd2opc = ( d2opc < 0.0 ) ? "" : QString::number( d2opc );
+ QString sbdens = QString::number( bdens );
+ QString mlabel = mlabels [ jj ];
+ QString mdesc = mdescrs [ jj ];
+ int kk = mdesc.indexOf( "-run" );
+ mdesc = ( kk > 0 ) ? QString( mdesc ).mid( ( kk + 1 ) )
+ : mdesc;
+
+ QLabel* lb_mdli = us_label ( modelid );
+ QLineEdit* le_d2op = us_lineedit( sd2opc );
+ QLineEdit* le_dens = us_lineedit( sbdens );
+ QLineEdit* le_mlab = us_lineedit( mlabel );
+ QLineEdit* le_mdsc = us_lineedit( mdesc );
+ us_setReadOnly( le_mdsc, true );
+
+ QString rowx = QString::number( jj );
+ le_d2op->setObjectName( "D2OP:" + rowx );
+ le_dens->setObjectName( "DENS:" + rowx );
+ le_mlab->setObjectName( "MLAB:" + rowx );
+
+ mainLayout->addWidget( lb_mdli, row, 0, 1, 1 );
+ mainLayout->addWidget( le_d2op, row, 1, 1, 1 );
+ mainLayout->addWidget( le_dens, row, 2, 1, 1 );
+ mainLayout->addWidget( le_mlab, row, 3, 1, 2 );
+ mainLayout->addWidget( le_mdsc, row++, 5, 1, 3 );
+ }
+
+ mainLayout ->addWidget( pb_help, row, 0, 1, 1 );
+ mainLayout ->addWidget( pb_cancel, row, 1, 1, 2 );
+ mainLayout ->addWidget( pb_accept, row, 3, 1, 2 );
+ mainLayout ->addWidget( pb_compute, row++, 6, 1, 3 );
+ row += 2;
+
+ mainLayout->setColumnStretch( 0, 2 );
+ mainLayout->setColumnStretch( 1, 2 );
+ mainLayout->setColumnStretch( 2, 2 );
+ mainLayout->setColumnStretch( 3, 3 );
+ mainLayout->setColumnStretch( 4, 3 );
+ mainLayout->setColumnStretch( 5, 4 );
+ mainLayout->setColumnStretch( 6, 4 );
+ mainLayout->setColumnStretch( 7, 4 );
+
+ connect( pb_help, SIGNAL( clicked() ),
+ this, SLOT( help() ) );
+ connect( pb_cancel, SIGNAL( clicked() ),
+ this, SLOT( canceled() ) );
+ connect( pb_accept, SIGNAL( clicked() ),
+ this, SLOT( accepted() ) );
+ connect( pb_compute, SIGNAL( clicked() ),
+ this, SLOT( compute_densities() ) );
+ QFont font( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() );
+ QFontMetrics fm( font );
+ int fhigh = fm.lineSpacing();
+ int fwide = fm.width( QChar( '6' ) );
+ int lhigh = fhigh * 10 + 12;
+ int lwide = fwide * ( maxdlen + 2 );
+
+ adjustSize();
+ int wwide = qMax( 500, lwide );
+ int whigh = size().height();
+ resize( wwide, whigh );
+ qApp->processEvents();
+}
+
+// Private slot to react to a change in selections
+void US_ModelParams::d2opctChanged( int sel )
+{
+DbgLv(1) << "d2opctChanged: sel" << sel;
+ bool can_accept = false;
+ // Enable buttons according to the present state of selection/removal
+ pb_accept ->setEnabled( can_accept );
+}
+
+// Private slot to react to a change in selections
+void US_ModelParams::labelChanged( int sel )
+{
+DbgLv(1) << "labelChanged: sel" << sel;
+}
+
+
+// Private slot to do the actual removal of distributions and close
+void US_ModelParams::accepted()
+{
+DbgLv(1) << "accepted";
+#if 0
+ if ( nd_selected > 0 )
+ { // Accept attempt with selections and no Remove clicked
+ if ( QMessageBox::Yes == QMessageBox::warning( this,
+ tr( "Outstanding Selections" ),
+ tr( "You have selected distributions,\n"
+ "but did not click on the Remove button.\n"
+ "Do you want to remove the selected distributions?" ),
+ QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes ) )
+ { // If "Yes" to above, add current selections to the remove list
+ remove();
+ }
+ }
+
+ for ( int jj = nd_orig - 1; jj >= 0; jj-- )
+ { // Remove all entries in the original that are not in the current list
+ QString mdesc = mdesc_orig[ jj ];
+
+ if ( ! mdesc_list.contains( mdesc ) )
+ { // This original list item is to be removed from the passed list
+ distros.removeAt( jj );
+ }
+ }
+#endif
+
+ QList< QObject* > ochilds = this->children();
+DbgLv(1) << " acc: ochilds size" << ochilds.size();
+ for ( int jj = 0; jj < ochilds.size(); jj++ )
+ {
+ QObject* ochild = ochilds[ jj ];
+ QLineEdit* lned = (QLineEdit*) ochild;
+ QString cname = ochild->objectName();
+ QString pname = cname.section( ":", 0, 0 );
+ int rowx = cname.section( ":", 1, 1 ).toInt();
+ if ( pname == "D2OP" )
+ {
+ distros[ rowx ].d2opct = lned->text().toDouble();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text().toDouble();
+ }
+ else if ( pname == "DENS" )
+ {
+ distros[ rowx ].bdensity = lned->text().toDouble();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text().toDouble();
+ }
+ else if ( pname == "MLAB" )
+ {
+ distros[ rowx ].label = lned->text();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text();
+ }
+ }
+
+ accept();
+}
+
+// Private slot to do the actual removal of distributions and close
+void US_ModelParams::canceled()
+{
+DbgLv(1) << "canceled";
+ reject();
+}
+
+void US_ModelParams::compute_densities()
+{
+ const double dnslope = 0.00108766;
+ QList< QObject* > ochilds = this->children();
+ int nzd2pc = 0;
+ int npd2pc = 0;
+ bool misspc = false;
+ double d2opct = -1.0;
+ double denszpc = 0.0;
+ double density = 0.0;
+DbgLv(1) << " cdn: ochilds size" << ochilds.size();
+ for ( int jj = 0; jj < ochilds.size(); jj++ )
+ {
+ QObject* ochild = ochilds[ jj ];
+ QLineEdit* lned = (QLineEdit*) ochild;
+ QString cname = ochild->objectName();
+ QString pname = cname.section( ":", 0, 0 );
+ if ( pname == "D2OP" )
+ {
+ d2opct = lned->text().toDouble();
+ if ( d2opct == 0.0 )
+ {
+ nzd2pc++;
+ if ( npd2pc > 0 )
+ misspc = true;
+ }
+ else
+ {
+ npd2pc++;
+ if ( nzd2pc == 0 )
+ misspc = true;
+ }
+ }
+ else if ( pname == "DENS" )
+ {
+ density = lned->text().toDouble();
+ if ( d2opct == 0.0 )
+ {
+ denszpc = density;
+ }
+ else
+ {
+ density = denszpc + d2opct * dnslope;
+ lned->setText( QString::number( density ) );
+ }
+ }
+ }
+DbgLv(1) << " cdn: misspc" << misspc;
+}
+
Property changes on: trunk/programs/us_density_match/us_model_params.cpp
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_model_params.h
===================================================================
--- trunk/programs/us_density_match/us_model_params.h (rev 0)
+++ trunk/programs/us_density_match/us_model_params.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -0,0 +1,59 @@
+//! \file us_model_params.h
+#ifndef US_MDLPARAM_H
+#define US_MDLPARAM_H
+
+#include "us_extern.h"
+#include "us_widgets_dialog.h"
+#include "us_density_match.h"
+#include "us_help.h"
+
+//! \brief A class to provide a window for setting parameters for each model
+
+class US_ModelParams : public US_WidgetsDialog
+{
+ Q_OBJECT
+
+ public:
+ //! \brief US_ModelParams constructor
+ //! \param adistros Pointer to model distributions list
+ //! \param p Pointer to the parent of this widget
+ US_ModelParams( QVector< DisSys >&, QWidget* p = 0 );
+
+ private:
+ QVector< DisSys >& distros; // Reference to model distributions vector
+
+ int nd_orig; // Number of distributions in original
+ int dbg_level;
+
+ QGridLayout* mainLayout; //
+
+ QList< QLabel* > labels;
+ QList< double > d2opcts;
+ QList< double > bdensts;
+ QStringList modelids;
+ QStringList mlabels;
+ QStringList mdescrs;
+
+ QStringList mdesc_orig; // List of descriptions from original
+ QStringList mdesc_list; // List of descriptions now listed
+
+ QPushButton* pb_help; // Help button
+ QPushButton* pb_cancel; // Cancel button
+ QPushButton* pb_accept; // Accept button
+ QPushButton* pb_compute; // Compute button
+
+ protected:
+ US_Help showHelp;
+
+ private slots:
+
+ void d2opctChanged ( int );
+ void labelChanged ( int );
+ void canceled ( void );
+ void accepted ( void );
+ void compute_densities( void );
+ void help ( void )
+ { showHelp.show_help( "dens_match_mparam.html" ); };
+};
+#endif
+
Property changes on: trunk/programs/us_density_match/us_model_params.h
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Modified: trunk/programs/us_density_match/us_remove_models.cpp
===================================================================
--- trunk/programs/us_density_match/us_remove_models.cpp 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_remove_models.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -4,7 +4,7 @@
#include "us_gui_settings.h"
// Constructor: remove-distributions dialog widget
-US_RemoveModels::US_RemoveModels( QList< DisSys >& adistros,
+US_RemoveModels::US_RemoveModels( QVector< DisSys >& adistros,
QWidget* p ) : US_WidgetsDialog( p, 0 ), distros( adistros )
{
setObjectName( "US_RemoveModels" );
Modified: trunk/programs/us_density_match/us_remove_models.h
===================================================================
--- trunk/programs/us_density_match/us_remove_models.h 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_remove_models.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -19,10 +19,10 @@
//! \brief US_RemoveModels constructor
//! \param adistros Pointer to model distributions list
//! \param p Pointer to the parent of this widget
- US_RemoveModels( QList< DisSys >&, QWidget* p = 0 );
+ US_RemoveModels( QVector< DisSys >&, QWidget* p = 0 );
private:
- QList< DisSys >& distros; // Reference to model distributions list
+ QVector< DisSys >& distros; // Reference to model distributions vector
int nd_orig; // Number of distributions in original
int nd_removed; // Number of total distributions removed
More information about the us-commits
mailing list