LCOV - code coverage report
Current view: top level - builds/barbot/Cosmos/src/ModelGenerator - result.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2021-06-16 15:43:28 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*******************************************************************************
       2             :  *                                                                             *
       3             :  * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles               *
       4             :  * (S)tochastiques                                                             *
       5             :  *                                                                             *
       6             :  * Copyright (C) 2009-2012 LSV & LACL                                          *
       7             :  * Authors: Paolo Ballarini BenoƮt Barbot & Hilal Djafri                       *
       8             :  * Website: http://www.lsv.ens-cachan.fr/Software/cosmos                       *
       9             :  *                                                                             *
      10             :  * This program is free software; you can redistribute it and/or modify        *
      11             :  * it under the terms of the GNU General Public License as published by        *
      12             :  * the Free Software Foundation; either version 3 of the License, or           *
      13             :  * (at your option) any later version.                                         *
      14             :  *                                                                             *
      15             :  * This program is distributed in the hope that it will be useful,             *
      16             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
      17             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
      18             :  * GNU General Public License for more details.                                *
      19             :  *                                                                             *
      20             :  * You should have received a copy of the GNU General Public License along     *
      21             :  * with this program; if not, write to the Free Software Foundation, Inc.,     *
      22             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                 *
      23             :  * file result.hpp created by Benoit Barbot on 22/05/12.                       *
      24             :  *******************************************************************************
      25             :  */
      26             : 
      27             : #include <sys/time.h>
      28             : #include <sys/resource.h>
      29             : 
      30             : #include <istream>
      31             : #include <fstream>
      32             : #include <ostream>
      33             : 
      34             : #include "parameters.hpp"
      35             : #include "../Simulator/BatchR.hpp"
      36             : 
      37             : #ifndef Cosmos_result_h
      38             : #define Cosmos_result_h
      39             : 
      40             : 
      41             : /**
      42             :  * \brief A class holdings result of the simulation.
      43             :  * This class handle the result of the simulation, it aggregate new result
      44             :  * toghether and format all the output to the user.
      45             :  * This class also decide if the simulation should continue
      46             :  */
      47          31 : class result {
      48             : public:
      49             :         result();
      50             :         
      51             :         //! Add a new batch of result to the result.
      52             :         void addBatch(BatchR&);
      53             :         
      54             :         //! return true if the simulation should continue.
      55             :         bool continueSim();
      56             : 
      57             : 
      58             :     //! Print the result in a compact way on stdout.
      59             :     void printCompactResult();
      60             : 
      61             :         //! Print the progress of the computation on stdout.
      62             :         void printProgress();
      63             :         
      64             :         //! stop the computation clock.
      65             :         void stopclock();
      66             :         
      67             :         //! print the result of the simulation to a stream.
      68             :     void print(std::ostream &s);
      69             :         
      70             :         //! print the result of the simulation to a file.
      71             :         void printResultFile(std::string);
      72             :         
      73             :         //! print the result of the simulation to stdout in format well suited for alligator.
      74             :         void printAlligator();
      75             :         
      76             :         //! Make gnuplot draw the result.
      77             :         void printGnuplot();
      78             :         
      79             :         //! Output the data of CDF or PDF to a file in the gnuplot file format
      80             :         void outputCDFPDF(std::string);
      81             :         
      82             :         //! Output data of the simulation in the gnuplot file format.
      83             :         void outputData();
      84             :         
      85             :         //! Close the interactive gnuplot session.
      86             :         void close_gnuplot();
      87             : 
      88             :     //! The raw result of the computation.
      89             :     BatchR MeanM2;
      90             :     
      91             : private:
      92             :         
      93             :         //! A copy of the parameters.
      94             :         //parameters P;
      95             :         
      96             :         //! timestamps for the strart and end of the simulation.
      97             :         std::chrono::system_clock::time_point start, end;
      98             :         
      99             :         //! timestanmps fot the last time the commandline where updated.
     100             :         std::chrono::system_clock::time_point lastprint;
     101             :         
     102             :         //! timestanmps fot the last time the gnuplot screen where updated.
     103             :         std::chrono::system_clock::time_point lastdraw;
     104             :         
     105             :         //! Total cpu time.
     106             :         double cpu_time_used;
     107             :         
     108             :         //! Stream where to print data.
     109             :         std::fstream outdatastream;
     110             :         
     111             :         //! Flush the gnuplot stream and check for error.
     112             :         void flushgnuplot();
     113             :         
     114             :         //! Stream to the interactive gnuplot session.
     115             :         FILE* gnuplotstream;
     116             :         std::string gnuplotextenstion;
     117             :         
     118             :         //! Number of lines written by the function printProgress.
     119             :         int endline;
     120             :         
     121             :         //! The maximal relative error of the result.
     122             :         double Progress;
     123             :         
     124             :         //! The relative error for each formula.
     125             :         std::vector<double> ProgressArray;
     126             :         
     127             :         //! The result of the estimator of the confidence interval for each formula.
     128             :         std::vector<ConfInt> HaslResult;
     129             :         
     130             :         //! Print a progress bar.
     131             :         void printPercent(double i, double j);
     132             : 
     133             :     int nbColumnGraph;
     134             :     std::tuple<std::string,double> split_name(std::string);
     135             : 
     136             :     size_t maxformulaname;
     137             : 
     138             : };
     139             : 
     140             : 
     141             : #endif

Generated by: LCOV version 1.13