Skip to content

Commit

Permalink
resolve derived parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Oct 4, 2015
1 parent bda0e57 commit d163fea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
18 changes: 6 additions & 12 deletions meta/GMuonMinus2.m
Expand Up @@ -515,15 +515,6 @@ If you add new kinds of vertices (e.g for new diagram types):
Return[{prototypes, definitions}];
];);

(* Converts an expression to a valid C++ string. The result of the
expression will be stored in `result'.
*)
VertexExpressionToString[expr_, result_String] :=
Module[{exprNoDep},
exprNoDep = TreeMasses`ReplaceDependenciesReverse[expr];
TreeMasses`ExpressionToString[exprNoDep, result]
];

(* Creates local declarations of field indices, whose values are taken
from the elements of `arrayName'.
*)
Expand Down Expand Up @@ -565,20 +556,23 @@ If you add new kinds of vertices (e.g for new diagram types):
vertexFunctionBody = Switch[vertexClassName,
"SingleComponentedVertex",
expr = (SARAH`Cp @@ indexedParticles) /. vertexRules;
expr = TreeMasses`ReplaceDependenciesReverse[expr];
"double result = 0.;\n\n" <>
declareIndices <>
Parameters`CreateLocalConstRefs[expr] <> "\n" <>
VertexExpressionToString[expr, "result"] <> "\n" <>
TreeMasses`ExpressionToString[expr, "result"] <> "\n" <>
"return vertex_type(result);",

"LeftAndRightComponentedVertex",
exprL = SARAH`Cp[Sequence @@ indexedParticles][SARAH`PL] /. vertexRules;
exprR = SARAH`Cp[Sequence @@ indexedParticles][SARAH`PR] /. vertexRules;
exprL = TreeMasses`ReplaceDependenciesReverse[exprL];
exprR = TreeMasses`ReplaceDependenciesReverse[exprR];
"std::complex<double> left, right;\n\n" <>
declareIndices <>
Parameters`CreateLocalConstRefs[exprL + exprR] <> "\n" <>
VertexExpressionToString[exprL, "left"] <> "\n" <>
VertexExpressionToString[exprR, "right"] <> "\n" <>
TreeMasses`ExpressionToString[exprL, "left"] <> "\n" <>
TreeMasses`ExpressionToString[exprR, "right"] <> "\n" <>
"return vertex_type(left, right);"];

sarahParticles = SARAH`getParticleName /@ particles;
Expand Down
1 change: 1 addition & 0 deletions templates/g_muon_minus_2.cpp.in
Expand Up @@ -38,6 +38,7 @@
#include <boost/mpl/at.hpp>

#define MODELPARAMETER(p) context.model.get_##p();
#define DERIVEDPARAMETER(p) context.model.p();

/* Due to g++4.4 compatibility, we need the following workarounds:
- no variadic non-template parameter packs :'-(
Expand Down

0 comments on commit d163fea

Please sign in to comment.