14 #include <boost/algorithm/string.hpp>
28 namespace MD = MultiDimensional;
50 return &(res.first->second);
62 auto it2 = it->second.find(scheme);
63 if(it2 != it->second.end()){
64 if(it2->second.labels().size() > 0) {
68 MSG_ERROR(
"Invalid rank at end of evaluation");
70 return t.element().real();
73 if(it2->second.rank() != 0) {
74 MSG_ERROR(
"Invalid rank at end of evaluation");
76 return it2->second.element().real();
79 MSG_ERROR(
"Rate not found for specified FF scheme. Oh, the humanity.");
82 MSG_ERROR(
"Rate not found for specified vertex ID. Oh, the humanity.");
91 auto rates = msgreader->rates();
96 for(
unsigned int i = 0; i< rates->size() && result; ++i) {
98 if(merge && !res.second) {
104 auto vals = rates->Get(i)->ratevals();
105 auto chs = rates->Get(i)->ratenames();
106 for(
unsigned int j = 0; j < vals->size() && result; ++j) {
107 auto it = res.first->second.find(chs->Get(j)->c_str());
108 if(merge && it != res.first->second.end() && strcmp(chs->Get(j)->c_str(),
"Denominator") != 0) {
109 MSG_ERROR(
"Try to merge two rates with factor schemes with same name '" +
110 string(chs->Get(j)->c_str()) +
"'!");
115 auto res2 = res.first->second.insert({chs->Get(j)->c_str(),
Tensor{}});
116 res2.first->second.read(vals->Get(j));
124 vector<flatbuffers::Offset<Serial::FBRate>> rates;
127 vector<flatbuffers::Offset<flatbuffers::String>> chs;
128 vector<flatbuffers::Offset<Serial::FBTensor>> rts;
129 for(
auto& elem2: elem.second) {
130 auto serCh = msgwriter->CreateString(elem2.first);
132 elem2.second.write(&(*msgwriter),&val);
133 chs.push_back(serCh);
136 auto serialChs = msgwriter->CreateVector(chs);
137 auto serialrts = msgwriter->CreateVector(rts);
138 Serial::FBRateBuilder serialFF{*msgwriter};
139 serialFF.add_id(elem.first);
140 serialFF.add_ratevals(serialrts);
141 serialFF.add_ratenames(serialChs);
142 auto resFF = serialFF.Finish();
143 rates.push_back(resFF);
145 auto serialrates = msgwriter->CreateVector(rates);
146 Serial::FBRatesBuilder serialout{*msgwriter};
147 serialout.add_rates(serialrates);
148 auto headoffset = serialout.Finish();
149 msgwriter->Finish(headoffset);
PDG codes to UID functions.
virtual void defineSettings()
purely virtual function for a class to define new settings
Container class for values of WC and FF vectors.
virtual double getVertexRate(const ProcessUID &id, const std::string &schemeName) const
Message logging routines.
Log & getLog() const
logging facility
const ExternalData * _external
bool read(const Serial::FBRates *msgreader, bool merge)
static Log & getLog(const std::string &name)
Get a logger with the given name.
Order-0 tensor data container.
virtual const Tensor & getExternalVectors(std::string schemeName, LabelsList labels) const
Multidimensional tensor class with complex numbers as elements.
ProcIdDict< SchemeDict< Tensor > > _processRates
void write(flatbuffers::FlatBufferBuilder *msgwriter) const
std::map< SchemeName, T > SchemeDict
Tensor & dot(const Tensor &other, const UniqueLabelsList &indices={})
contract this tensor with another and stores the result in this tensor
Container class for process rate tensors.
virtual SchemeDict< Tensor > * getProcessRates(ProcessUID id)
Serialization related typedefs and includes.