/usr/include/dune/common/misc.hh is in libdune-common-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef MISC_HH
#define MISC_HH
#warning This file is deprecated. Its contents have moved to stringutility.hh and math.hh, \
or will disappear completely.
/** \file
\brief Miscellaneous helper stuff
*/
#include <algorithm>
#include <cstddef>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <sstream>
#include <complex>
#include <dune/common/deprecated.hh>
#include "exceptions.hh"
#include <dune/common/typetraits.hh>
#include <dune/common/stringutility.hh>
#include <dune/common/math.hh>
namespace Dune {
/** @addtogroup Common
@{
*/
/** \brief Compute the square of T */
/**
* \code
*#include <dune/common/misc.hh>
* \endcode
*/
template<class T>
T SQR (T t) DUNE_DEPRECATED_MSG("Use method sqr from math.hh instead");
template<class T>
T SQR (T t)
{
return t*t;
}
//! Calculates m^p at compile time
template <int m, int p>
struct DUNE_DEPRECATED_MSG ("Use class StaticPower from file power.hh instead")Power_m_p
{
// power stores m^p
enum { power = (m * Power_m_p<m,p-1>::power ) };
};
//! end of recursion via specialization
template <int m>
struct DUNE_DEPRECATED_MSG ("Use class StaticPower from file power.hh instead")Power_m_p< m , 0>
{
// m^0 = 1
enum { power = 1 };
};
//********************************************************************
//
// generate filenames with timestep number in it
//
//********************************************************************
/** \brief Generate filenames with timestep number in it */
inline std::string genFilename(const std::string& path,
const std::string& fn,
int ntime,
int precision = 6)
{
std::ostringstream name;
if(path.size() > 0)
{
name << path;
name << "/";
}
name << fn << std::setw(precision) << std::setfill('0') << ntime;
// Return the string corresponding to the stringstream
return name.str();
}
/** @} */
}
#endif
|