← Documentation
ADS-IDAC Engine 5.0.0
BranchCluster.h
Go to the documentation of this file.
1#pragma once
2
14
15#include <iostream>
16#include <typeinfo>
17
18#include <fstream>
19#include <string>
20#include <boost/serialization/export.hpp>
21
22#include "BranchProbability.h"
23#include "../Crew/Timp.h"
24#include <memory>
25#include <boost/archive/text_oarchive.hpp>
26#include <boost/archive/text_iarchive.hpp>
27#include <boost/serialization/access.hpp>
28#include <boost/serialization/vector.hpp>
29#include <boost/serialization/unique_ptr.hpp>
30#include <boost/serialization/base_object.hpp>
31
32
33class BranchCluster : public Time, public Probability
34{
35public:
39 virtual ~BranchCluster();
43 void setCurrentBranchNum(int);
50 void setIDOfTheMotherBranch(int);
56 void retrieveInfoFromFile(std::ifstream &);
60 void clearBranchCluster();
75 void saveBranchClusterToFile(std::ofstream &);
78 void retrieveBranchClusterFromFile(std::ifstream &);
80 void setIDOfMotherCluster(int);
85 void savePENodeToFile();
106 void savePENodeToFile(std::string strDirName);
108 std::vector<std::unique_ptr<BranchProbability>> all_branch;
110 template<class Archive>
111 void serialize(Archive & ar, const unsigned int version) {
112// std::cout << "Serializing class: " << typeid(*this).name() << std::endl;
113 ar & boost::serialization::base_object<Time>(*this);
114 ar & boost::serialization::base_object<Probability>(*this);
120 ar & all_branch; // Assuming this is serializable
121 // Add more members that need to be serialized
122 }
123
124private:
127 int Current_branch_num; //the current branch in the run time
130};
131
132
133BOOST_CLASS_EXPORT_KEY(BranchCluster)
int getNCountForRestartRELAP5()
void setIDOfTheMotherBranch(int)
Sets the ID of the branch (PE node) this cluster hangs from.
void savePENodeToFile(std::string strDirName)
Writes one PE node per alternative of this cluster.
int getIDOfMotherCluster()
void copyBranchCluster(BranchCluster &)
Deep-copies the alternatives and all scalar fields of another cluster. The copies are appended to all...
void saveInfoToFile()
Declared only; there is no definition. Use savePENodeToFile().
BranchProbability * findBranch(int)
Finds the alternative with the given branch ID, searching from the last alternative.
int getIDOfThisBranchCluster()
void setNCountForRestartRELAP5(long)
Stores the RELAP5 restart count (r5pars_.cncount) recorded at this branching point.
BranchCluster()
Constructs an empty cluster: mother branch and mother cluster IDs 0, cluster ID, current branch numbe...
void clearBranchCluster()
Destroys all alternatives held in all_branch.
int ID_of_the_mother_branch
void calBranchProbability()
Recomputes the conditional probability of every alternative (BranchProbability::calculateProbability ...
int ID_of_the_mother_cluster
void saveBranchClusterToFile(std::ofstream &)
Writes the cluster as text: the five ID fields, the alternative count, every alternative,...
void setIDOfThisBranchCluster(int)
void retrieveInfoFromFile(std::ifstream &)
Does nothing; the stream is not read.
void setIDOfMotherCluster(int)
Sets the ID of the cluster that contains the mother branch.
int getCurrentBranchNum()
void serialize(Archive &ar, const unsigned int version)
int ID_of_this_branch_cluster
friend class boost::serialization::access
void setCurrentBranchNum(int)
Sets the index (within all_branch) of the most recently started alternative. Alternatives with a larg...
long n_count_for_restart_RELAP5
void savePENodeToFile()
Writes the PE nodes of this cluster under the scheduler's PE directory (Scheduler::getPEDirectory()).
virtual ~BranchCluster()
int getIDOfTheMotherBranch()
void retrieveBranchClusterFromFile(std::ifstream &)
Reads the text layout written by saveBranchClusterToFile and appends the alternatives it reads to all...
std::vector< std::unique_ptr< BranchProbability > > all_branch
The alternatives of this branching point; index 0 is the one the generating sequence continues on.
One alternative of a BranchCluster, i.e. one PE node of the DET.
Definition: Timp.h:17