ug4
element_list_traits.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3  * Author: Dmitry Logashenko
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 /*
34  * Classes for computing integral properties of geometric objects types in lists.
35  */
36 #ifndef __H__UG__LIB_DISC__REFERENCE_ELEMENT__ELEMENT_LIST_TRAITS__
37 #define __H__UG__LIB_DISC__REFERENCE_ELEMENT__ELEMENT_LIST_TRAITS__
38 
39 // further lib_disc headers
41 
42 // Boost-C++ headers
43 #include <boost/mpl/transform_view.hpp>
44 #include <boost/mpl/fold.hpp>
45 #include <boost/mpl/min_max.hpp>
46 
47 namespace ug{
48 
50 
58 template <typename ElemList>
60 {
63  {
64  template <typename TElem> class apply
65  {
67  public: typedef boost::mpl::int_<ref_elem_type::numCorners> type;
68  };
69  };
70 
73  {
74  template <typename TElem> class apply
75  {
77  public: typedef boost::mpl::int_<ref_elem_type::numEdges> type;
78  };
79  };
80 
83  {
84  template <typename TElem> class apply
85  {
87  public: typedef boost::mpl::int_<ref_elem_type::numFaces> type;
88  };
89  };
90 
93  {
94  template <typename TElem> class apply
95  {
97  public: typedef boost::mpl::int_<ref_elem_type::numVolumes> type;
98  };
99  };
100 
103  {
104  template <typename TElem> class apply
105  {
107  public: typedef boost::mpl::int_<ref_elem_type::numSides> type;
108  };
109  };
110 
111 public:
112 
114  static const int maxCorners
115  = boost::mpl::fold
116  <
117  boost::mpl::transform_view<ElemList, mfc_num_corners_of_elem>,
118  boost::mpl::int_<0>,
119  boost::mpl::max<boost::mpl::_1,boost::mpl::_2>
120  >::type::value;
121 
123  static const int maxEdges
124  = boost::mpl::fold
125  <
126  boost::mpl::transform_view<ElemList, mfc_num_edges_of_elem>,
127  boost::mpl::int_<0>,
128  boost::mpl::max<boost::mpl::_1,boost::mpl::_2>
129  >::type::value;
130 
132  static const int maxFaces
133  = boost::mpl::fold
134  <
135  boost::mpl::transform_view<ElemList, mfc_num_faces_of_elem>,
136  boost::mpl::int_<0>,
137  boost::mpl::max<boost::mpl::_1,boost::mpl::_2>
138  >::type::value;
139 
141  static const int maxVolumes
142  = boost::mpl::fold
143  <
144  boost::mpl::transform_view<ElemList, mfc_num_volumes_of_elem>,
145  boost::mpl::int_<0>,
146  boost::mpl::max<boost::mpl::_1,boost::mpl::_2>
147  >::type::value;
148 
150  static const int maxSides
151  = boost::mpl::fold
152  <
153  boost::mpl::transform_view<ElemList, mfc_num_sides_of_elem>,
154  boost::mpl::int_<0>,
155  boost::mpl::max<boost::mpl::_1,boost::mpl::_2>
156  >::type::value;
157 };
158 
159 } // end namespace ug
160 
161 #endif // __H__UG__LIB_DISC__REFERENCE_ELEMENT__ELEMENT_LIST_TRAITS__
162 
163 /* End of File */
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: element_list_traits.h:66
boost::mpl::int_< ref_elem_type::numCorners > type
returned type (i.e. result of the metafunction)
Definition: element_list_traits.h:67
Definition: element_list_traits.h:75
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: element_list_traits.h:76
boost::mpl::int_< ref_elem_type::numEdges > type
returned type (i.e. result of the metafunction)
Definition: element_list_traits.h:77
Definition: element_list_traits.h:85
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: element_list_traits.h:86
boost::mpl::int_< ref_elem_type::numFaces > type
returned type (i.e. result of the metafunction)
Definition: element_list_traits.h:87
Definition: element_list_traits.h:105
boost::mpl::int_< ref_elem_type::numSides > type
returned type (i.e. result of the metafunction)
Definition: element_list_traits.h:107
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: element_list_traits.h:106
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: element_list_traits.h:96
boost::mpl::int_< ref_elem_type::numVolumes > type
returned type (i.e. result of the metafunction)
Definition: element_list_traits.h:97
Class for computing integral properties of geometric objects types in lists.
Definition: element_list_traits.h:60
static const int maxCorners
Max. number of corners of the elements in the element list (as a constant)
Definition: element_list_traits.h:115
static const int maxFaces
Max. number of faces of the elements in the element list (as a constant)
Definition: element_list_traits.h:133
static const int maxEdges
Max. number of edges of the elements in the element list (as a constant)
Definition: element_list_traits.h:124
static const int maxSides
Max. number of sides (edges or faces) of the elements in the element list (as a constant)
Definition: element_list_traits.h:151
static const int maxVolumes
Max. number of volumes of the elements in the element list (as a constant)
Definition: element_list_traits.h:142
the ug namespace
Metafunction class for counting corners in an element type.
Definition: element_list_traits.h:63
Metafunction class for counting edges in an element type.
Definition: element_list_traits.h:73
Metafunction class for counting faces in an element type.
Definition: element_list_traits.h:83
Metafunction class for counting sides (i.e. edges or faces) in an element type.
Definition: element_list_traits.h:103
Metafunction class for counting volumes in an element type.
Definition: element_list_traits.h:93
traits for reference elements
Definition: reference_element_traits.h:48