dune-common
2.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
dune
common
misc.hh
Go to the documentation of this file.
1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi: set et ts=4 sw=2 sts=2:
3
#ifndef MISC_HH
4
#define MISC_HH
5
6
#warning This file is deprecated. Its contents have moved to stringutility.hh and math.hh, \
7
or will disappear completely.
8
13
#include <algorithm>
14
#include <cstddef>
15
#include <cstring>
16
#include <cstdio>
17
#include <iostream>
18
#include <iomanip>
19
#include <iterator>
20
#include <sstream>
21
#include <complex>
22
23
#include <
dune/common/deprecated.hh
>
24
#include "
exceptions.hh
"
25
#include <
dune/common/typetraits.hh
>
26
#include <
dune/common/stringutility.hh
>
27
#include <
dune/common/math.hh
>
28
29
namespace
Dune {
30
31
43
template
<
class
T>
44
T
SQR
(T
t
)
DUNE_DEPRECATED_MSG
(
"Use method sqr from math.hh instead"
);
45
46
template
<
class
T>
47
T
SQR
(T
t
)
48
{
49
return
t*
t
;
50
}
51
53
template
<
int
m,
int
p>
54
struct
DUNE_DEPRECATED_MSG
("Use class
StaticPower
from file power.hh instead")
Power_m_p
55
{
56
// power stores m^p
57
enum
{ power = (m *
Power_m_p
<m,p-1>::power ) };
58
};
59
61
template
<
int
m>
62
struct
DUNE_DEPRECATED_MSG
("Use class
StaticPower
from file power.hh instead")
Power_m_p
< m , 0>
63
{
64
// m^0 = 1
65
enum
{ power = 1 };
66
};
67
68
//********************************************************************
69
//
70
// generate filenames with timestep number in it
71
//
72
//********************************************************************
73
75
inline
std::string
genFilename
(
const
std::string& path,
76
const
std::string& fn,
77
int
ntime,
78
int
precision = 6)
79
{
80
std::ostringstream name;
81
82
if
(path.size() > 0)
83
{
84
name << path;
85
name <<
"/"
;
86
}
87
name << fn << std::setw(precision) << std::setfill(
'0'
) << ntime;
88
89
// Return the string corresponding to the stringstream
90
return
name.str();
91
}
92
93
96
}
97
98
99
#endif
Generated on Mon Feb 10 2014 23:52:38 for dune-common by
1.8.1.2