libMesh
enum_order.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_ENUM_ORDER_H
21 #define LIBMESH_ENUM_ORDER_H
22 
23 namespace libMesh {
24 
40 enum Order : int {
41  CONSTANT = 0,
42  FIRST = 1,
43  SECOND = 2,
44  THIRD = 3,
45  FOURTH = 4,
46  FIFTH = 5,
47  SIXTH = 6,
48  SEVENTH = 7,
49  EIGHTH = 8,
50  NINTH = 9,
51  TENTH = 10,
52  ELEVENTH = 11,
53  TWELFTH = 12,
54  THIRTEENTH = 13,
55  FOURTEENTH = 14,
56  FIFTEENTH = 15,
57  SIXTEENTH = 16,
59  EIGHTTEENTH = 18, // misspelling, deprecated
60  EIGHTEENTH = 18,
61  NINETEENTH = 19,
62  TWENTIETH = 20,
72  THIRTIETH = 30,
82  FORTIETH = 40,
83  FORTYFIRST = 41,
85  FORTYTHIRD = 43,
86  MAXIMUM = 255,
87  // Invalid
89 
90  // Standardize this so nvc++ and clang -fsanitize=integer don't
91  // complain about all the ways in which we might do it wrong
92  template <typename T>
93  inline Order operator+(Order o, T p)
94  {
95  return static_cast<Order>(static_cast<int>(o) + int(p));
96  }
97 
98  template <typename T>
99  inline Order operator-(Order o, T p)
100  {
101  return static_cast<Order>(static_cast<int>(o) - int(p));
102  }
103 
104  template <typename T>
105  inline Order operator+(T p, Order o)
106  {
107  return o + p;
108  }
109 
110  template <typename T>
111  inline Order & operator+=(Order &o, T p)
112  {
113  o = o + p;
114  return o;
115  }
116 
117  template <typename T>
118  inline Order & operator-=(Order &o, T p)
119  {
120  o = o - p;
121  return o;
122  }
123 
124 }
125 
126 #endif
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
The libMesh namespace provides an interface to certain functionality in the library.
Order & operator-=(Order &o, T p)
Definition: enum_order.h:118
Order operator+(Order o, T p)
Definition: enum_order.h:93
Order operator-(Order o, T p)
Definition: enum_order.h:99
Order & operator+=(Order &o, T p)
Definition: enum_order.h:111