Skip to content

Commit

Permalink
add flags for imprecise mass eigenvalues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt committed Oct 22, 2014
1 parent 1dc23c3 commit a41418c
Showing 1 changed file with 51 additions and 4 deletions.
55 changes: 51 additions & 4 deletions src/problems.hpp
Expand Up @@ -34,19 +34,23 @@ class Problems {
Problems(const char**);
~Problems() {}

void flag_bad_mass(unsigned);
void flag_tachyon(unsigned);
void flag_thrown() { thrown = true; }
void flag_no_ewsb() { failed_ewsb = true; }
void flag_no_convergence() { failed_convergence = true; }
void flag_no_perturbative() { non_perturbative = true; }

void unflag_bad_mass(unsigned);
void unflag_tachyon(unsigned);
void unflag_thrown() { thrown = false; }
void unflag_no_ewsb() { failed_ewsb = false; }
void unflag_no_convergence() { failed_convergence = false; }
void unflag_no_perturbative() { non_perturbative = false; }

bool is_bad_mass(unsigned) const;
bool is_tachyon(unsigned) const;
bool have_bad_mass() const;
bool have_tachyon() const;
bool have_thrown() const { return thrown; }
bool no_ewsb() const { return failed_ewsb; }
Expand All @@ -59,6 +63,7 @@ class Problems {
void print(std::ostream& = std::cout) const;

private:
bool bad_masses[Number_of_particles]; ///< imprecise mass eigenvalues
bool tachyons[Number_of_particles]; ///< tachyonic particles
const char** particle_names; ///< particle names
bool thrown; ///< excepton thrown
Expand All @@ -69,7 +74,8 @@ class Problems {

template <unsigned Number_of_particles>
Problems<Number_of_particles>::Problems(const char** particle_names_)
: tachyons() // intializes all elements to zero (= false)
: bad_masses() // intializes all elements to zero (= false)
, tachyons() // intializes all elements to zero (= false)
, particle_names(particle_names_)
, thrown(false)
, failed_ewsb(false)
Expand All @@ -78,6 +84,14 @@ Problems<Number_of_particles>::Problems(const char** particle_names_)
{
}

template <unsigned Number_of_particles>
void Problems<Number_of_particles>::flag_bad_mass(unsigned particle)
{
assert(particle < Number_of_particles
&& "Error: particle index out of bounds");
bad_masses[particle] = true;
}

template <unsigned Number_of_particles>
void Problems<Number_of_particles>::flag_tachyon(unsigned particle)
{
Expand All @@ -86,6 +100,14 @@ void Problems<Number_of_particles>::flag_tachyon(unsigned particle)
tachyons[particle] = true;
}

template <unsigned Number_of_particles>
void Problems<Number_of_particles>::unflag_bad_mass(unsigned particle)
{
assert(particle < Number_of_particles
&& "Error: particle index out of bounds");
bad_masses[particle] = false;
}

template <unsigned Number_of_particles>
void Problems<Number_of_particles>::unflag_tachyon(unsigned particle)
{
Expand All @@ -94,6 +116,14 @@ void Problems<Number_of_particles>::unflag_tachyon(unsigned particle)
tachyons[particle] = false;
}

template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::is_bad_mass(unsigned particle) const
{
assert(particle < Number_of_particles
&& "Error: particle index out of bounds");
return bad_masses[particle];
}

template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::is_tachyon(unsigned particle) const
{
Expand All @@ -102,6 +132,16 @@ bool Problems<Number_of_particles>::is_tachyon(unsigned particle) const
return tachyons[particle];
}

template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::have_bad_mass() const
{
for (unsigned i = 0; i < Number_of_particles; ++i) {
if (bad_masses[i])
return true;
}
return false;
}

template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::have_tachyon() const
{
Expand All @@ -115,6 +155,8 @@ bool Problems<Number_of_particles>::have_tachyon() const
template <unsigned Number_of_particles>
void Problems<Number_of_particles>::clear()
{
for (unsigned i = 0; i < Number_of_particles; ++i)
bad_masses[i] = false;
for (unsigned i = 0; i < Number_of_particles; ++i)
tachyons[i] = false;
failed_ewsb = false;
Expand All @@ -126,14 +168,15 @@ void Problems<Number_of_particles>::clear()
template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::have_problem() const
{
return have_tachyon() || failed_ewsb || failed_convergence
|| non_perturbative || thrown;
return have_serious_problem()
|| have_bad_mass();
}

template <unsigned Number_of_particles>
bool Problems<Number_of_particles>::have_serious_problem() const
{
return have_problem();
return have_tachyon() || failed_ewsb || failed_convergence
|| non_perturbative || thrown;
}

template <unsigned Number_of_particles>
Expand All @@ -143,6 +186,10 @@ void Problems<Number_of_particles>::print(std::ostream& ostr) const
return;

ostr << "Problems: ";
for (unsigned i = 0; i < Number_of_particles; ++i) {
if (bad_masses[i])
ostr << "imprecise mass " << particle_names[i] << ", ";
}
for (unsigned i = 0; i < Number_of_particles; ++i) {
if (tachyons[i])
ostr << "tachyon " << particle_names[i] << ", ";
Expand Down

0 comments on commit a41418c

Please sign in to comment.