Skip to content

Commit

Permalink
make trace struct a local const object
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Dec 6, 2016
1 parent 0509315 commit 0f9f5c8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 1 addition & 2 deletions meta/BetaFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@
allBeta = allDecl <> "\n" <>
"if (get_loops() > 0) {\n" <>
TextFormatting`IndentText[
"TRACE_STRUCT_TYPE TRACE_STRUCT;\n" <>
"CALCULATE_TRACES();\n\n" <>
"const auto TRACE_STRUCT = CALCULATE_TRACES();\n\n" <>
allBeta1L <> "\n" <>
"if (get_loops() > 1) {\n" <>
allBeta2L <> "\n" <>
Expand Down
8 changes: 6 additions & 2 deletions templates/soft_parameters.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace flexiblesusy {
#define INPUT(parameter) input.parameter
#define TRACE_STRUCT soft_traces
#define TRACE_STRUCT_TYPE Soft_traces
#define CALCULATE_TRACES() calc_soft_traces(TRACE_STRUCT);
#define CALCULATE_TRACES() calc_soft_traces();

const int @ModelName@_soft_parameters::numberOfParameters;

Expand Down Expand Up @@ -103,8 +103,10 @@ void @ModelName@_soft_parameters::set(const Eigen::ArrayXd& pars)
@set@
}

void @ModelName@_soft_parameters::calc_soft_traces(Soft_traces& soft_traces) const
@ModelName@_soft_parameters::Soft_traces @ModelName@_soft_parameters::calc_soft_traces() const
{
Soft_traces soft_traces;

if (get_loops() > 0) {
@calc1LTraces@
}
Expand All @@ -116,6 +118,8 @@ void @ModelName@_soft_parameters::calc_soft_traces(Soft_traces& soft_traces) con
if (get_loops() > 2) {
@calc3LTraces@
}

return soft_traces;
}

std::ostream& operator<<(std::ostream& ostr, const @ModelName@_soft_parameters& soft_pars)
Expand Down
2 changes: 1 addition & 1 deletion templates/soft_parameters.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private:
struct Soft_traces {
@traceDefs@
};
void calc_soft_traces(Soft_traces&) const;
Soft_traces calc_soft_traces() const;

@singleBetaFunctionsDecls@
};
Expand Down
8 changes: 6 additions & 2 deletions templates/susy_parameters.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace flexiblesusy {
#define INPUT(parameter) input.parameter
#define TRACE_STRUCT susy_traces
#define TRACE_STRUCT_TYPE Susy_traces
#define CALCULATE_TRACES() calc_susy_traces(TRACE_STRUCT);
#define CALCULATE_TRACES() calc_susy_traces();

const int @ModelName@_susy_parameters::numberOfParameters;

Expand Down Expand Up @@ -121,8 +121,10 @@ void @ModelName@_susy_parameters::set_input_parameters(const @ModelName@_input_p
input = input_;
}

void @ModelName@_susy_parameters::calc_susy_traces(Susy_traces& susy_traces) const
@ModelName@_susy_parameters::Susy_traces @ModelName@_susy_parameters::calc_susy_traces() const
{
Susy_traces susy_traces;

if (get_loops() > 0) {
@calc1LTraces@
}
Expand All @@ -134,6 +136,8 @@ void @ModelName@_susy_parameters::calc_susy_traces(Susy_traces& susy_traces) con
if (get_loops() > 2) {
@calc3LTraces@
}

return susy_traces;
}

std::ostream& operator<<(std::ostream& ostr, const @ModelName@_susy_parameters& susy_pars)
Expand Down
2 changes: 1 addition & 1 deletion templates/susy_parameters.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private:
struct Susy_traces {
@traceDefs@
};
void calc_susy_traces(Susy_traces&) const;
Susy_traces calc_susy_traces() const;

@singleBetaFunctionsDecls@
};
Expand Down

0 comments on commit 0f9f5c8

Please sign in to comment.