added json for SPF_GetArrayDistribution pass
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "../Distribution/GraphCSR.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../Utils/json.hpp"
|
||||
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
|
||||
using std::vector;
|
||||
@@ -27,6 +29,8 @@ using std::make_pair;
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
template<typename setT>
|
||||
static void uniteSets(const set<setT> &first, const set<setT> &second, set<setT> &result)
|
||||
{
|
||||
@@ -732,30 +736,32 @@ string AlignRuleBase::GenRuleBase() const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
string AlignRuleBase::toString()
|
||||
json AlignRuleBase::toJson()
|
||||
{
|
||||
string retVal = "";
|
||||
json retVal;
|
||||
|
||||
if (alignArray)
|
||||
retVal += "#" + std::to_string((long long)alignArray);
|
||||
else
|
||||
retVal += "#-1";
|
||||
retVal["packedAlignArrayAddress"] = alignArray ? std::to_string((long long)alignArray) : std::to_string((long long)-1);
|
||||
retVal["packedAlignWithAddress"] = alignWith ? std::to_string((long long)alignWith) : std::to_string((long long)-1);
|
||||
|
||||
if (alignWith)
|
||||
retVal += "#" + std::to_string((long long)alignWith);
|
||||
else
|
||||
retVal += "#-1";
|
||||
|
||||
retVal += "#" + std::to_string(alignRule.size());
|
||||
for (int i = 0; i < alignRule.size(); ++i)
|
||||
retVal += "#" + std::to_string(alignRule[i].first) + "#" + std::to_string(alignRule[i].second);
|
||||
|
||||
retVal += "#" + std::to_string(alignRuleWith.size());
|
||||
for (int i = 0; i < alignRuleWith.size(); ++i)
|
||||
retVal += "#" + std::to_string(alignRuleWith[i].first)
|
||||
+ "#" + std::to_string(alignRuleWith[i].second.first)
|
||||
+ "#" + std::to_string(alignRuleWith[i].second.second);
|
||||
json alignRules = json::array();
|
||||
for (auto& rule : alignRule)
|
||||
{
|
||||
json pair;
|
||||
pair["key"] = rule.first;
|
||||
pair["value"] = rule.second;
|
||||
alignRules.push_back(pair);
|
||||
}
|
||||
retVal["alignRule"] = alignRules;
|
||||
|
||||
json alignRuleWithJ = json::array();
|
||||
for (auto& [dimNum, AB] : alignRuleWith)
|
||||
{
|
||||
json tuple;
|
||||
tuple["dimNum"] = dimNum;
|
||||
tuple["a"] = AB.first;
|
||||
tuple["b"] = AB.second;
|
||||
}
|
||||
retVal["alignRuleWith"] = alignRuleWithJ;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user