DUNE PDELab (2.7)

range.hh
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3
4#ifndef DUNE_PDELAB_COMMON_RANGE_HH
5#define DUNE_PDELAB_COMMON_RANGE_HH
6
7#include<vector>
8
9namespace Dune {
10 namespace PDELab {
11
13
21 template<class T>
22 std::vector<T> rangeVector(T begin, T passed_the_end, T increment = 1) {
23 std::vector<T> tmp;
24 tmp.reserve((passed_the_end-begin)/increment);
25 for(T i = begin; i < passed_the_end; i+=increment)
26 tmp.push_back(i);
27 return tmp;
28 }
29
31
34 template<class T>
35 std::vector<T> rangeVector(T passed_the_end)
36 { return rangeVector(T(0), passed_the_end); }
37
38 } // namespace PDELab
39} // namespace Dune
40
41#endif // DUNE_PDELAB_COMMON_RANGE_HH
Dune namespace.
Definition: alignedallocator.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)