Skip to content

Commit

Permalink
Add templates for semi-analytic convergence testers
Browse files Browse the repository at this point in the history
though it would be better if one of these could be
designed to re-use the existing two-scale convergence
tester as much as possible, as they are basically
identical
  • Loading branch information
Dylan Harries committed Dec 21, 2016
1 parent c3d46fe commit 8f3bb37
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 3 deletions.
7 changes: 6 additions & 1 deletion templates/module.mk
Expand Up @@ -77,8 +77,13 @@ TWO_SCALE_TEMPLATES := \
$(DIR)/two_scale_susy_scale_constraint.cpp.in

SEMI_ANALYTIC_TEMPLATES := \
$(DIR)/semi_analytic_convergence_tester.hpp.in \
$(DIR)/semi_analytic_convergence_tester.cpp.in \
$(DIR)/semi_analytic_model.hpp.in \
$(DIR)/semi_analytic_model.cpp.in
$(DIR)/semi_analytic_model.cpp.in \
$(DIR)/semi_analytic_susy_convergence_tester.hpp.in \
$(DIR)/semi_analytic_susy_convergence_tester.cpp.in \
$(DIR)/susy_convergence_tester.hpp.in

TEMPLATES := \
$(BASE_TEMPLATES) \
Expand Down
9 changes: 7 additions & 2 deletions templates/semi_analytic.mk.in
Expand Up @@ -19,6 +19,11 @@
@ModelName@_INCLUDE_MK += $(DIR)/semi_analytic.mk

LIB@ModelName@_SRC += \
$(DIR)/@ModelName@_semi_analytic_model.cpp
$(DIR)/@ModelName@_semi_analytic_convergence_tester.cpp \
$(DIR)/@ModelName@_semi_analytic_model.cpp \
$(DIR)/@ModelName@_semi_analytic_susy_convergence_tester.cpp
LIB@ModelName@_HDR += \
$(DIR)/@ModelName@_semi_analytic_model.hpp
$(DIR)/@ModelName@_semi_analytic_convergence_tester.hpp \
$(DIR)/@ModelName@_semi_analytic_model.hpp \
$(DIR)/@ModelName@_semi_analytic_susy_convergence_tester.hpp \
$(DIR)/@ModelName@_susy_convergence_tester.hpp
62 changes: 62 additions & 0 deletions templates/semi_analytic_convergence_tester.cpp.in
@@ -0,0 +1,62 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#include "@ModelName@_semi_analytic_convergence_tester.hpp"
#include <array>
#include <cmath>
#include <algorithm>
#include "wrappers.hpp"

namespace flexiblesusy {

#define OLD(p) ol.get_##p()
#define NEW(p) ne.get_##p()

#define OLD1(p,i) ol.get_##p()(i)
#define NEW1(p,i) ne.get_##p()(i)

#define OLD2(p,i,j) ol.get_##p(i,j)
#define NEW2(p,i,j) ne.get_##p(i,j)

#define OLD3(p,i,j,k) ol.get_##p(i,j,k)
#define NEW3(p,i,j,k) ne.get_##p(i,j,k)

#define OLD4(p,i,j,k,l) ol.get_##p(i,j,k,l)
#define NEW4(p,i,j,k,l) ne.get_##p(i,j,k,l)

@ModelName@_convergence_tester<Semi_analytic>::@ModelName@_convergence_tester(
@ModelName@<Semi_analytic>* model, double accuracy_goal, const Scale_getter& sg)
: Convergence_tester_DRbar<@ModelName@<Semi_analytic> >(model, accuracy_goal, sg)
{
}

@ModelName@_convergence_tester<Semi_analytic>::~@ModelName@_convergence_tester()
{
}

double @ModelName@_convergence_tester<Semi_analytic>::max_rel_diff() const
{
const @ModelName@<Semi_analytic>& ol = get_last_iteration_model();
const @ModelName@<Semi_analytic>& ne = get_current_iteration_model();

@compareFunction@
}

} // namespace flexiblesusy
47 changes: 47 additions & 0 deletions templates/semi_analytic_convergence_tester.hpp.in
@@ -0,0 +1,47 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#ifndef @ModelName@_SEMI_ANALYTIC_CONVERGENCE_TESTER_H
#define @ModelName@_SEMI_ANALYTIC_CONVERGENCE_TESTER_H

