Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
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 &max(const T &a, const T &b)
34  {
35  return (a < b) ? b : a;
36  }
37 
38  template<class T, class Compare>
39  constexpr const T &max(const T &a, const T &b, Compare comp)
40  {
41  return (comp(a, b)) ? b : a;
42  }
43 
44  template<class T>
45  constexpr const T &min(const T &a, const T &b)
46  {
47  return (b < a) ? b : a;
48  }
49 
50  template<class T, class Compare>
51  constexpr const T &min(const T &a, const T &b, Compare comp)
52  {
53  return (comp(b, a)) ? b : a;
54  }
55 
56 #endif
57 }
58 DEAL_II_NAMESPACE_CLOSE
59 
60 #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)