Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
algorithm.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 #ifndef dealii_cxx14_algorithm_h
16 #define dealii_cxx14_algorithm_h
17 
18 #include <deal.II/base/config.h>
19 
20 #ifdef DEAL_II_WITH_CXX14
21 # include <algorithm>
22 #endif
23 
24 DEAL_II_NAMESPACE_OPEN
25 namespace std_cxx14
26 {
27 #ifdef DEAL_II_WITH_CXX14
28  using std::max;
29  using std::min;
30 #else
31 
32  template <class T>
33  constexpr const T &
34  max(const T &a, const T &b)
35  {
36  return (a < b) ? b : a;
37  }
38 
39  template <class T, class Compare>
40  constexpr const T &
41  max(const T &a, const T &b, Compare comp)
42  {
43  return (comp(a, b)) ? b : a;
44  }
45 
46  template <class T>
47  constexpr const T &
48  min(const T &a, const T &b)
49  {
50  return (b < a) ? b : a;
51  }
52 
53  template <class T, class Compare>
54  constexpr const T &
55  min(const T &a, const T &b, Compare comp)
56  {
57  return (comp(b, a)) ? b : a;
58  }
59 
60 #endif
61 } // namespace std_cxx14
62 DEAL_II_NAMESPACE_CLOSE
63 
64 #endif // dealii_cxx14_algorithm_h
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
T min(const T &t, const MPI_Comm &mpi_communicator)
T max(const T &t, const MPI_Comm &mpi_communicator)