Skip to content
Snippets Groups Projects
Commit f10daec6 authored by René Fritze's avatar René Fritze
Browse files

[common] doc++

parent dcb7a677
No related branches found
No related tags found
No related merge requests found
......@@ -262,6 +262,9 @@ inline long sign(long x)
return long(x != 0) | (long(x >= 0) - 1);
}
/** enable us to use DSC::numeric_limits for all types, even when no specialization is avaliable.
* If there is one, it's used. Otherwise we default to numerical_limtis of double
**/
template <class T, typename = void>
class numeric_limits : public std::numeric_limits<double>
{
......
......@@ -6,6 +6,11 @@
namespace Dune {
namespace Stuff {
/** \brief Partition that assigns each codim-0 entity in a \ref IndexSet a unique partition number,
* its index in the set
*
* usable with \ref Dune::SeedListPartitioning for example \ref Dune::PartitioningInterface
**/
template <class GridViewType>
struct IndexSetPartitioner
{
......
......@@ -34,6 +34,8 @@ private:
// std::unique_ptr<tbb::task_scheduler_init> tbb_init_;
};
/** Automatic Storage of non-static, N thread-local values
**/
template <class ValueImp>
class PerThreadValue
{
......
......@@ -55,7 +55,6 @@ public:
*program
* instances.\n
* - Provides csv-conform output of process-averaged runtimes.
* \todo this could go into libdune-stuff
**/
class Profiler
{
......
......@@ -14,6 +14,7 @@ namespace Dune {
namespace Stuff {
namespace Common {
//! Helper class to abstract away selecting an integer or real valued distribution
template <typename T, bool = std::is_integral<T>::value>
struct UniformDistributionSelector
{
......@@ -30,7 +31,13 @@ struct UniformDistributionSelector<T, false>
typedef std::uniform_real_distribution<T> type;
};
template <class T, class DistributionImp, class EngineImp>
/** RandomNumberGenerator adapter
* \template T type of generated numbers
* \template EngineImp randomization algorithm/engine implementation
* \template DistributionImp class with an EngineImp accepting call operator that returns the actual RNGs
* \ref DefaultRNG for default choice of distribution, engine and init args
**/
template <class T, class DistributionImp, class EngineImp = std::mt19937>
struct RNG
{
typedef DistributionImp DistributionType;
......@@ -58,6 +65,7 @@ const std::string other_printables("!@#$%^&*()"
"`~-_=+[{]{\\|;:'\",<.>/? ");
}
//! RNG that represents strings of given length
class RandomStrings : public RNG<std::string, std::uniform_int_distribution<int>, std::mt19937>
{
typedef RNG<std::string, std::uniform_int_distribution<int>, std::mt19937> BaseType;
......@@ -86,6 +94,7 @@ private:
}
};
//! defaultrng with choice of uniform distribution and stl's default random engine based on T and its numeric_limits
template <class T>
class DefaultRNG : public RNG<T, typename UniformDistributionSelector<T>::type, std::default_random_engine>
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment