Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

April fixes 2 #142

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spcl/sdfv",
"version": "1.2.0",
"version": "1.2.1",
"description": "A standalone viewer for SDFGs",
"homepage": "https://github.com/spcl/dace-webclient",
"main": "out/index.js",
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,10 @@ export class SDFGRenderer extends EventEmitter {
obj.attributes.sdfg) {
this.cfgTree[obj.attributes.sdfg.cfg_list_id] =
oInfo.sdfg.cfg_list_id;
this.cfgList[obj.attributes.sdfg.cfg_list_id] = {
jsonObj: obj.attributes.sdfg as JsonSDFG,
graph: null,
};
} else if (cfgId !== undefined && cfgId >= 0) {
this.cfgTree[cfgId] = oInfo.cfgId;
this.cfgList[cfgId] = {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/sdfg/json_serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const propertyReplacements_0_16_0: { [key: string]: {
replaceWith: string,
recursive: boolean,
}} = {
'start_block': {
'start_state': {
replaceWith: 'start_block',
recursive: false,
},
'cfg_list_id': {
'sdfg_list_id': {
replaceWith: 'cfg_list_id',
recursive: true,
},
Expand Down
37 changes: 18 additions & 19 deletions src/utils/sdfg/sdfg_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,24 @@ export function findGraphElementByUUID(
return null;

const graph = cfgList[cfgId].graph;
if (graph === null)
return null;

let state = null;
if (stateId !== '-1')
state = graph.node(stateId);

let element = null;
if (nodeId !== '-1' && state !== null && state.data.graph !== null)
element = state.data.graph.node(nodeId); // SDFG Dataflow graph node
else if (edgeId !== '-1' && state !== null && state.data.graph !== null)
element = state.data.graph.edge(edgeId); // Memlet
else if (edgeId !== '-1' && state === null)
element = graph.edge(edgeId as any); // Interstate edge

if (element)
return element;
if (state)
return state;
if (graph) {
let state = null;
if (stateId !== '-1')
state = graph.node(stateId);

let element = null;
if (nodeId !== '-1' && state !== null && state.data.graph !== null)
element = state.data.graph.node(nodeId); // SDFG Dataflow graph node
else if (edgeId !== '-1' && state !== null && state.data.graph !== null)
element = state.data.graph.edge(edgeId); // Memlet
else if (edgeId !== '-1' && state === null)
element = graph.edge(edgeId as any); // Interstate edge

if (element)
return element;
if (state)
return state;
}

const parentCfgId = cfgTree[Number(cfgId)];
if (parentCfgId === undefined || parentCfgId === null)
Expand Down
Loading