Dune Core Modules (2.3.1)

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
24#include "exceptions.hh"
27#include <dune/common/math.hh>
28
29namespace 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
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
Some useful basic math stuff.
Dune namespace.
Definition: alignment.hh:14
struct DUNE_DEPRECATED_MSG("Use class StaticPower from file power.hh instead") Power_m_p
Calculates m^p at compile time.
Definition: misc.hh:54
struct std::string genFilename(const std::string &path, const std::string &fn, int ntime, int precision=6)
Generate filenames with timestep number in it.
Definition: misc.hh:75
T SQR(T t) DUNE_DEPRECATED_MSG("Use method sqr from math.hh instead")
Compute the square of T.
Definition: misc.hh:47
Miscellaneous helper stuff.
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)