[us-commits] r2745 - in trunk: gui programs/us_astfem_sim programs/us_mpi_analysis utils

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Mon Apr 29 13:17:05 MDT 2019


Author: gegorbet
Date: 2019-04-29 19:17:02 +0000 (Mon, 29 Apr 2019)
New Revision: 2745

Modified:
   trunk/gui/us_editor.cpp
   trunk/gui/us_editor_gui.cpp
   trunk/programs/us_astfem_sim/us_astfem_sim.cpp
   trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
   trunk/utils/us_astfem_math.h
   trunk/utils/us_astfem_rsa.cpp
   trunk/utils/us_simparms.cpp
Log:
Mac mod for File menu, multi-speed bottom handling, fit-meniscus backend from old LIMS

Modified: trunk/gui/us_editor.cpp
===================================================================
--- trunk/gui/us_editor.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/gui/us_editor.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -5,8 +5,8 @@
 #include <QtPrintSupport>
 #endif
 
-US_Editor::US_Editor( int menu, bool readonly, const QString& extension, 
-      QWidget* parent,  Qt::WindowFlags flags ) : QMainWindow( parent, flags )                                                             
+US_Editor::US_Editor( int menu, bool readonly, const QString& extension,
+      QWidget* parent,  Qt::WindowFlags flags ) : QMainWindow( parent, flags )
 {
    file_extension = extension;
    file_directory = US_Settings::dataDir();
@@ -36,6 +36,7 @@
 #else
 #if QT_VERSION > 0x050000
    edMenuBar       = menuBar();
+   edMenuBar->setNativeMenuBar( false );
 #else
    edMenuBar       = new QMenuBar( 0 );
 #endif
@@ -85,13 +86,13 @@
          fileMenu->addAction( clearAction );
    }
 