#include "@ModelName@_convergence_tester.hpp"
#include "@ModelName@_semi_analytic_model.hpp"

#include "convergence_tester_drbar.hpp"

namespace flexiblesusy {

class Semi_analytic;

template<>
class @ModelName@_convergence_tester<Semi_analytic> : public Convergence_tester_DRbar<@ModelName@<Semi_analytic> > {
public:
using Scale_getter = Convergence_tester_DRbar<@ModelName@<Semi_analytic>>::Scale_getter;

@ModelName@_convergence_tester(@ModelName@<Semi_analytic>*, double, const Scale_getter& sg = Scale_getter());
virtual @ModelName@_convergence_tester();

protected:
virtual double max_rel_diff() const;
};

} // namespace flexiblesusy

#endif
64 changes: 64 additions & 0 deletions templates/semi_analytic_susy_convergence_tester.cpp.in
@@ -0,0 +1,64 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#include "@ModelName@_semi_analytic_susy_convergence_tester.hpp"

#include "wrappers.hpp"

#include <array>
#include <cmath>
#include <algorithm>

namespace flexiblesusy {

#define OLD(p) ol.get_##p()
#define NEW(p) ne.get_##p()

#define OLD1(p,i) ol.get_##p()(i)
#define NEW1(p,i) ne.get_##p()(i)

#define OLD2(p,i,j) ol.get_##p(i,j)
#define NEW2(p,i,j) ne.get_##p(i,j)

#define OLD3(p,i,j,k) ol.get_##p(i,j,k)
#define NEW3(p,i,j,k) ne.get_##p(i,j,k)

#define OLD4(p,i,j,k,l) ol.get_##p(i,j,k,l)
#define NEW4(p,i,j,k,l) ne.get_##p(i,j,k,l)

@ModelName@_susy_convergence_tester<Semi_analytic>::@ModelName@_susy_convergence_tester(
@ModelName@<Semi_analytic>* model, double accuracy_goal, const Scale_getter& sg)
: Convergence_tester_DRbar<@ModelName@<Semi_analytic> >(model, accuracy_goal, sg)
{
}

@ModelName@_susy_convergence_tester<Semi_analytic>::~@ModelName@_susy_convergence_tester()
{
}

double @ModelName@_susy_convergence_tester<Semi_analytic>::max_rel_diff() const
{
const @ModelName@<Semi_analytic>& ol = get_last_iteration_model();
const @ModelName@<Semi_analytic>& ne = get_current_iteration_model();

@susyParsCompareFunction@
}

} // namespace flexiblesusy
48 changes: 48 additions & 0 deletions templates/semi_analytic_susy_convergence_tester.hpp.in
@@ -0,0 +1,48 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#ifndef @ModelName@_SEMI_ANALYTIC_SUSY_CONVERGENCE_TESTER_H
#define @ModelName@_SEMI_ANALYTIC_SUSY_CONVERGENCE_TESTER_H

#include "@ModelName@_susy_convergence_tester.hpp"
#include "@ModelName@_semi_analytic_model.hpp"

#include "convergence_tester_drbar.hpp"

namespace flexiblesusy {

class Semi_analytic;

template<>
class @ModelName@_susy_convergence_tester<Semi_analytic> :
public Convergence_tester_DRbar<@ModelName@<Semi_analytic> > {
public:
using Scale_getter = Convergence_tester_DRbar<@ModelName@<Semi_analytic> >::Scale_getter;

@ModelName@_susy_convergence_tester(@ModelName@<Semi_analytic>*, double, const Scale_getter& sg = Scale_getter());
virtual ~@ModelName@_inner_convergence_tester();

protected:
virtual double max_rel_diff() const;
};

} // namespace flexiblesusy

#endif
31 changes: 31 additions & 0 deletions templates/susy_convergence_tester.hpp.in
@@ -0,0 +1,31 @@
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================

// File generated at @DateAndTime@

#ifndef @ModelName@_SUSY_CONVERGENCE_TESTER_H
#define @ModelName@_SUSY_CONVERGENCE_TESTER_H

namespace flexiblesusy {

template <class T>
class @ModelName@_susy_convergence_tester;

} // namespace flexiblesusy

#endif

0 comments on commit 8f3bb37

Please sign in to comment.