Skip to content

Commit

Permalink
extract spectrum from <model>_mass_eigenstates class
Browse files Browse the repository at this point in the history
This makes the write_spectrum() method independent of the template
parameter.
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Jun 10, 2015
1 parent b90e953 commit 5bc1047
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion templates/low_scale_spectrum_generator.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ template <class T>
void @ModelName@_spectrum_generator<T>::write_spectrum(const std::string& filename) const
{
@ModelName@_spectrum_plotter plotter;
plotter.extract_spectrum<T>(model);
plotter.extract_spectrum(model);
plotter.write_to_file(filename);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/spectrum_generator.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ template <class T>
void @ModelName@_spectrum_generator<T>::write_spectrum(const std::string& filename) const
{
@ModelName@_spectrum_plotter plotter;
plotter.extract_spectrum<T>(model);
plotter.extract_spectrum(model);
plotter.write_to_file(filename);
}

Expand Down
12 changes: 12 additions & 0 deletions templates/utilities.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ namespace flexiblesusy {
{
}


void @ModelName@_spectrum_plotter::extract_spectrum(const @ModelName@_mass_eigenstates& model)
{
spectrum.clear();
scale = model.get_scale();

@fillSpectrumVectorWithSusyParticles@
if (model.do_calculate_sm_pole_masses()) {
@fillSpectrumVectorWithSMParticles@
}
}

void @ModelName@_spectrum_plotter::write_to_file(const std::string& file_name) const
{
if (spectrum.empty())
Expand Down
26 changes: 3 additions & 23 deletions templates/utilities.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@
#include <valarray>
#include <utility>

#define PHYSICAL(p) model.get_physical().p
#define MODELPARAMETER(p) model.get_##p()

namespace flexiblesusy {

class @ModelName@_parameter_getter {
public:
Eigen::ArrayXd get_parameters(const @ModelName@<Two_scale>& model) {
Eigen::ArrayXd get_parameters(const @ModelName@_mass_eigenstates& model) {
return model.get();
}
std::vector<std::string> get_parameter_names(const @ModelName@<Two_scale>&) const {
std::vector<std::string> get_parameter_names(const @ModelName@_mass_eigenstates&) const {
using namespace @ModelName@_info;
return std::vector<std::string>(parameter_names,
parameter_names + NUMBER_OF_PARAMETERS);
Expand All @@ -53,8 +50,7 @@ public:
@ModelName@_spectrum_plotter();
~@ModelName@_spectrum_plotter() {}

template <class T>
void extract_spectrum(const @ModelName@<T>&);
void extract_spectrum(const @ModelName@_mass_eigenstates&);
void write_to_file(const std::string&) const;

private:
Expand All @@ -80,19 +76,6 @@ private:
static std::valarray<double> to_valarray(const Eigen::Array<Scalar, M, N>&);
};


template <class T>
void @ModelName@_spectrum_plotter::extract_spectrum(const @ModelName@<T>& model)
{
spectrum.clear();
scale = model.get_scale();

@fillSpectrumVectorWithSusyParticles@
if (model.do_calculate_sm_pole_masses()) {
@fillSpectrumVectorWithSMParticles@
}
}

template <class Scalar, int M, int N>
std::valarray<double> @ModelName@_spectrum_plotter::to_valarray(const Eigen::Array<Scalar, M, N>& v)
{
Expand All @@ -101,7 +84,4 @@ std::valarray<double> @ModelName@_spectrum_plotter::to_valarray(const Eigen::Arr

} // namespace flexiblesusy

#undef PHYSICAL
#undef MODELPARAMETER

#endif

0 comments on commit 5bc1047

Please sign in to comment.