NiHu  2.0
gauss_function_space_view.hpp
1 #ifndef NIHU_GAUSS_FUNCTION_SPACE_VIEW_HPP_INCLUDED
2 #define NIHU_GAUSS_FUNCTION_SPACE_VIEW_HPP_INCLUDED
3 
4 #include "gauss_field_view.hpp"
5 
7 #include "tmp/algorithm.hpp"
8 
9 namespace NiHu
10 {
11 namespace function_space_impl_internal
12 {
13  template <class Mesh, class Dimension>
14  struct get_num_dofs<Mesh, field_option::gauss, Dimension>
15  {
16  template <class ElemType>
17  struct count_elem_type_nodes
18  {
19  struct type
20  {
21  void operator()(Mesh const& mesh, size_t &count)
22  {
23  typedef typename field_traits::internal::assign_gauss_shape<typename ElemType::domain_t>::type nset_t;
24 
25  count +=
26  (mesh.template end<ElemType>() - mesh.template begin<ElemType>()) * // Number of elements of the given type
27  shape_set_traits::num_nodes<nset_t>::value; // Number of nodes per element
28  }
29  };
30  };
31 
33  static size_t eval(Mesh const& mesh)
34  {
35  size_t count = 0;
36  tmp::call_each<
37  typename Mesh::elem_type_vector_t,
38  count_elem_type_nodes<tmp::_1>,
39  Mesh const&,
40  size_t& // Explicit type info required for passing reference
41  >(mesh, count);
42  return count * traits_t::quantity_dimension;
43  }
44  };
45 } // namespace NiHu::function_space_impl_internal
46 
53 template <class Mesh, class Dimension = field_dimension::_1d>
54 function_space_view<Mesh, field_option::gauss, Dimension> const &
55  gauss_view(mesh_base<Mesh> const &msh, Dimension dim = Dimension())
56 {
57  return create_function_space_view(msh.derived(), field_option::gauss(), dim);
58 }
59 
60 } // namespace NiHu
61 #endif /* NIHU_GAUSS_FUNCTION_SPACE_VIEW_HPP_INCLUDED*/
NiHu::function_space_impl_internal::get_num_dofs
Definition: function_space.hpp:155
algorithm.hpp
vectoralgorithms
function_space.hpp
declaration of class function_space
NiHu::mesh
container class for a mesh
Definition: mesh.hpp:110
NiHu::shape_set_traits::num_nodes
Defines the number of shape functions in the set.
Definition: shapeset.hpp:110
NiHu::function_space_traits
traits class of function spaces
Definition: function_space.hpp:39