From 68fbdd1f41d62d29206412bc14a37eea02f6afd3 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Wed, 24 Apr 2024 12:02:56 +0200 Subject: [PATCH 1/3] Fix graph element retrieval by UUID --- src/utils/sdfg/sdfg_utils.ts | 37 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/utils/sdfg/sdfg_utils.ts b/src/utils/sdfg/sdfg_utils.ts index b20ef97b..16154a12 100644 --- a/src/utils/sdfg/sdfg_utils.ts +++ b/src/utils/sdfg/sdfg_utils.ts @@ -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) From 0f036e882437c8e2084365d032dfa9eb088021f4 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Thu, 25 Apr 2024 12:07:41 +0200 Subject: [PATCH 2/3] Fix SDFG list -> CFG List compatibility layer --- src/renderer/renderer.ts | 4 ++++ src/utils/sdfg/json_serializer.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderer/renderer.ts b/src/renderer/renderer.ts index 7f838f1b..0f023bf7 100644 --- a/src/renderer/renderer.ts +++ b/src/renderer/renderer.ts @@ -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] = { diff --git a/src/utils/sdfg/json_serializer.ts b/src/utils/sdfg/json_serializer.ts index ba96f7bf..d46fac82 100644 --- a/src/utils/sdfg/json_serializer.ts +++ b/src/utils/sdfg/json_serializer.ts @@ -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, }, From 36998d41810ebcf0c409c2d5176ae0eb691f798a Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Fri, 26 Apr 2024 09:29:30 +0200 Subject: [PATCH 3/3] Update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 562c129e..2c449f0e 100644 --- a/package.json +++ b/package.json @@ -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",