Skip to content

Commit

Permalink
update in ComputationalGraphTool
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierr committed Jan 30, 2024
1 parent bc3bca9 commit 5fe8c96
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions Utilities/ComputationalGraph/ComputationalGraphTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,13 @@ function printDependencyList(cgt, varname)

varnameind = cgt.getVarNameIndex(varname);

varnameinds = dfs(A', varnameind);
varnameinds = find(varnameinds >= 0);
varnameinds = sort(varnameinds);

propfuncinds = max(A(:, varnameinds), [], 1);
staticinds = find(propfuncinds == 0);
staticinds = varnameinds(staticinds);
[~, ia, ic] = unique(propfuncinds, 'first');
ia = sort(ia);
propfuncinds = propfuncinds(ia);
varnameinds = varnameinds(ia);
varnameinds = varnameinds(propfuncinds > 0);
propfuncinds = propfuncinds(propfuncinds > 0);
[~, propfuncinds, propvarnameinds, staticinds] = getDependencyVarNameInds(varnameind, A);

[staticinds, staticpropinds] = cgt.findStaticVarNameInds(staticinds);

if ~isempty(staticinds)
propfuncinds = [staticpropinds, propfuncinds];
varnameinds = [staticinds; varnameinds];
propfuncinds = [staticpropinds; propfuncinds];
varnameinds = [staticinds; propvarnameinds];
end

propfuncs = cgt.model.propertyFunctionList(propfuncinds);
Expand All @@ -225,7 +213,7 @@ function printDependencyList(cgt, varname)
[isok, ia] = ismember(varnameinds, allstaticinds);

if any(isok)
staticpropinds = allstaticpropinds(ia(isok));
staticpropinds = allstaticpropinds(ia(isok))';
staticinds = allstaticinds(ia(isok))'; %
else
staticpropinds = {};
Expand Down Expand Up @@ -812,7 +800,7 @@ function printSubModelNames(cgt, model, parents)


%{
Copyright 2021-2024 SINTEF Industry, Sustainable Energy Technology
Copyright 2021-2023 SINTEF Industry, Sustainable Energy Technology
and SINTEF Digital, Mathematics & Cybernetics.
This file is part of The Battery Modeling Toolbox BattMo
Expand Down

0 comments on commit 5fe8c96

Please sign in to comment.