Skip to content

Commit

Permalink
fix ordering problem of fields described in #180 (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosunae authored and twicki committed Mar 22, 2019
1 parent 5f44390 commit 7eb0f7e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/dawn/IIR/DoMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ json::json DoMethod::jsonDump(const StencilInstantiation& instantiation) const {

json::json fieldsJson;
for(const auto& field : derivedInfo_.fields_) {
fieldsJson.push_back(field.second.jsonDump(&instantiation));
fieldsJson[instantiation.getNameFromAccessID(field.first)] = field.second.jsonDump(&instantiation);
}
node["Fields"] = fieldsJson;

Expand Down
1 change: 0 additions & 1 deletion src/dawn/IIR/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Interval Field::computeAccessedInterval() const {
json::json Field::jsonDump(const StencilInstantiation* instantiation) const {
json::json node;
node["accessID"] = accessID_;
node["name"] = instantiation->getNameFromAccessID(accessID_);
node["intend"] = intend_;
node["extents"] = extents_.jsonDump();
node["redundant extents"] = extentsRB_.jsonDump();
Expand Down
4 changes: 2 additions & 2 deletions src/dawn/IIR/MultiStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ json::json MultiStage::jsonDump(const StencilInstantiation& instantiation) const
node["Loop"] = loopOrderToString(loopOrder_);
json::json fieldsJson;
for(const auto& field : derivedInfo_.fields_) {
fieldsJson.push_back(field.second.jsonDump(&instantiation));
fieldsJson[instantiation.getNameFromAccessID(field.first)] = field.second.jsonDump(&instantiation);
}
node["Fields"] = fieldsJson;

json::json cachesJson;
for(const auto& cache : derivedInfo_.caches_) {
cachesJson.push_back(cache.second.jsonDump());
cachesJson[cache.first] = cache.second.jsonDump();
}
node["Caches"] = cachesJson;

Expand Down
2 changes: 1 addition & 1 deletion src/dawn/IIR/Stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ json::json Stage::jsonDump(const StencilInstantiation& instantiation) const {
json::json node;
json::json fieldsJson;
for(const auto& field : derivedInfo_.fields_) {
fieldsJson.push_back(field.second.jsonDump(&instantiation));
fieldsJson[instantiation.getNameFromAccessID(field.first)] = field.second.jsonDump(&instantiation);
}
node["Fields"] = fieldsJson;
std::stringstream ss;
Expand Down
3 changes: 1 addition & 2 deletions src/dawn/IIR/Stencil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ bool Stencil::StatementPosition::inSameDoMethod(const Stencil::StatementPosition

json::json Stencil::FieldInfo::jsonDump(const StencilInstantiation* instantiation) const {
json::json node;
node["name"] = Name;
node["dim"] = format("[%i,%i,%i]", Dimensions[0], Dimensions[1], Dimensions[2]);
node["field"] = field.jsonDump(instantiation);
node["IsTemporary"] = IsTemporary;
Expand All @@ -114,7 +113,7 @@ json::json Stencil::jsonDump() const {
node["ID"] = std::to_string(StencilID_);
json::json fieldsJson;
for(const auto& f : derivedInfo_.fields_) {
fieldsJson.push_back(f.second.jsonDump(&stencilInstantiation_));
fieldsJson[f.second.Name] = f.second.jsonDump(&stencilInstantiation_);
}
node["Fields"] = fieldsJson;

Expand Down

0 comments on commit 7eb0f7e

Please sign in to comment.