ug4
local_finite_element_id.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__LOCAL_FINITE_ELEMENT_ID__
34 #define __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__LOCAL_FINITE_ELEMENT_ID__
35 
36 #include <sstream>
37 
38 namespace ug{
39 
40 
41 // Doxygen group
43 
86 
89 
91 
97 class LFEID
98 {
99  public:
102  {
103  NONE = -1,
104  LAGRANGE = 0,
107  DG,
112  };
113 
115  enum {ADAPTIV = -1, INVALID = -10};
116 
117  public:
120 
123  : m_type(type), m_dim(dim), m_order(order) {}
124 
126  int order() const {return m_order;}
127 
129  int dim() const {return m_dim;}
130 
132  SpaceType type() const {return m_type;}
133 
135  bool operator==(const LFEID& v) const
136  {
137  return (m_type == v.m_type && m_dim==v.m_dim && m_order==v.m_order);
138  }
139 
141  bool operator!=(const LFEID& v) const {return !((*this)==v);}
142 
144 
148  bool operator<(const LFEID& v) const
149  {
150  if(m_type != v.m_type) return m_type < v.m_type;
151  else if(m_dim != v.m_dim) return m_dim < v.m_dim;
152  else return m_order < v.m_order;
153  }
154 
156  bool operator>(const LFEID& v) const
157  {
158  if(m_type != v.m_type) return m_type > v.m_type;
159  else if(m_dim != v.m_dim) return m_dim > v.m_dim;
160  else return m_order > v.m_order;
161  }
162 
164  bool operator<=(const LFEID& v) const
165  {
166  return (*this < v || *this == v);
167  }
168 
170  bool operator>=(const LFEID& v) const
171  {
172  return (*this > v || *this == v);
173  }
174 
175  friend std::ostream& operator<<(std::ostream& out, const LFEID& v);
176 
177  private:
180 
182  int m_dim;
183 
185  int m_order;
186 };
187 
189 std::ostream& operator<<(std::ostream& out, const LFEID& v);
190 
192 LFEID ConvertStringToLFEID(const char* type, int dim, int order);
193 
195 LFEID ConvertStringToLFEID(const char* type, int dim);
196 
198 
199 } // end namespace ug
200 
201 #endif /* __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__LOCAL_FINITE_ELEMENT_ID__ */
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
bool operator<(const LFEID &v) const
operator <
Definition: local_finite_element_id.h:148
int m_order
Order.
Definition: local_finite_element_id.h:185
bool operator<=(const LFEID &v) const
operator <=
Definition: local_finite_element_id.h:164
int m_dim
dimension
Definition: local_finite_element_id.h:182
friend std::ostream & operator<<(std::ostream &out, const LFEID &v)
writes the Identifier to the output stream
Definition: local_finite_element_id.cpp:42
bool operator>(const LFEID &v) const
operator >
Definition: local_finite_element_id.h:156
bool operator>=(const LFEID &v) const
operator >=
Definition: local_finite_element_id.h:170
LFEID()
default constructor
Definition: local_finite_element_id.h:119
SpaceType type() const
returns the type of the local finite element
Definition: local_finite_element_id.h:132
int order() const
returns the order of the local finite element
Definition: local_finite_element_id.h:126
bool operator==(const LFEID &v) const
equality check
Definition: local_finite_element_id.h:135
int dim() const
returns the space dimension of the local finite element
Definition: local_finite_element_id.h:129
bool operator!=(const LFEID &v) const
inequality check
Definition: local_finite_element_id.h:141
@ ADAPTIV
Definition: local_finite_element_id.h:115
@ INVALID
Definition: local_finite_element_id.h:115
LFEID(SpaceType type, int dim, int order)
constructor with values
Definition: local_finite_element_id.h:122
SpaceType m_type
Space type.
Definition: local_finite_element_id.h:179
SpaceType
Space Type.
Definition: local_finite_element_id.h:102
@ NEDELEC
Definition: local_finite_element_id.h:109
@ CROUZEIX_RAVIART
Definition: local_finite_element_id.h:105
@ USER_DEFINED
Definition: local_finite_element_id.h:110
@ PIECEWISE_CONSTANT
Definition: local_finite_element_id.h:106
@ LAGRANGE
Definition: local_finite_element_id.h:104
@ DG
Definition: local_finite_element_id.h:107
@ NONE
Definition: local_finite_element_id.h:103
@ NUM_SPACE_TYPES
Definition: local_finite_element_id.h:111
@ MINI
Definition: local_finite_element_id.h:108
std::ostream & operator<<(std::ostream &outStream, const ug::MathMatrix< 2, 2 > &m)
Definition: math_matrix.cpp:38
static const int dim
the ug namespace
LFEID ConvertStringToLFEID(const char *type, int dim, int order)
returns the LFEID for a combination of Space and order
Definition: local_finite_element_id.cpp:64