-   menuBar()->setPalette( US_GuiSettings::normalColor() );
-   menuBar()->setFont   ( QFont( US_GuiSettings::fontFamily(),
+   edMenuBar->setPalette( US_GuiSettings::normalColor() );
+   edMenuBar->setFont   ( QFont( US_GuiSettings::fontFamily(),
                           US_GuiSettings::fontSize() ) );
 
-   currentFont = QFont( "monospace", US_GuiSettings::fontSize() - 1, 
+   currentFont = QFont( "monospace", US_GuiSettings::fontSize() - 1,
                         QFont::Bold );
-   
+
    e = new QTextEdit( this );
    e->setFont          ( currentFont );
    e->setPalette       ( US_GuiSettings::editColor() );
@@ -106,9 +107,9 @@
    QString fn;
    QString text;
 
-   fn = QFileDialog::getOpenFileName( this, 
+   fn = QFileDialog::getOpenFileName( this,
          tr( "Open File" ),
-         file_directory, 
+         file_directory,
          file_extension );
 
   if ( fn == "" ) return;
@@ -136,7 +137,7 @@
 
 void US_Editor::save(  )
 {
-   if ( filename == "" ) 
+   if ( filename == "" )
       saveAs();
    else
       saveFile();
@@ -147,7 +148,7 @@
    QString fn;
 
    fn = QFileDialog::getSaveFileName( this );
-   
+
    if ( ! fn.isEmpty(  ) )
    {
       filename = fn;
@@ -158,7 +159,7 @@
 void US_Editor::saveFile( void )
 {
       QString text = e->toPlainText();
-      
+
       QFile f( filename );
 
       if ( f.open( QIODevice::WriteOnly | QIODevice::Text ) )
@@ -179,7 +180,7 @@
    bool  ok;
    currentFont   = e->font();
    QFont newFont = QFontDialog::getFont( &ok, currentFont, this );
-   
+
    if ( ok )
    {
       currentFont = newFont;
@@ -193,7 +194,7 @@
    QPrintDialog* dialog = new QPrintDialog( &printer, this );
 
    dialog->setWindowTitle( tr( "Print Document" ) );
-   
+
    if ( dialog->exec() != QDialog::Accepted ) return;
 
    QStringList text = e->toPlainText().split( "\n" );
@@ -201,10 +202,10 @@
 
    p.begin( &printer );      // paint on printer
    p.setFont( e->font() );
-      
+
    int yPos = 0;             // y position for each line
    QFontMetrics fm = p.fontMetrics();
-   
+
    const int MARGIN = 10;
 
    for ( int i = 0; i < text.size(); i++ )
@@ -214,15 +215,15 @@
          printer.newPage();   // no more room on this page
          yPos = 0;            // back to top of page
       }
-      
+
       p.drawText( MARGIN, MARGIN + yPos,
                   printer.width(), fm.lineSpacing(),
                   Qt::TextExpandTabs, text[ i ]  );
-      
+
       yPos = yPos + fm.lineSpacing();
     }
 
     p.end();                  // send job to printer
 }
-   
 
+

Modified: trunk/gui/us_editor_gui.cpp
===================================================================
--- trunk/gui/us_editor_gui.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/gui/us_editor_gui.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -19,4 +19,3 @@
    main->addWidget( editor );
 }
 
-

Modified: trunk/programs/us_astfem_sim/us_astfem_sim.cpp
===================================================================
--- trunk/programs/us_astfem_sim/us_astfem_sim.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/programs/us_astfem_sim/us_astfem_sim.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -537,6 +537,12 @@
    US_AstfemMath::writetimestate( tmst_tfpath, simparams, sim_data_all );
 
    simparams.simSpeedsFromTimeState( tmst_tfpath );
+//*DEBUG*
+DbgLv(1) << "ASIM: === speed steps from SSprof ===";
+simparams.speedstepsFromSSprof();
+simparams.debug();
+DbgLv(1) << "ASIM: === speed steps from SSprof ===";
+//*DEBUG*
 
    // Report simulation parameters
    change_status();

Modified: trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
===================================================================
--- trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -306,7 +306,7 @@
    fit_mb_select   = parameters[ "fit_mb_select"   ].toInt();
    meniscus_range  = parameters[ "meniscus_range"  ].toDouble();
    meniscus_points = parameters[ "meniscus_points" ].toInt();
-   fit_mb_select   = ( meniscus_points > 1 ) ? fit_mb_select : 0;
+   fit_mb_select   = ( meniscus_points > 1 ) ?  qMax( 1, fit_mb_select ) : 0;
    fit_meni        = ( ( fit_mb_select & 1 ) != 0 );
    fit_bott        = ( ( fit_mb_select & 2 ) != 0 );
    fit_menbot      = ( fit_meni  &&  fit_bott );

Modified: trunk/utils/us_astfem_math.h
===================================================================
--- trunk/utils/us_astfem_math.h	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_astfem_math.h	2019-04-29 19:17:02 UTC (rev 2745)
@@ -409,6 +409,7 @@
          double start_om2t;       //!< start omega^2t of simulation
          double current_meniscus; //!< actual meniscus for current speed
          double current_bottom;   //!< actual bottom for current speed
+         double bottom_pos;       //!< centerpiece bottom (possibly adjusted)
          int    cdset_speed;      //!< constant speed for current dataset
          int    rg_index;         //!< reaction group index
 

Modified: trunk/utils/us_astfem_rsa.cpp
===================================================================
--- trunk/utils/us_astfem_rsa.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_astfem_rsa.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -146,6 +146,18 @@
    af_params.omega_s     = sq( s0speed * M_PI / 30.0 ); // omega_square
    af_params.start_om2t  = af_params.omega_s;       // Starting omega square t
    af_params.start_time  = 0.0;                     // Starting time
+   af_params.bottom_pos  = simparams.bottom_position;   // Centerpiece bottom
+   if ( simparams.bottom > simparams.bottom_position )
+   {
+      double stretch_val  = stretch( simparams.rotorcoeffs,
+                                     (int)af_params.cdset_speed );
+      double bottom_clc   = simparams.bottom_position + stretch_val;
+      double bott_diff    = simparams.bottom - bottom_clc;
+      if ( qAbs( bott_diff ) > 1.e-5 )
+      {
+         af_params.bottom_pos  = simparams.bottom_position + bott_diff;
+      }
+   }
 #if 1
    adjust_limits( af_params.cdset_speed );          // Does rotor stretch
 #endif
@@ -1217,8 +1229,8 @@
 void US_Astfem_RSA::adjust_limits( int speed )
 {
    // First correct meniscus to theoretical position at rest:
-   double stretch_value        = stretch( simparams.rotorcoeffs,
-                                          (int)af_params.cdset_speed );
+   int icset_speed             = (int)af_params.cdset_speed;
+   double stretch_value        = stretch( simparams.rotorcoeffs, icset_speed );
 DbgLv(1)<< "RSA:adjlim stretch1" << stretch_value << "speed" << af_params.cdset_speed;
 
    // This is the meniscus at rest
@@ -1237,10 +1249,17 @@
 #endif
 #if 1
    // Either use current bottom or add current stretch to bottom at rest
-   if ( simparams.bottom > simparams.bottom_position )
+   if ( icset_speed == speed  &&
+        simparams.bottom > simparams.bottom_position )
+   {  // If the current speed step matches the dataset speed step
+      // and a specific bottom was given, then use that bottom value.
       af_params.current_bottom = simparams.bottom;
+   }
    else
-      af_params.current_bottom = simparams.bottom_position + stretch_value;
+   {  // If no bottom was given or we are at a speed step preceding the
+      // current dataset's, then calculate the bottom value.
+      af_params.current_bottom = af_params.bottom_pos + stretch_value;
+   }
 #endif
 }
 

Modified: trunk/utils/us_simparms.cpp
===================================================================
--- trunk/utils/us_simparms.cpp	2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_simparms.cpp	2019-04-29 19:17:02 UTC (rev 2745)
@@ -1206,8 +1206,8 @@
             (int)qRound( tsobj->time_dvalue( "SetSpeed" ) ) :
                          tsobj->time_ivalue( "SetSpeed" );  // Current set speed
 
-      //if ( ss3 == ss2  &&  ss2 == ss1  &&  ss3 > 0 )
-      if ( ss3 == ss2  &&  ss2 == ss1  &&  ss3 > 3500 )
+      if ( ss3 == ss2  &&  ss2 == ss1  &&  ss3 > 0 )
+      //if ( ss3 == ss2  &&  ss2 == ss1  &&  ss3 > 3500 )
       { // This non-zero set-speed and both previous are the same
          if ( ! cspeeds.contains( ss3 ) )
             cspeeds << ss3;                // Save it if first time encountered



More information about the us-commits mailing list