Skip to content
Snippets Groups Projects
Commit a34a1f69 authored by Oliver Sander's avatar Oliver Sander
Browse files

[cleanup] Move class Factorial from misc.hh to math.hh

parent e8020093
Branches
Tags
No related merge requests found
......@@ -79,6 +79,25 @@ namespace Dune
{};
#endif // DOXYGEN
//! Calculates the factorial of m at compile time
template <int m>
struct Factorial
{
//! factorial stores m!
enum { factorial = m * Factorial<m-1>::factorial };
};
//! end of recursion of factorial via specialization
template <>
struct Factorial<0>
{
// 0! = 1
enum { factorial = 1 };
};
}
#endif // #ifndef DUNE_MATH_HH
......@@ -21,6 +21,7 @@
#include "exceptions.hh"
#include <dune/common/typetraits.hh>
#include <dune/common/stringutility.hh>
#include <dune/common/math.hh>
namespace Dune {
......@@ -82,22 +83,6 @@ namespace Dune {
enum { power = 1 };
};
//! Calculates the factorial of m at compile time
template <int m>
struct Factorial
{
//! factorial stores m!
enum { factorial = m * Factorial<m-1>::factorial };
};
//! end of recursion of factorial via specialization
template <>
struct Factorial<0>
{
// 0! = 1
enum { factorial = 1 };
};
//********************************************************************
//
// generate filenames with timestep number in it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment