Skip to content

Commit

Permalink
more readable formatting of self-energies
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Oct 31, 2016
1 parent f9923e8 commit abd4d30
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions meta/SelfEnergies.m
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@
CreateFunctionName[tadpole] <>
"(" <> DeclareFieldIndices[GetField[tadpole]] <> ") const";

ExpressionToStringSequentially[expr_Plus, heads_, result_String] :=
StringJoin[(result <> " += " <> ExpressionToString[#,heads] <> ";\n")& /@ (List @@ expr)];

ExpressionToStringSequentially[expr_, heads_, result_String] :=
result <> " = " <> ExpressionToString[expr, heads] <> ";\n";

CreateNPointFunction[nPointFunction_, vertexRules_List] :=
Module[{decl, expr, field, prototype, body, functionName},
expr = GetExpression[nPointFunction];
Expand All @@ -427,14 +433,14 @@
type = CConversion`CreateCType[CConversion`ScalarType[CConversion`complexScalarCType]];
prototype = type <> " " <> functionName <> ";\n";
decl = "\n" <> type <> " CLASSNAME::" <> functionName <> "\n{\n";
body = "const " <> type <> " result = " <>
ExpressionToString[expr /.
body = type <> " result;\n\n" <>
ExpressionToStringSequentially[expr /.
vertexRules /.
a_[List[i__]] :> a[i] /.
ReplaceGhosts[FlexibleSUSY`FSEigenstates] /.
C -> 1,
TreeMasses`GetParticles[]] <>
";\n\nreturn result * oneOver16PiSqr;";
TreeMasses`GetParticles[], "result"] <>
"\nreturn result * oneOver16PiSqr;";
body = IndentText[WrapLines[body]];
decl = decl <> body <> "\n}\n";
Return[{prototype, decl}];
Expand Down

0 comments on commit abd4d30

Please sign in to comment.