瀏覽代碼

Removal of Boost progress bar

master
Trevor Irons 5 年之前
父節點
當前提交
d06a6948a8
共有 2 個文件被更改,包括 17 次插入18 次删除
  1. 3
    3
      include/KernelV0.h
  2. 14
    15
      src/KernelV0.cpp

+ 3
- 3
include/KernelV0.h 查看文件

@@ -25,6 +25,8 @@
25 25
 #include "PolygonalWireAntenna.h"
26 26
 #include "EMEarth1D.h"
27 27
 
28
+#include "ProgressBar.h"
29
+
28 30
 #ifdef LEMMAUSEVTK
29 31
 //#include "vtkHyperOctree.h"
30 32
 //#include "vtkHyperOctreeCursor.h"
@@ -391,10 +393,8 @@ namespace Lemma {
391 393
         std::map< int, Real >                     LeafDictErr;   // error value
392 394
         #endif
393 395
 
394
-        #ifdef HAVE_BOOST_PROGRESS
395
-        boost::progress_display* disp;
396
+        ProgressBar* disp;
396 397
         int percent_done;
397
-        #endif
398 398
 
399 399
         // Physical constants and conversion factors
400 400
         static constexpr Real GAMMA = 2.67518e8;                  // MKS units

+ 14
- 15
src/KernelV0.cpp 查看文件

@@ -241,19 +241,23 @@ namespace Lemma {
241 241
         //for (ilay=0; ilay<Interfaces.size()-1; ++ilay) {
242 242
         std::cout.precision(3);
243 243
         for (ilay=0; ilay<Interfaces.size()-1; ++ilay) {
244
-            std::cout << "\n\nLayer " << ilay << "\tfrom " << Interfaces(ilay) <<" to "
245
-                      << Interfaces(ilay+1); // << std::endl;
244
+            //std::cout << "\n\nLayer " << ilay << "\tfrom " << Interfaces(ilay) <<" to "
245
+            //          << Interfaces(ilay+1) << std::endl;
246 246
             Size(2) = Interfaces(ilay+1) - Interfaces(ilay);
247 247
             Origin(2) = Interfaces(ilay);
248 248
 
249
-            #ifdef HAVE_BOOST_PROGRESS
249
+            //#ifdef HAVE_BOOST_PROGRESS
250 250
             percent_done = 0;
251
-            disp = new boost::progress_display( 100 );
251
+            disp = new ProgressBar( 100 );
252
+            disp->printNewMessage( "Integrating layer " + std::to_string(ilay) + " from " + std::to_string(Interfaces(ilay)) +
253
+                    " to " + std::to_string( Interfaces(ilay+1)) );
252 254
             IntegrateOnOctreeGrid( vtkOutput );
255
+            //disp->updateLastPrintedMessage("Number of leaves: " + std::to_string(nleaves));
256
+            disp->printNewMessage("Number of leaves: " + std::to_string(nleaves));
253 257
             delete disp;
254
-            #else
255
-            IntegrateOnOctreeGrid( vtkOutput );
256
-            #endif
258
+            //#else
259
+            //IntegrateOnOctreeGrid( vtkOutput );
260
+            //#endif
257 261
             //std::cout << "Kernel row " << Kern.row(ilay);
258 262
         }
259 263
         std::cout << "\nFinished KERNEL\n";
@@ -555,15 +559,13 @@ namespace Lemma {
555 559
     void KernelV0::EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
556 560
         const VectorXcr& parentVal ) {
557 561
 
558
-        #ifdef HAVE_BOOST_PROGRESS
559 562
         int pdone =  (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2]));
560 563
         if (pdone > percent_done ) {
561 564
             percent_done = pdone;
562 565
             ++(*disp);
563 566
         }
564
-        #else
565
-        std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
566
-        #endif
567
+        //disp->updateLastPrintedMessage("Number of leaves: " + std::to_string(nleaves));
568
+        //std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
567 569
         //std::cout.flush();
568 570
 
569 571
         // Next level step, interested in one level below
@@ -644,15 +646,12 @@ namespace Lemma {
644 646
     void KernelV0::EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
645 647
         const VectorXcr& parentVal, vtkHyperTreeGrid* oct, vtkHyperTreeCursor* curse) {
646 648
 
647
-        #ifdef HAVE_BOOST_PROGRESS
648 649
         int pdone =  (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2]));
649 650
         if (pdone > percent_done ) {
650 651
             percent_done = pdone;
651 652
             ++(*disp);
652 653
         }
653
-        #else
654
-        std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
655
-        #endif
654
+        //disp->updateLastPrintedMessage("Number of leaves: " + std::to_string(nleaves));
656 655
 
657 656
         // Next level step, interested in one level below
658 657
         // bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)

Loading…
取消
儲存