3 #include <QApplication>
6 const double MPISQ = M_PI * M_PI;
7 const double THIRD = 1.0 / 3.0;
12 int main(
int argc,
char* argv[] )
14 QApplication application( argc, argv );
22 return application.exec();
31 setWindowTitle( tr(
"UltraScan 2DSA Grid Initialization Editor" ) );
35 QHBoxLayout*
main =
new QHBoxLayout(
this );
36 QVBoxLayout* right =
new QVBoxLayout();
37 QGridLayout* left =
new QGridLayout();
38 main->setSpacing ( 2 );
39 main->setContentsMargins( 2, 2, 2, 2 );
40 left->setSpacing ( 1 );
41 left->setContentsMargins( 0, 0, 0, 0 );
42 right->setSpacing ( 0 );
43 right->setContentsMargins( 0, 1, 0, 1 );
58 pb_investigator->setEnabled(
false );
61 QString number = (
id > 0 ) ?
73 lb_xaxis->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
76 lb_yaxis->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
84 QGridLayout* x_vbar =
us_radiobutton( tr(
"Partial Specific Volume" ),
96 QGridLayout* y_vbar =
us_radiobutton( tr(
"Partial Specific Volume" ),
100 QGridLayout* y_f =
us_radiobutton( tr(
"Frictional Coefficient" ),
105 QGridLayout* toggle2 =
us_radiobutton( tr(
"Molecular Weight View" ),
108 QButtonGroup* x_axis =
new QButtonGroup(
this );
115 connect( x_axis, SIGNAL( buttonReleased(
int ) ),
118 QButtonGroup* y_axis =
new QButtonGroup(
this );
125 connect( y_axis, SIGNAL( buttonReleased(
int ) ),
128 QButtonGroup*
toggle_plot =
new QButtonGroup(
this );
129 toggle_plot->addButton(
rb_plot1, 0 );
130 toggle_plot->addButton(
rb_plot2, 1 );
132 connect( toggle_plot, SIGNAL( buttonReleased(
int ) ),
137 cb_fixed->addItem( tr(
"Partial Specific Volume" ) );
138 cb_fixed->addItem( tr(
"Frictional Ratio" ) );
139 cb_fixed->addItem( tr(
"Molecular Weight" ) );
140 cb_fixed->addItem( tr(
"Sedimentation Coefficient" ) );
141 cb_fixed->addItem( tr(
"Diffusion Coefficient" ) );
142 cb_fixed->addItem( tr(
"Frictional Coefficient" ) );
145 connect(
cb_fixed, SIGNAL( activated (
const QString& ) ),
149 lb_xRes->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
153 connect(
ct_xRes, SIGNAL( valueChanged(
double ) ),
157 lb_yRes->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
161 connect(
ct_yRes, SIGNAL( valueChanged(
double ) ),
165 lb_xMin->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
169 connect(
ct_xMin, SIGNAL( valueChanged(
double ) ),
173 lb_xMax->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
177 connect(
ct_xMax, SIGNAL( valueChanged(
double ) ),
181 lb_yMin->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
185 connect(
ct_yMin, SIGNAL( valueChanged(
double ) ),
189 lb_yMax->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
193 connect(
ct_yMax, SIGNAL( valueChanged(
double ) ),
197 lb_zVal->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
202 connect(
ct_zVal, SIGNAL( valueChanged(
double ) ),
206 lb_density->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
209 connect( le_density, SIGNAL( textChanged (
const QString& ) ),
213 lb_viscosity->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
216 connect( le_viscosity, SIGNAL( textChanged (
const QString& ) ),
224 QGridLayout *showgrid =
us_checkbox( tr(
"Show Final Grid"),
250 lb_subGrid->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
255 connect(
ct_subGrids, SIGNAL( valueChanged(
double ) ),
260 connect(
pb_reset, SIGNAL( clicked() ),
261 this, SLOT(
reset() ) );
265 connect(
pb_save, SIGNAL( clicked() ),
266 this, SLOT(
save() ) );
270 connect(
pb_help, SIGNAL( clicked() ),
271 this, SLOT(
help() ) );
275 connect(
pb_close, SIGNAL( clicked() ),
276 this, SLOT( close() ) );
282 tr(
"Sedimentation Coefficient (s20,W)"),
283 tr(
"Frictional Ratio f/f0" ) );
286 data_plot1->enableAxis( QwtPlot::xBottom,
true );
287 data_plot1->enableAxis( QwtPlot::yLeft,
true );
288 data_plot1->setAxisScale( QwtPlot::xBottom, 1.0, 40.0 );
289 data_plot1->setAxisScale( QwtPlot::yLeft, 1.0, 4.0 );
291 left->addWidget(
lb_info1, s_row++, 0, 1, 4 );
292 left->addWidget( pb_investigator, s_row, 0, 1, 2 );
295 left->addWidget(
lb_xaxis, s_row, 0, 1, 2 );
296 left->addWidget(
lb_yaxis, s_row++, 2, 1, 2 );
297 left->addLayout( x_s, s_row, 0, 1, 2 );
298 left->addLayout( y_s, s_row++, 2, 1, 2 );
299 left->addLayout( x_ff0, s_row, 0, 1, 2 );
300 left->addLayout( y_ff0, s_row++, 2, 1, 2 );
301 left->addLayout( x_mw, s_row, 0, 1, 2 );
302 left->addLayout( y_mw, s_row++, 2, 1, 2 );
303 left->addLayout( x_vbar, s_row, 0, 1, 2 );
304 left->addLayout( y_vbar, s_row++, 2, 1, 2 );
305 left->addLayout( x_D, s_row, 0, 1, 2 );
306 left->addLayout( y_D, s_row++, 2, 1, 2 );
307 left->addLayout( x_f, s_row, 0, 1, 2 );
308 left->addLayout( y_f, s_row++, 2, 1, 2 );
309 left->addWidget(
lb_fixed, s_row, 0, 1, 2 );
310 left->addWidget(
cb_fixed, s_row++, 2, 1, 2 );
311 left->addLayout( toggle1, s_row, 0, 1, 2 );
312 left->addLayout( toggle2, s_row++, 2, 1, 2 );
313 left->addWidget(
lb_xRes, s_row, 0, 1, 2 );
314 left->addWidget(
ct_xRes, s_row++, 2, 1, 2 );
315 left->addWidget(
lb_yRes, s_row, 0, 1, 2 );
316 left->addWidget(
ct_yRes, s_row++, 2, 1, 2 );
317 left->addWidget(
lb_xMin, s_row, 0, 1, 2 );
318 left->addWidget(
ct_xMin, s_row++, 2, 1, 2 );
319 left->addWidget(
lb_xMax, s_row, 0, 1, 2 );
320 left->addWidget(
ct_xMax, s_row++, 2, 1, 2 );
321 left->addWidget(
lb_yMin, s_row, 0, 1, 2 );
322 left->addWidget(
ct_yMin, s_row++, 2, 1, 2 );
323 left->addWidget(
lb_yMax, s_row, 0, 1, 2 );
324 left->addWidget(
ct_yMax, s_row++, 2, 1, 2 );
325 left->addWidget(
lb_zVal, s_row, 0, 1, 2 );
326 left->addWidget(
ct_zVal, s_row++, 2, 1, 2 );
327 left->addWidget(
lb_density, s_row, 0, 1, 1 );
328 left->addWidget( le_density, s_row, 1, 1, 1 );
330 left->addWidget( le_viscosity, s_row++, 3, 1, 1 );
332 left->addLayout( showgrid, s_row++, 2, 1, 2 );
334 left->addLayout( showsubgrid, s_row++, 2, 1, 2 );
337 left->addWidget(
lb_subGrid, s_row, 0, 1, 2 );
339 left->addWidget(
pb_reset, s_row, 0, 1, 1 );
340 left->addWidget(
pb_save, s_row, 1, 1, 1 );
341 left->addWidget(
pb_help, s_row, 2, 1, 1 );
342 left->addWidget(
pb_close, s_row++, 3, 1, 1 );
344 right->addLayout( plot1 );
346 main->addLayout( left );
347 main->addLayout( right );
348 main->setStretchFactor( left, 2 );
349 main->setStretchFactor( right, 6 );
362 qDebug() <<
"reset yRes" <<
yRes;
381 qDebug() <<
"1)set yRes" <<
yRes;
382 ct_xRes->setRange( 10.0, 1000.0, 1.0 );
383 qDebug() <<
"2)set yRes" <<
yRes;
385 qDebug() <<
"3)set yRes" <<
yRes;
386 ct_yRes->setRange( 10.0, 1000.0, 1.0 );
387 qDebug() <<
"set yRes" <<
yRes;
404 rb_x_s ->setEnabled(
true );
408 rb_x_D ->setEnabled(
true );
409 rb_x_f ->setEnabled(
true );
410 rb_y_s ->setEnabled(
false );
414 rb_y_D ->setEnabled(
true );
415 rb_y_f ->setEnabled(
true );
416 rb_x_s ->setChecked(
true );
435 QString modelPath, modelGuid;
437 QDateTime now_time = QDateTime::currentDateTime ();
438 QList< double > xvals;
439 QList< double > yvals;
440 QList< double > zvals;
441 double gridinc = 1.0 / (double)
subGrids;
446 model.
description = now_time.toString(
"yyyyMMdd-hhmm")
447 +
"-CustomGrid" +
".model";
452 double vbmax = -1e99;
454 double ffmax = -1e99;
457 for (
int ii = 0; ii <
final_grid.size(); ii++ )
470 int indexx = xvals.indexOf( xval ) + 1;
471 int indexy = yvals.indexOf( yval ) + 1;
472 int indexz = zvals.indexOf( zval ) + 1;
473 if ( indexx < 1 ) { indexx = xvals.size() + 1; xvals << xval; }
474 if ( indexy < 1 ) { indexy = yvals.size() + 1; yvals << yval; }
475 if ( indexz < 1 ) { indexz = zvals.size() + 1; zvals << zval; }
476 sc.
name = QString().sprintf(
"X%3.3dY%3.3dZ%2.2d",
477 indexx, indexy, indexz );
479 if ( (++indexsg) >
subGrids ) indexsg = 1;
481 for (
int jj = 0; jj < model.
components.size(); jj++ )
483 vbmin = qMin( vbmin, sc.
vbar20 );
484 vbmax = qMax( vbmax, sc.
vbar20 );
485 ffmin = qMin( ffmin, sc.
f_f0 );
486 ffmax = qMax( ffmax, sc.
f_f0 );
503 QString msg1 = tr(
"A grid model has been created. "
504 "It's description is:<br/><b>" )
506 + tr(
"Click:<br/><br/>" )
507 + tr(
" <b>OK</b> to output the model as is;<br/>"
508 " <b>Edit</b> to append custom text to the name;<br/>"
509 " <b>Cancel</b> to abort model creation.<br/>" );
511 mbox.setWindowTitle( tr(
"Save Grid Model" ) );
512 mbox.setText ( msg1 );
513 QPushButton *pb_ok = mbox.addButton( tr(
"OK" ),
514 QMessageBox::YesRole );
515 QPushButton *pb_edit = mbox.addButton( tr(
"Edit" ) ,
516 QMessageBox::AcceptRole );
517 QPushButton *pb_canc = mbox.addButton( tr(
"Cancel" ),
518 QMessageBox::RejectRole );
519 mbox.setEscapeButton ( pb_canc );
520 mbox.setDefaultButton( pb_ok );
524 if ( mbox.clickedButton() == pb_canc )
return;
526 if ( mbox.clickedButton() == pb_edit )
529 QString newtext =
"";
532 QString msg2 = tr(
"The default run ID for the grid model<br/>"
534 + tr(
"You may append additional text to the model description.<br/>"
535 "Use alphanumeric characters, underscores, or hyphens<br/>"
536 "(no spaces). Enter 1 to 40 characters." );
537 newtext = QInputDialog::getText(
this,
538 tr(
"Modify Model Name" ),
546 newtext.remove( QRegExp(
"[^\\w\\d_-]" ) );
548 int slen = newtext.length();
549 if ( slen > 40 ) newtext = newtext.left( 40 );
560 code = model.
write( &db );
566 code = model.
write( fnamo );
569 QString mtitle = tr(
"Grid Model Saving..." );
574 tr (
"local disk and database." ) :
575 tr (
"local disk." );
576 QMessageBox::information(
this, mtitle,
578 + tr(
"\"\n was successfully saved to " ) + destination );
582 QMessageBox::warning(
this, mtitle,
583 tr(
"Writing the model file \"") + model.
description
584 + tr(
"\"\n resulted in error code " )
585 + QString::number( code ) +
" ." );
592 qDebug() <<
"ux1)yRes" <<
yRes;
594 qDebug() <<
"ux2)yRes" <<
yRes;
596 qDebug() <<
"ux3)yRes" <<
yRes;
613 connect(
ct_xMax, SIGNAL( valueChanged(
double ) ),
628 connect(
ct_xMin, SIGNAL( valueChanged(
double ) ),
640 qDebug() <<
"update_yMin" <<
yMin;
644 connect(
ct_yMax, SIGNAL( valueChanged(
double ) ),
656 qDebug() <<
"update_yMax" <<
yMax;
660 connect(
ct_yMin, SIGNAL( valueChanged(
double ) ),
699 if ( str.toDouble() == 0.0 )
return;
710 if ( str.toDouble() == 0.0 )
return;
720 qDebug() <<
"update_plot: call calc_gridpoints()";
724 QString xatitle = tr(
"Sedimentation Coefficient" );
725 QString yatitle = tr(
"Frictional Ratio" );
726 qDebug() <<
" up0)yRes" <<
yRes;
732 xatitle = tr(
"Sedimentation Coefficient" );
735 xatitle = tr(
"Frictional Ratio" );
738 xatitle = tr(
"Molecular Weight" );
741 xatitle = tr(
"Partial Specific Volume" );
744 xatitle = tr(
"Diffusion Coefficient" );
747 xatitle = tr(
"Frictional Coefficient" );
754 yatitle = tr(
"Sedimentation Coefficient" );
758 yatitle = tr(
"Frictional Ratio" );
761 yatitle = tr(
"Molecular Weight" );
764 yatitle = tr(
"Partial Specific Volume" );
767 yatitle = tr(
"Diffusion Coefficient" );
770 yatitle = tr(
"Frictional Coefficient" );
775 xatitle = tr(
"Molecular Weight" );
777 data_plot1->setAxisTitle( QwtPlot::xBottom, xatitle );
778 data_plot1->setAxisTitle( QwtPlot::yLeft, yatitle );
782 QVector <double> xData1;
783 QVector <double> yData1;
784 QVector <double> xData2;
785 QVector <double> yData2;
799 for (
int ii = 0; ii < gridsize; ii++ )
816 sym1.setStyle( QwtSymbol::Ellipse );
817 sym1.setBrush( QColor( Qt::red ) );
818 sym1.setPen ( QColor( Qt::red ) );
822 c1->setData ( xData1.data(), yData1.data(), xData1.size());
823 c1->setSymbol( sym1 );
824 c1->setStyle ( QwtPlotCurve::NoCurve );
828 sym2.setStyle( QwtSymbol::Ellipse );
829 sym2.setBrush( QColor( Qt::yellow ) );
830 sym2.setPen ( QColor( Qt::yellow ) );
834 c2->setData ( xData2.data(), yData2.data(), xData2.size());
835 c2->setSymbol( sym2 );
836 c2->setStyle ( QwtPlotCurve::NoCurve );
845 for (
int ii = 0; ii < gridsize; ii++ )
867 sym1.setStyle( QwtSymbol::Ellipse );
868 sym1.setBrush( QColor( Qt::red ) );
869 sym1.setPen ( QColor( Qt::red ) );
873 c1->setData ( xData1.data(), yData1.data(), xData1.size());
874 c1->setSymbol( sym1 );
875 c1->setStyle ( QwtPlotCurve::NoCurve );
879 sym2.setStyle( QwtSymbol::Ellipse );
880 sym2.setBrush( QColor( Qt::yellow ) );
881 sym2.setPen ( QColor( Qt::yellow ) );
885 c2->setData ( xData2.data(), yData2.data(), xData2.size());
886 c2->setSymbol( sym2 );
887 c2->setStyle ( QwtPlotCurve::NoCurve );
893 qDebug() <<
" updplt: gridsize" << gridsize;
894 xData1.resize( gridsize );
895 yData1.resize( gridsize );
897 for (
int ii = 0; ii < gridsize; ii++ )
905 sym.setStyle( QwtSymbol::Ellipse );
906 sym.setBrush( QColor( Qt::yellow ) );
907 sym.setPen ( QColor( Qt::yellow ) );
911 c1->setData ( xData1.data(), yData1.data(), gridsize );
912 c1->setSymbol( sym );
913 c1->setStyle ( QwtPlotCurve::NoCurve );
916 qDebug() <<
" up9)yRes" <<
yRes;
917 data_plot1->setAxisAutoScale( QwtPlot::xBottom );
918 data_plot1->setAxisAutoScale( QwtPlot::yLeft );
928 qDebug() <<
" cg1)yRes" <<
yRes;
946 qDebug() <<
" cg2)yRes" <<
yRes;
955 qDebug() <<
" cg3)yRes" <<
yRes;
960 int nxvals = (int)
xRes;
961 int nyvals = (int)
yRes;
965 qDebug() <<
"calc_g: zVal nx ny" <<
zVal << nxvals << nyvals
966 <<
"xMin xMax xinc" <<
xMin <<
xMax << xinc
967 <<
"yMin yMax yinc" <<
yMin <<
yMax << yinc;
990 qDebug() <<
" cg4)yRes" <<
yRes;
993 qDebug() <<
"calc_g: CG2";
999 for (
int ii = 0; ii < nxvals; ii++ )
1005 for (
int jj = 0; jj < nyvals; jj++ )
1007 tmp_point.
ff0 = yval;
1019 qDebug() <<
" cg5)yRes" <<
yRes;
1026 for (
int ii = 0; ii < nxvals; ii++ )
1032 for (
int jj = 0; jj < nyvals; jj++ )
1034 tmp_point.
mw = yval;
1045 if ( tmp_point.
ff0 < 1.0 )
1050 qDebug() <<
" ii jj" << ii << jj <<
"s w k" << tmp_point.
s << tmp_point.
mw
1056 qDebug() <<
" (n)ff0" <<
current_grid[nxvals*nyvals-1].ff0;
1057 qDebug() <<
" lstiek lstjek" << lstiek << lstjek <<
"nxy" << nxvals << nyvals;
1062 for (
int ii = 0; ii < nxvals; ii++ )
1068 for (
int jj = 0; jj < nyvals; jj++ )
1070 tmp_point.
vbar = yval;
1075 else if ( plot_z ==
ATTR_W )
1077 else if ( plot_z ==
ATTR_D )
1079 else if ( plot_z ==
ATTR_F )
1090 if ( tmp_point.
ff0 < 1.0 )
1098 for (
int ii = 0; ii < nxvals; ii++ )
1104 for (
int jj = 0; jj < nyvals; jj++ )
1117 if ( tmp_point.
ff0 < 1.0 )
1125 for (
int ii = 0; ii < nxvals; ii++ )
1131 for (
int jj = 0; jj < nyvals; jj++ )
1144 if ( tmp_point.
ff0 < 1.0 )
1152 for (
int ii = 0; ii < nxvals; ii++ )
1154 tmp_point.
ff0 = xval;
1158 for (
int jj = 0; jj < nyvals; jj++ )
1176 for (
int ii = 0; ii < nxvals; ii++ )
1178 tmp_point.
ff0 = xval;
1182 for (
int jj = 0; jj < nyvals; jj++ )
1184 tmp_point.
mw = yval;
1200 for (
int ii = 0; ii < nxvals; ii++ )
1202 tmp_point.
ff0 = xval;
1206 for (
int jj = 0; jj < nyvals; jj++ )
1208 tmp_point.
vbar = yval;
1213 else if ( plot_z ==
ATTR_W )
1215 else if ( plot_z ==
ATTR_D )
1217 else if ( plot_z ==
ATTR_F )
1233 for (
int ii = 0; ii < nxvals; ii++ )
1235 tmp_point.
ff0 = xval;
1239 for (
int jj = 0; jj < nyvals; jj++ )
1257 for (
int ii = 0; ii < nxvals; ii++ )
1259 tmp_point.
ff0 = xval;
1263 for (
int jj = 0; jj < nyvals; jj++ )
1281 for (
int ii = 0; ii < nxvals; ii++ )
1283 tmp_point.
mw = xval;
1287 for (
int jj = 0; jj < nyvals; jj++ )
1300 if ( tmp_point.
ff0 < 1.0 )
1308 for (
int ii = 0; ii < nxvals; ii++ )
1310 tmp_point.
mw = xval;
1314 for (
int jj = 0; jj < nyvals; jj++ )
1316 tmp_point.
ff0 = yval;
1332 for (
int ii = 0; ii < nxvals; ii++ )
1334 tmp_point.
mw = xval;
1338 for (
int jj = 0; jj < nyvals; jj++ )
1340 tmp_point.
vbar = yval;
1345 else if ( plot_z ==
ATTR_K )
1347 else if ( plot_z ==
ATTR_D )
1349 else if ( plot_z ==
ATTR_F )
1360 if ( tmp_point.
ff0 < 1.0 )
1368 for (
int ii = 0; ii < nxvals; ii++ )
1370 tmp_point.
mw = xval;
1374 for (
int jj = 0; jj < nyvals; jj++ )
1387 if ( tmp_point.
ff0 < 1.0 )
1395 for (
int ii = 0; ii < nxvals; ii++ )
1397 tmp_point.
mw = xval;
1401 for (
int jj = 0; jj < nyvals; jj++ )
1414 if ( tmp_point.
ff0 < 1.0 )
1422 for (
int ii = 0; ii < nxvals; ii++ )
1424 tmp_point.
vbar = xval;
1428 for (
int jj = 0; jj < nyvals; jj++ )
1435 else if ( plot_z ==
ATTR_W )
1437 else if ( plot_z ==
ATTR_D )
1439 else if ( plot_z ==
ATTR_F )
1450 if ( tmp_point.
ff0 < 1.0 )
1458 for (
int ii = 0; ii < nxvals; ii++ )
1460 tmp_point.
vbar = xval;
1464 for (
int jj = 0; jj < nyvals; jj++ )
1466 tmp_point.
ff0 = yval;
1471 else if ( plot_z ==
ATTR_W )
1473 else if ( plot_z ==
ATTR_D )
1475 else if ( plot_z ==
ATTR_F )
1491 for (
int ii = 0; ii < nxvals; ii++ )
1493 tmp_point.
vbar = xval;
1497 for (
int jj = 0; jj < nyvals; jj++ )
1499 tmp_point.
mw = yval;
1504 else if ( plot_z ==
ATTR_K )
1506 else if ( plot_z ==
ATTR_D )
1508 else if ( plot_z ==
ATTR_F )
1519 if ( tmp_point.
ff0 < 1.0 )
1527 for (
int ii = 0; ii < nxvals; ii++ )
1529 tmp_point.
vbar = xval;
1533 for (
int jj = 0; jj < nyvals; jj++ )
1540 else if ( plot_z ==
ATTR_K )
1542 else if ( plot_z ==
ATTR_W )
1544 else if ( plot_z ==
ATTR_F )
1555 if ( tmp_point.
ff0 < 1.0 )
1563 for (
int ii = 0; ii < nxvals; ii++ )
1565 tmp_point.
vbar = xval;
1569 for (
int jj = 0; jj < nyvals; jj++ )
1576 else if ( plot_z ==
ATTR_K )
1578 else if ( plot_z ==
ATTR_W )
1580 else if ( plot_z ==
ATTR_D )
1591 if ( tmp_point.
ff0 < 1.0 )
1599 for (
int ii = 0; ii < nxvals; ii++ )
1605 for (
int jj = 0; jj < nyvals; jj++ )
1618 if ( tmp_point.
ff0 < 1.0 )
1626 for (
int ii = 0; ii < nxvals; ii++ )
1632 for (
int jj = 0; jj < nyvals; jj++ )
1634 tmp_point.
ff0 = yval;
1650 for (
int ii = 0; ii < nxvals; ii++ )
1656 for (
int jj = 0; jj < nyvals; jj++ )
1658 tmp_point.
mw = yval;
1669 if ( tmp_point.
ff0 < 1.0 )
1677 for (
int ii = 0; ii < nxvals; ii++ )
1683 for (
int jj = 0; jj < nyvals; jj++ )
1685 tmp_point.
vbar = yval;
1690 else if ( plot_z ==
ATTR_K )
1692 else if ( plot_z ==
ATTR_W )
1694 else if ( plot_z ==
ATTR_F )
1705 if ( tmp_point.
ff0 < 1.0 )
1713 for (
int ii = 0; ii < nxvals; ii++ )
1719 for (
int jj = 0; jj < nyvals; jj++ )
1732 if ( tmp_point.
ff0 < 1.0 )
1740 for (
int ii = 0; ii < nxvals; ii++ )
1746 for (
int jj = 0; jj < nyvals; jj++ )
1759 if ( tmp_point.
ff0 < 1.0 )
1767 for (
int ii = 0; ii < nxvals; ii++ )
1773 for (
int jj = 0; jj < nyvals; jj++ )
1775 tmp_point.
ff0 = yval;
1791 for (
int ii = 0; ii < nxvals; ii++ )
1797 for (
int jj = 0; jj < nyvals; jj++ )
1799 tmp_point.
mw = yval;
1810 if ( tmp_point.
ff0 < 1.0 )
1818 for (
int ii = 0; ii < nxvals; ii++ )
1824 for (
int jj = 0; jj < nyvals; jj++ )
1826 tmp_point.
vbar = yval;
1831 else if ( plot_z ==
ATTR_K )
1833 else if ( plot_z ==
ATTR_W )
1835 else if ( plot_z ==
ATTR_D )
1846 if ( tmp_point.
ff0 < 1.0 )
1854 for (
int ii = 0; ii < nxvals; ii++ )
1860 for (
int jj = 0; jj < nyvals; jj++ )
1873 if ( tmp_point.
ff0 < 1.0 )
1878 qDebug() <<
"calc_g: xval yval" << xval << yval
1881 if ( nerr_w > 0 || nerr_k > 0 ||
current_grid.size() == 0 )
1887 wmsg = tr(
"Presently, one of the axes or the fixed attribute "
1888 "must be Partial Specific Volume (vbar). Please "
1889 "select the Axis types and Fixed attribute so that "
1890 "one of them is Partial Specific Volume." );
1893 else if ( nerr_w > 0 )
1895 wmsg = tr(
"You have selected a nonsensical parameter setting. "
1896 "The product of the sedimentation coefficient, s, "
1897 "and the buoyancy term, (1 - vbar * Density), "
1898 "must be positive. Please examine your settings for "
1899 "the sedimentation coefficient range, the density, "
1900 "and the partial specific volume before proceeding." );
1903 else if ( nerr_k > 0 )
1905 wmsg = tr(
"You have selected a set of parameter settings that "
1906 "result in f/f0 value(s) less than 1. "
1907 "Please adjust the fixed value or ranges so that "
1908 "the frictional ratio is at least 1." );
1913 wmsg = tr(
"Grid size is zero" );
1916 QMessageBox::warning(
this,
1917 tr(
"Invalid Attributes/Parameters" ),
1926 #if 0 // Currently, we simply do not handle cases with no vbar given
1948 int nxvals = (int)
xRes;
1949 int nyvals = (int)
yRes;
2074 const double xvmns[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
2075 const double xvmxs[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7 };
2076 const double xmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
2077 const double xmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
2078 const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
2079 const QString xtitls[] = { tr(
"s (x 1e13)" ),
2087 lb_xRes->setText( xtitls[
plot_x ] + tr(
" Resolution:" ) );
2094 ct_xMin->setRange( xmins[
plot_x ], xmaxs[ plot_x ], xincs[ plot_x ] );
2095 ct_xMax->setRange( xmins[ plot_x ], xmaxs[ plot_x ], xincs[ plot_x ] );
2099 connect(
ct_xMin, SIGNAL( valueChanged(
double ) ),
2101 connect(
ct_xMax, SIGNAL( valueChanged(
double ) ),
2120 cb_fixed->addItem( tr(
"Partial Specific Volume" ) );
2122 cb_fixed->addItem( tr(
"Frictional Ratio" ) );
2124 cb_fixed->addItem( tr(
"Molecular Weight" ) );
2126 cb_fixed->addItem( tr(
"Sedimentation Coefficient" ) );
2128 cb_fixed->addItem( tr(
"Diffusion Coefficient" ) );
2130 cb_fixed->addItem( tr(
"Frictional Coefficient" ) );
2133 connect(
cb_fixed, SIGNAL( activated (
const QString& ) ),
2145 const double yvmns[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
2146 const double yvmxs[] = { 10.0, 4.0, 1e+6, 0.80, 1e-7, 1e-7 };
2147 const double ymins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
2148 const double ymaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
2149 const double yincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
2150 const QString ytitls[] = { tr(
"s (x 1e13)" ),
2158 lb_yRes->setText( ytitls[
plot_y ] + tr(
" Resolution:" ) );
2165 ct_yMin->setRange( ymins[
plot_y ], ymaxs[ plot_y ], yincs[ plot_y ] );
2166 ct_yMax->setRange( ymins[ plot_y ], ymaxs[ plot_y ], yincs[ plot_y ] );
2170 connect(
ct_yMin, SIGNAL( valueChanged(
double ) ),
2172 connect(
ct_yMax, SIGNAL( valueChanged(
double ) ),
2191 cb_fixed->addItem( tr(
"Partial Specific Volume" ) );
2193 cb_fixed->addItem( tr(
"Frictional Ratio" ) );
2195 cb_fixed->addItem( tr(
"Molecular Weight" ) );
2197 cb_fixed->addItem( tr(
"Sedimentation Coefficient" ) );
2199 cb_fixed->addItem( tr(
"Diffusion Coefficient" ) );
2201 cb_fixed->addItem( tr(
"Frictional Coefficient" ) );
2204 connect(
cb_fixed, SIGNAL( activated (
const QString& ) ),
2216 const double zmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e+6, 1e+6 };
2217 const double zmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e+8, 1e+6 };
2218 const double zincs[] = { 0.01, 0.01, 1000.0, 0.001, 1e+5, 1e+5 };
2221 plot_z = fixstr.contains( tr(
"Partial S" ) ) ?
ATTR_V : 0;
2227 qDebug() <<
"SelFix: " << fixstr <<
"plot_z" <<
plot_z;
2229 ct_zVal->setRange( zmins[ plot_z ], zmaxs[ plot_z ], zincs[ plot_z ] );
2265 int maxsubgrids = (int)
final_grid.size()/50;
2266 int defsubgrids = ( maxsubgrids / 2 ) | 1;
2267 DbgLv(1) <<
"finalsize" <<
final_grid.size() <<
"maxsubgs" << maxsubgrids;
2303 QString inv_text = QString::number( investigator ) +
": "
2312 double gvalue = ( atype ==
ATTR_S ) ? gpoint.
s : 0.0;
2313 gvalue = ( atype ==
ATTR_K ) ? gpoint.
ff0 : gvalue;
2314 gvalue = ( atype ==
ATTR_W ) ? gpoint.
mw : gvalue;
2315 gvalue = ( atype ==
ATTR_V ) ? gpoint.
vbar : gvalue;
2316 gvalue = ( atype ==
ATTR_D ) ? gpoint.
D : gvalue;
2317 gvalue = ( atype ==
ATTR_F ) ? gpoint.
f : gvalue;
2326 double buoy = 1.0 - vbar *
density;
2336 double buoy = 1.0 - vbar *
density;
2337 double sval = gpoint.
s * 1.0e-13;
2341 * pow( ( sval * vbar / ( 2.0 * buoy ) ), 0.5 ) );
2347 gpoint.
mw = sval *
R *
K20 / ( gpoint.
D * buoy );
2349 gpoint.
f0 = gpoint.
f / gpoint.
ff0;
2359 double buoy = 1.0 - vbar *
density;
2368 double buoy = 1.0 - vbar *
density;
2377 double buoy = 1.0 - vbar *
density;
2378 double sval = gpoint.
s * 1.0e-13;
2379 double ssgn = ( gpoint.
s < 0.0 ) ? -1.0 : 1.0;
2380 gpoint.
D = ssgn * sval *
R *
K20 / ( buoy * gpoint.
mw );
2381 gpoint.
f = ssgn * gpoint.
mw * buoy / ( sval *
AVOGADRO );
2385 gpoint.
f0 = ( gpoint.
f0 == 0.0 ) ? 1.0 : gpoint.
f0;
2386 gpoint.
ff0 = gpoint.
f / gpoint.
f0;
2387 gpoint.
ff0 = qRound( gpoint.
ff0 * 1.0e+5 ) * 1.0e-5;
2398 double buoy = 1.0 - vbar *
density;
2400 qDebug() <<
"comp_swd buoy" << buoy;
2408 double buoy = 1.0 - vbar *
density;
2409 qDebug() <<
"comp_swf buoy" << buoy;
2418 double buoy = 1.0 - vbar *
density;
2419 double ssgn = ( gpoint.
s < 0.0 ) ? -1.0 : 1.0;
2420 double sval = gpoint.
s * 1.0e-13;
2422 gpoint.
mw = ssgn * sval *
R *
K20 / ( gpoint.
D * buoy );
2426 gpoint.
f0 = gpoint.
f / qMax( 1.0, gpoint.
ff0 );
2435 double buoy = 1.0 - vbar *
density;
2436 double ssgn = ( gpoint.
s < 0.0 ) ? -1.0 : 1.0;
2437 double sval = gpoint.
s * 1.0e-13;
2439 gpoint.
mw = ssgn * sval *
R *
K20 / ( gpoint.
D * buoy );
2443 gpoint.
ff0 = qRound( gpoint.
ff0 * 1.0e+5 ) * 1.0e-5;
2444 gpoint.
f0 = gpoint.
f / qMax( 1.0, gpoint.
ff0 );
2453 double buoy = 1.0 - vbar *
density;
2454 qDebug() <<
"comp_sdf buoy" << buoy;
2456 gpoint.
ff0 = qRound( gpoint.
ff0 * 1.0e+5 ) * 1.0e-5;
2464 double buoy = 1.0 - vbar *
density;
2468 gpoint.
f0 = viscf * pow( ( 162.0 * gpoint.
mw *
MPISQ * vbrat ),
THIRD );
2469 gpoint.
f = gpoint.
ff0 * gpoint.
f0;
2470 gpoint.
s = 1.0e13 * gpoint.
mw * buoy / (
AVOGADRO * gpoint.
f );
2480 double buoy = 1.0 - vbar *
density;
2481 qDebug() <<
"comp_kwd buoy" << buoy;
2490 double buoy = 1.0 - vbar *
density;
2491 qDebug() <<
"comp_kwf buoy" << buoy;
2500 double buoy = 1.0 - vbar *
density;
2501 qDebug() <<
"comp_kvd buoy" << buoy;
2503 gpoint.
f0 = gpoint.
f / qMax( 1.0, gpoint.
ff0 );
2504 double sphere = gpoint.
f0 / ( 0.06 * M_PI *
VISC_20W );
2505 double volume = ( 4.0 / 3.0 ) * M_PI * pow( sphere, 3.0 );
2507 double sval = gpoint.
mw * buoy / (
AVOGADRO * gpoint.
f );
2508 gpoint.
s = sval * 1.0e+13;
2509 gpoint.
ff0 = ( gpoint.
f0 != 0.0 ) ? gpoint.
f / gpoint.
f0 : 1.0;
2518 double buoy = 1.0 - vbar *
density;
2519 qDebug() <<
"comp_kvf buoy" << buoy;
2520 gpoint.
f0 = gpoint.
f / qMax( 1.0, gpoint.
ff0 );
2522 double sphere = gpoint.
f0 / ( 0.06 * M_PI *
VISC_20W );
2523 double volume = ( 4.0 / 3.0 ) * M_PI * pow( sphere, 3.0 );
2525 double sval = gpoint.
mw * buoy / (
AVOGADRO * gpoint.
f );
2526 gpoint.
s = sval * 1.0e+13;
2535 double buoy = 1.0 - vbar *
density;
2536 qDebug() <<
"comp_kdf buoy" << buoy;
2545 double buoy = 1.0 - vbar *
density;
2546 qDebug() <<
"comp_wvd buoy" << buoy;
2550 double sval = gpoint.
D * buoy * gpoint.
mw / (
R *
K20 );
2551 gpoint.
f = gpoint.
mw * buoy / ( sval *
AVOGADRO );
2552 gpoint.
ff0 = ( gpoint.
f0 != 0.0 ) ? gpoint.
f / gpoint.
f0 : 1.0;
2553 gpoint.
s = sval * 1.0e+13;
2562 double buoy = 1.0 - vbar *
density;
2563 qDebug() <<
"comp_wvf buoy" << buoy;
2567 gpoint.
ff0 = ( gpoint.
f0 != 0.0 ) ? gpoint.
f / gpoint.
f0 : 1.0;
2568 double sval = gpoint.
mw * buoy / (
AVOGADRO * gpoint.
f );
2569 gpoint.
D = sval *
R *
K20 / ( buoy * gpoint.
mw );
2570 gpoint.
s = sval * 1.0e+13;
2579 double buoy = 1.0 - vbar *
density;
2580 qDebug() <<
"comp_wdf buoy" << buoy;
2581 gpoint.
ff0 = qRound( gpoint.
ff0 * 1.0e+5 ) * 1.0e-5;
2590 double buoy = 1.0 - vbar *
density;
2591 qDebug() <<
"comp_vdf buoy" << buoy;
2592 gpoint.
ff0 = qRound( gpoint.
ff0 * 1.0e+5 ) * 1.0e-5;
2603 if ( buoy == 0.0 || gpoint.
vbar == 0.0 ||
2604 ( gpoint.
s < 0 && buoy > 0.0 ) ||
2605 ( gpoint.
s > 0 && buoy < 0.0 ) )
2630 qDebug() <<
"valFF0: xMin xMax yMin yMax" << xMin <<
xMax <<
yMin <<
yMax;
2639 double ffx1y1 = tmp_point.
ff0;
2645 double ffx1y2 = tmp_point.
ff0;
2651 double ffx2y1 = tmp_point.
ff0;
2657 double ffx2y2 = tmp_point.
ff0;
2659 double ff0min = qMin( ffx1y1, ffx1y2 );
2660 ff0min = qMin( ff0min, ffx2y1 );
2661 ff0min = qMin( ff0min, ffx2y2 );
2662 qDebug() <<
"valFF0: zVal xMin yMin ff0" <<
zVal << xMin <<
yMin << ffx1y1;
2663 qDebug() <<
"valFF0: xMin yMax ff0 " << xMin << yMax << ffx1y2;
2664 qDebug() <<
"valFF0: xMax yMin ff0 " <<
xMax <<
yMin << ffx2y1;
2665 qDebug() <<
"valFF0: xMax yMax ff0 " <<
xMax << yMax << ffx2y2;
2677 if ( ffx1y1 < ffx1y2 )
2683 if ( ffx1y1 < ffx2y1 )
2685 qDebug() <<
"valFF0: (1xMin)xVal" << xVal;
2692 qDebug() <<
"valFF0: (2xMin)xVal" << xVal;
2704 if ( ffx1y1 < ffx2y1 )
2706 qDebug() <<
"valFF0: (3xMin)xVal" << xVal;
2713 qDebug() <<
"valFF0: (4xMin)xVal" << xVal;
2719 connect(
ct_xMin, SIGNAL( valueChanged(
double ) ),
2721 connect(
ct_xMax, SIGNAL( valueChanged(
double ) ),
2732 if ( ffx1y1 < ffx2y1 )
2738 if ( ffx1y1 < ffx1y2 )
2740 qDebug() <<
"valFF0: (5yMin)yVal" << yVal;
2747 qDebug() <<
"valFF0: (6yMax)yVal" << yVal;
2759 if ( ffx1y1 < ffx1y2 )
2761 qDebug() <<
"valFF0: (7yMin)yVal" << yVal;
2768 qDebug() <<
"valFF0: (8yMax)yVal" << yVal;
2774 connect(
ct_yMin, SIGNAL( valueChanged(
double ) ),
2776 connect(
ct_yMax, SIGNAL( valueChanged(
double ) ),
2785 qDebug() <<
"valFF0: (out)xMin xMax yMin yMax" << xMin <<
xMax <<
yMin <<
yMax;
2807 else if ( atype ==
ATTR_K )
2808 gpoint.
ff0 = gvalue;
2809 else if ( atype ==
ATTR_W )
2811 else if ( atype ==
ATTR_V )
2812 gpoint.
vbar = gvalue;
2813 else if ( atype ==
ATTR_D )
2815 else if ( atype ==
ATTR_F )
2823 sc.
s = gpoint.
s * 1.0e-13;
2834 gpoint.
s = sc.
s * 1.0e+13;