← Documentation
ADS-IDAC Engine 5.0.0
AnalysisInfoContainerUnit.cpp
Go to the documentation of this file.
1// AnalysisInfoContainerUnit.cpp: implementation of the AnalysisInfoContainerUnit class.
2//
4
5
6#include <stdlib.h>
7#include <boost/serialization/export.hpp>
8
10#include "../Branch/BranchRecord.h"
11#include "../Global/SimulationContext.h"
12#include <boost/archive/binary_oarchive.hpp>
13#include <boost/archive/binary_iarchive.hpp>
14BOOST_CLASS_EXPORT_IMPLEMENT(AnalysisInfoContainerUnit)
15using namespace std;
16
17
19// Construction/Destruction
21
23{
25 time = -999.0;
26 statement = "NONE";
27}
28AnalysisInfoContainerUnit::AnalysisInfoContainerUnit(double _x, string _str, int _branch_ID){
29 time = _x;
30 statement = _str;
31 associated_branch_ID = _branch_ID;
32};
34 time = _x;
35 statement = _str;
37};
38
40{
41
42}
48 string str;
49 if (time >= 0.0 && associated_branch_ID != -999){
50 str = to_string(associated_branch_ID);
51 fout << time << '\t' << " (PE_" << str << ")\t" << statement << '\n';
52 }
53 else if (time >= 0.0){
54 fout << time << '\t' << statement << '\n';
55 }
56 else if(associated_branch_ID != -999){
57 str = to_string(associated_branch_ID);
58 fout << "(PE_" << str << ")\t" << statement << '\n';
59 }
60 else{
61 fout << statement << '\n';
62 }
63}
65 time = _ac.getTime();
66 statement = _ac.getStatement();
68}
72 fout << time << ' ' << '"' << statement << '"' << ' ' << associated_branch_ID << '\n';
73}
75 fin >> time;
76 this->readStatementFromFile(fin);
78}
80 bool found_statement = false;
81 char ch = ' ';
82 int count = 0;
83 statement = "";
84 while (ch != '"' && !fin.eof()){
85 fin.get(ch);}
86 do{
87 fin.get(ch);
88 if(ch != '"'){
89 statement += ch;
90 found_statement = true;
91 }
92 count++;
93 }while(ch != '"' && !fin.eof() && count < 500);
94 if(!found_statement){
95 ofstream fout("err messages.txt", ios::app);
96 cout << "AnalysisInfoContainerUnit::readStatementFromFile: Statement must be embraced by {}" << endl;
97 fout << r5pars_.timesno << " AnalysisInfoContainerUnit::readStatementFromFile: Statement must be embraced by {}\n";
98 fout.close();
99 r5pars_.sim_err = true;
100 g_sim.Branch_center.setTempESMessage("AnalysisInfoContainerUnit::readStatementFromFile err.");
102 }
103}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void readStatementFromFile(std::ifstream &)
void copyAnalysisInfoContainerUnit(AnalysisInfoContainerUnit &)
void saveAnalysisInfoContainerUnitToFile(std::ofstream &)
void retrieveAnalysisInfoContainerUnitFromFile(std::ifstream &)
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
struct @0 r5pars_
BranchRecord Branch_center
Dynamic event tree state.