Skip to content

Commit

Permalink
New flag to dump functions
Browse files Browse the repository at this point in the history
This can be used in combination with most back end dumps.
e.g. "+d=dumpindxdae,dumpFunctions"
  • Loading branch information
lochel committed Sep 23, 2015
1 parent 0ed9bc8 commit 5e4b2b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -251,7 +251,6 @@ end printClassAttributes;
public function printShared "This function dumps the BackendDAE.Shared representation to stdout."
input BackendDAE.Shared inShared;
algorithm

print("\nBackendDAEType: ");
printBackendDAEType(inShared.backendDAEType);
print("\n\n");
Expand All @@ -272,6 +271,10 @@ algorithm
dumpConstraintList(inShared.constraints, "Constraints");
dumpBasePartitions(inShared.partitionsInfo.basePartitions, "Base partitions");
dumpSubPartitions(inShared.partitionsInfo.subPartitions, "Sub partitions");

if Flags.isSet(Flags.DUMP_FUNCTIONS) then
DAEDump.dumpFunctionTree(inShared.functionTree, "Functions");
end if;
end printShared;

public function printBasePartitions
Expand Down Expand Up @@ -567,7 +570,7 @@ algorithm
Error.addMessage(Error.BACKEND_DAE_TO_MODELICA, {suffix, str});
end dumpBackendDAEToModelica;

public function dumpEqSystem "function dumpEqSystem"
public function dumpEqSystem
input BackendDAE.EqSystem inEqSystem;
input String heading;
algorithm
Expand Down
12 changes: 11 additions & 1 deletion Compiler/FrontEnd/DAEDump.mo
Expand Up @@ -1119,7 +1119,7 @@ end dumpExtObjectClass;

public function derivativeCondStr "
Author BZ
Function for prinding conditions"
Function for printing conditions"
input DAE.derivativeCond dc;
output String str;
algorithm
Expand Down Expand Up @@ -3384,6 +3384,16 @@ algorithm
Print.restoreBuf(hnd);
end ppStatementStream;

public function dumpFunctionTree
input DAE.FunctionTree inFunctionTree;
input String inHeading;
algorithm
print("\n" + inHeading + "\n========================================\n");
for fnc in sortFunctions(DAEUtil.getFunctionList(inFunctionTree)) loop
print(dumpFunctionStr(fnc));
end for;
end dumpFunctionTree;

public function dumpFunctionStr "Dump function to a string."
input DAE.Function inElement;
output String outString;
Expand Down
5 changes: 4 additions & 1 deletion Compiler/Util/Flags.mo
Expand Up @@ -458,6 +458,8 @@ constant DebugFlag EVAL_OUTPUT_ONLY = DEBUG_FLAG(145, "evalOutputOnly", false,
Util.gettext("Generates equations to calculate outputs only."));
constant DebugFlag HARDCODED_START_VALUES = DEBUG_FLAG(146, "hardcodedStartValues", false,
Util.gettext("Embed the start values of variables and parameters into the c++ code and do not read it from xml file."));
constant DebugFlag DUMP_FUNCTIONS = DEBUG_FLAG(147, "dumpFunctions", false,
Util.gettext("Add functions to backend dumps."));

// This is a list of all debug flags, to keep track of which flags are used. A
// flag can not be used unless it's in this list, and the list is checked at
Expand Down Expand Up @@ -610,7 +612,8 @@ constant list<DebugFlag> allDebugFlags = {
DIS_SYMJAC_FMI20,
EVAL_ALL_PARAMS,
EVAL_OUTPUT_ONLY,
HARDCODED_START_VALUES
HARDCODED_START_VALUES,
DUMP_FUNCTIONS
};

public
Expand Down

0 comments on commit 5e4b2b1

Please sign in to comment.