Skip to content
Snippets Groups Projects
Commit 398f8609 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

implemented factorial calculated by compiler.

[[Imported from SVN: r4330]]
parent 20aec39b
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ namespace Dune {
enum { power = (m * Power_m_p<m,p-1>::power ) };
};
// end of recursion via specialization
//! end of recursion via specialization
template <int m>
struct Power_m_p< m , 0>
{
......@@ -65,6 +65,22 @@ 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.
Finish editing this message first!
Please register or to comment