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 BatchR.hpp created by Benoit Barbot. *
24 : *******************************************************************************
25 : */
26 :
27 :
28 : #include <vector>
29 : #include <iostream>
30 : #include <fstream>
31 : #include <ostream>
32 : //#include <boost/archive/text_oarchive.hpp>
33 : //#include <boost/archive/text_iarchive.hpp>
34 : //#include <boost/serialization/vector.hpp>
35 :
36 :
37 : #ifndef _BATCHR_HPP
38 : #define _BATCHR_HPP
39 :
40 52 : struct SimOutput {
41 : bool accept;
42 : std::vector<double> quantR;
43 : std::vector<bool> qualR;
44 : };
45 :
46 : /**
47 : * This file implement a structure for the result of a batch of
48 : * Simulation it also implement input/output on it.
49 : * It is used both by the simulator and the main program.
50 : */
51 464 : class BatchR {
52 :
53 : public:
54 : BatchR(size_t,size_t);
55 :
56 : //! Number of simulation.
57 : unsigned long int I;
58 :
59 : //! Number of succesfull simulation.
60 : unsigned long int Isucc;
61 :
62 : //! Is a variable a boolean.
63 : std::vector<bool> IsBernoulli;
64 :
65 : //! The mean value of each formula.
66 : std::vector<double> Mean;
67 :
68 : //! The second moment of each formula.
69 : std::vector<double> M2;
70 :
71 : //! The third moment of each formula.
72 : std::vector<double> M3;
73 :
74 : //! The fourth moment of each formula.
75 : std::vector<double> M4;
76 :
77 : //! The Min value of each formula.
78 : std::vector<double> Min;
79 :
80 : //! The Max moment of each formula.
81 : std::vector<double> Max;
82 :
83 : //! Bernouilly variable vector
84 : std::vector< unsigned long int > bernVar;
85 :
86 : //! Time of simulation to produce the result
87 : double simTime;
88 :
89 : //! Add the result of one simulation to the Batch.
90 : void addSim(const SimOutput&);
91 :
92 : //! Merge the result of two batch of simulation.
93 : void unionR(const BatchR&);
94 :
95 : void outputR(std::ostream &f);
96 :
97 : bool inputR(FILE* f);
98 : //void inputR(std::istream &f);
99 : friend std::ostream& operator<<(std::ostream& os, const BatchR& dt); //! Print human readable version of batch.
100 :
101 : /*
102 : private:
103 : friend class boost::serialization::access;
104 : template<class Archive>
105 : void serialize(Archive & ar, const unsigned int version);*/
106 :
107 : };
108 :
109 :
110 :
111 : #endif /* _BATCHR_HPP */
|