NiHu  2.0
function_space.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
24 #ifndef FUNCTION_SPACE_HPP_INCLUDED
25 #define FUNCTION_SPACE_HPP_INCLUDED
26 
27 #include "../util/casted_iterator.hpp"
28 #include "../util/crtp_base.hpp"
29 #include "../util/type2tag.hpp"
30 #include "field.hpp"
31 #include "field_dimension.hpp"
32 #include "mesh.hpp"
33 
34 namespace NiHu
35 {
36 
38 template <class Derived>
40 
41 
43 template <class Derived>
45 {
46 public:
48 
51 
53  typedef typename traits_t::mesh_t mesh_t;
54 
56  typedef typename traits_t::field_type_vector_t field_type_vector_t;
57 
59  typedef typename tmp::deref<
60  typename tmp::begin<
62  >::type
63  >::type::x_t x_t;
64 
65  enum {
66  quantity_dimension = traits_t::quantity_dimension
67  };
68 
71  mesh_t const &get_mesh() const
72  {
73  return derived().get_mesh();
74  }
75 
80  template <class FieldType>
81  typename traits_t::template iterator<FieldType>::type
82  field_begin() const
83  {
84  return derived().template field_begin<FieldType>();
85  }
86 
91  template <class FieldType>
92  typename traits_t::template iterator<FieldType>::type
93  field_end() const
94  {
95  return derived().template field_end<FieldType>();
96  }
97 
102  size_t get_num_dofs() const
103  {
104  return derived().get_num_dofs();
105  }
106 };
107 
108 
110 template <class Derived>
112 
113 
114 // forward declaration
115 template<class Mesh, class FieldOption, class Dimension>
117 
118 
120 template <class Mesh, class FieldOption, class Dimension>
121 struct function_space_traits<function_space_view<Mesh, FieldOption, Dimension> >
122 {
124  typedef Mesh mesh_t;
125 
126  enum {
127  quantity_dimension = Dimension::value
128  };
129 
132 
134  typedef typename tmp::transform<
135  etv_t,
136  tmp::inserter <
137  typename tmp::empty<etv_t>::type,
139  >,
142 
144  template <class field_t>
145  struct iterator : casted_iterator<
146  typename mesh_elem_iterator_t<typename field_t::elem_t>::type,
147  field_t
148  > {};
149 };
150 
151 
152 namespace function_space_impl_internal
153 {
154  template <class Mesh, class FieldOption, class Dimension>
155  struct get_num_dofs;
156 
157  template <class Mesh, class Dimension>
158  struct get_num_dofs<Mesh, field_option::constant, Dimension>
159  {
161  static size_t eval(Mesh const& mesh)
162  {
163  return mesh.get_num_elements() * traits_t::quantity_dimension;
164  }
165  };
166 
167  template <class Mesh, class Dimension>
168  struct get_num_dofs<Mesh, field_option::isoparametric, Dimension>
169  {
171  static size_t eval(Mesh const& mesh)
172  {
173  return mesh.get_num_points() * traits_t::quantity_dimension;;
174  }
175  };
176 
177 } // namespace NiHu::function_space_impl_internal
178 
184 template<class Mesh, class FieldOption, class Dimension>
185 class function_space_impl<function_space_view<Mesh, FieldOption, Dimension> > :
186  public Mesh
187 {
188 public:
191 
192 #if 0
193 private:
195  size_t get_num_dofs_impl(field_option::constant) const
196  {
197  return Mesh::get_num_elements() * traits_t::quantity_dimension;
198  }
199 
201  size_t get_num_dofs_impl(field_option::isoparametric) const
202  {
203  return Mesh::get_num_points() * traits_t::quantity_dimension;
204  }
205 #endif
206 
207 public:
209  Mesh const &get_mesh() const
210  {
211  return static_cast<Mesh const &> (*this);
212  }
213 
218  template <class FieldType>
219  typename traits_t::template iterator<FieldType>::type
220  field_begin() const
221  {
222  return Mesh::template begin<typename FieldType::elem_t>();
223  }
224 
229  template <class FieldType>
230  typename traits_t::template iterator<FieldType>::type
231  field_end() const
232  {
233  return Mesh::template end<typename FieldType::elem_t>();
234  }
235 
240  size_t get_num_dofs() const
241  {
243  //return get_num_dofs_impl(FieldOption());
244  }
245 };
246 
247 
253 template<class Mesh, class FieldOption, class Dimension = field_dimension::_1d>
254 class function_space_view :
255  public function_space_base<function_space_view<Mesh, FieldOption, Dimension> >,
256  public function_space_impl<function_space_view<Mesh, FieldOption, Dimension> >
257 {
258 public:
261 
262  using impl_t::get_mesh;
263  using impl_t::field_begin;
264  using impl_t::field_end;
265  using impl_t::get_num_dofs;
266 };
267 
268 
276 template <class Mesh, class Option, class Dimension = field_dimension::_1d>
278  create_function_space_view(mesh_base<Mesh> const &msh, Option, Dimension dim = Dimension())
279 {
280  return static_cast<function_space_view<Mesh, Option, Dimension> const &>(msh.derived());
281 }
282 
289 template <class Mesh, class Dimension = field_dimension::_1d>
290 function_space_view<Mesh, field_option::isoparametric, Dimension> const &
291  isoparametric_view(mesh_base<Mesh> const &msh, Dimension dim = Dimension())
292 {
293  return create_function_space_view(msh.derived(), field_option::isoparametric(), dim);
294 }
295 
302 template <class Mesh, class Dimension = field_dimension::_1d>
303 function_space_view<Mesh, field_option::constant, Dimension> const &
304  constant_view(mesh_base<Mesh> const &msh, Dimension dim = Dimension())
305 {
306  return create_function_space_view(msh.derived(), field_option::constant(), dim);
307 }
308 
309 
310 // forward declaration
311 template <class FuncSpace>
313 
315 template <class FuncSpace>
317 {
320 
322  typedef typename base_traits::mesh_t mesh_t;
323 
324  enum {
325  quantity_dimension = base_traits::quantity_dimension
326  };
327 
329  typedef typename tmp::transform<
330  typename base_traits::field_type_vector_t,
332  typename tmp::empty<
333  typename base_traits::field_type_vector_t
334  >::type,
336  >,
339 
341  template <class dirac_field_t>
342  struct iterator : casted_iterator<
343  typename base_traits::template iterator<
344  typename dirac_field_t::field_t
345  >::type,
346  dirac_field_t,
347  field_impl<typename dirac_field_t::field_t>
348  > {};
349 };
350 
351 
355 template <class FuncSpace>
356 class dirac_space :
357  public function_space_base<dirac_space<FuncSpace> >,
358  public function_space_impl<FuncSpace>
359 {
360 public:
365 
366  // explicitly define mesh_t because it would be ambiguous otherwise
367  typedef typename traits_t::mesh_t mesh_t;
368 
369  // explicitly define field_type_vector_t because it would be ambiguous otherwise
370  typedef typename traits_t::field_type_vector_t field_type_vector_t;
371 
372  using impl_t::get_mesh;
373  using impl_t::get_num_dofs;
374 
376  template <class dirac_field_t>
377  typename traits_t::template iterator<dirac_field_t>::type
378  field_begin() const
379  {
380  return impl_t::template field_begin<typename dirac_field_t::field_t>();
381  }
382 
384  template <class dirac_field_t>
385  typename traits_t::template iterator<dirac_field_t>::type
386  field_end() const
387  {
388  return impl_t::template field_end<typename dirac_field_t::field_t>();
389  }
390 };
391 
392 
398 template <class FuncSpace>
399 dirac_space<FuncSpace> const &
401 {
402  return static_cast<dirac_space<FuncSpace> const &>(
403  static_cast<function_space_impl<FuncSpace> const &>(space.derived()));
404 }
405 
406 
407 
408 // forward declaration
409 template <class FieldTypeVector>
411 
413 template <class FieldTypeVector>
415 {
417  template <class field_t>
418  struct elemize
419  {
420  typedef typename field_t::elem_t type;
421  };
422 
424  typedef typename tmp::unique<
425  typename tmp::transform<
426  FieldTypeVector,
430  >,
432  >::type
434 };
435 
436 
438 template <class FieldTypeVector>
439 struct function_space_traits<function_space<FieldTypeVector> >
440 {
443 
445  typedef FieldTypeVector field_type_vector_t;
446 
447  enum {
448  quantity_dimension = tmp::deref<typename tmp::begin<field_type_vector_t>::type>::type::quantity_dimension
449  };
450 
452  template <class field_t>
453  struct iterator
454  {
456  };
457 };
458 
459 
463 template <class FieldTypeVector>
464 class function_space_impl<function_space<FieldTypeVector> > :
465  public function_space_traits<function_space<FieldTypeVector> >::mesh_t
466 {
467 public:
470 
473 
475  typedef typename traits_t::mesh_t mesh_t;
476 
478  typedef typename tmp::inherit<
479  typename tmp::transform<
484  >,
486  >::type
488 
489 protected:
491  template <class field_t>
492  struct field_adder { struct type {
494  bool operator() (unsigned const input[], function_space_impl &fsp)
495  {
496  typedef typename field_t::elem_t elem_t;
497  if (input[0] == field_t::id)
498  {
499  // construct element and push
500  typename elem_t::nodes_t nodes;
501  typename elem_t::coords_t coords;
502  for (unsigned i = 0; i < elem_t::num_nodes; ++i)
503  {
504  nodes[i] = input[i+1];
505  coords.col(i) = fsp.points[nodes[i]];
506  }
507  elem_t const &elemref = fsp.push_element(elem_t(coords, fsp.m_num_elements++, nodes));
508 
509  // construct field and push
510  typename field_t::dofs_t dofs;
511  for (unsigned i = 0; i < field_t::num_dofs; ++i)
512  dofs[i] = input[i+elem_t::num_nodes+1];
513  fsp.push_field(field_t(elemref, dofs));
514 
515  fsp.m_num_dofs = std::max(fsp.m_num_dofs, dofs.maxCoeff()+1);
516  return true;
517  }
518  return false;
519  }
520  };};
521 
522 public:
524  function_space_impl() : m_num_dofs(0)
525  {
526  }
527 
529  template <class node_matrix_t, class field_matrix_t>
530  function_space_impl(node_matrix_t const &nodes, field_matrix_t const &fields)
531  : m_num_dofs(0)
532  {
533  unsigned const N_MAX_FIELD = 1000;
534  double c[mesh_t::nDim];
535 
536  for (int i = 0; i < nodes.rows(); ++i)
537  {
538  for (unsigned j = 0; j < mesh_t::nDim; ++j)
539  c[j] = nodes(i,j);
540  this->add_node(c);
541  }
542  unsigned e[N_MAX_FIELD];
543  for (int i = 0; i < fields.rows(); ++i)
544  {
545  for (int j = 0; j < fields.cols(); ++j)
546  e[j] = (unsigned)fields(i,j);
547  add_field(e);
548  }
549  }
550 
554  mesh_t const &get_mesh() const
555  {
556  return static_cast<mesh_t const &>(*this);
557  }
558 
560  template <class FieldType>
561  typename traits_t::template iterator<FieldType>::type
562  field_begin() const
563  {
564  return m_fields.eigen_std_vector<FieldType>::type::begin();
565  }
566 
568  template <class FieldType>
569  typename traits_t::template iterator<FieldType>::type
570  field_end() const
571  {
572  return m_fields.eigen_std_vector<FieldType>::type::end();
573  }
574 
576  bool add_field(unsigned const input[])
577  {
578  return tmp::call_until<
580  field_adder<tmp::_1>,
581  unsigned const*,
583  >(input, *this);
584  }
585 
587  template <class field_t>
589  {
590  m_fields.eigen_std_vector<field_t>::type::push_back(f.derived());
591  return *(m_fields.eigen_std_vector<field_t>::type::rbegin());
592  }
593 
598  unsigned get_num_fields() const
599  {
600  return this->get_num_elements();
601  }
602 
604  unsigned get_num_dofs() const
605  {
606  return m_num_dofs;
607  }
608 
609 protected:
613  unsigned m_num_dofs;
614 };
615 
616 
620 template <class FieldTypeVector>
621 class function_space :
622  public function_space_base<function_space<FieldTypeVector> >,
623  public function_space_impl<function_space<FieldTypeVector> >
624 {
625 public:
628 
630  typedef typename impl_t::mesh_t mesh_t;
631 
634 
635  using impl_t::field_begin;
636  using impl_t::field_end;
637  using impl_t::get_num_dofs;
638  using impl_t::get_mesh;
639 
642  impl_t()
643  {
644  }
645 
647  template <class node_matrix_t, class field_matrix_t>
648  function_space(node_matrix_t const &nodes, field_matrix_t const &fields)
649  : impl_t(nodes, fields)
650  {
651  }
652 };
653 
662 template <class nodes_t, class elements_t, class...fields_t>
663 function_space<tmp::vector<typename tag2type<fields_t>::type...> >
664  create_function_space(nodes_t const &nodes, elements_t const &elements, fields_t const &...fields)
665 {
667 }
668 
669 
671 template <class DerivedField, class OriginalIterator>
673 
677 template <class Field, class OriginalIterator>
679  : public OriginalIterator
680 {
681 public:
683  typedef Field original_field_t;
685 
686  typedef typename derivative_field_t::x_t x_t;
687 
689  typedef OriginalIterator original_iterator_t;
690 
692 
694  template <class Direction>
695  directional_derivative_field_iterator(original_iterator_t const& iter, Eigen::MatrixBase<Direction> const& direction)
696  : original_iterator_t(iter)
697  , m_direction(direction.derived())
698  {
699 
700  }
701 
702  value_t operator*() const
703  {
704  // TODO: check what the original iterator returns upon dereferencing
705  // if it is an object created on-the-fly, error is expected
706  // as the directional_derivative_field stores the original field by reference
707 
708  return value_t(this->original_iterator_t::operator*(), m_direction);
709  }
710 
711 private:
712  //original_iterator_t m_iterator;
713  x_t const &m_direction;
714 };
715 
716 
720 template <class FunctionSpace>
722 
724 template <class FunctionSpace>
726 {
727  typedef FunctionSpace original_function_space_t;
728 
731 
733  typedef typename original_function_space_t::mesh_t mesh_t;
734 
736  typedef typename tmp::transform<
737  typename base_traits::field_type_vector_t,
739  typename tmp::empty<
740  typename base_traits::field_type_vector_t
741  >::type,
743  >,
746 
747  enum {
748  quantity_dimension = original_function_space_t::quantity_dimension
749  };
750 
751  template <class field_t>
752  struct iterator;
753 
754  template <class original_field_t>
755  struct iterator<directional_derivative_field<original_field_t> >
756  {
757  private:
758  typedef typename function_space_traits<original_function_space_t>::template iterator<original_field_t>::type original_iterator_t;
760  public:
761 
762  //typedef directional_derivative_field_iterator<field_t, FunctionSpace> type;
764  };
765 };
766 
767 template <class FunctionSpace>
769  : public function_space_base<directional_derivative_function_space<FunctionSpace>>
770 {
771 public:
773  typedef typename base_t::x_t x_t;
774  typedef typename base_t::mesh_t mesh_t;
775  typedef typename base_t::traits_t traits_t;
776 
777  template <class Direction>
778  directional_derivative_function_space(FunctionSpace const &fs, Eigen::MatrixBase<Direction> const &direction)
779  : m_fs(fs)
780  , m_derivative_direction(direction)
781  {
782  }
783 
784  mesh_t const &get_mesh() const
785  {
786  return m_fs.get_mesh();
787  }
788 
789  template <class FieldType>
790  typename traits_t::template iterator<FieldType>::type
791  field_begin() const
792  {
793  typedef typename traits_t::template iterator<FieldType>::type return_t;
794  typedef typename return_t::original_field_t original_field_t;
795 
796  return return_t(m_fs.template field_begin<original_field_t>(), m_derivative_direction);
797  }
798 
799  template <class FieldType>
800  typename traits_t::template iterator<FieldType>::type
801  field_end() const
802  {
803  typedef typename traits_t::template iterator<FieldType>::type return_t;
804  typedef typename return_t::original_field_t original_field_t;
805 
806  return return_t(m_fs.template field_end<original_field_t>(), m_derivative_direction);
807  }
808 
809 private:
810  FunctionSpace const &m_fs;
811  x_t const m_derivative_direction;
812 };
813 
814 template <class FunctionSpace, class Direction>
815 directional_derivative_function_space<FunctionSpace>
816 directional_derivative(function_space_base<FunctionSpace> const &fs, Eigen::MatrixBase<Direction> const &direction)
817 {
818  return directional_derivative_function_space<FunctionSpace>(fs.derived(), direction);
819 }
820 
821 
825 template <class FuncSpace>
826 struct is_function_space : std::is_base_of<
827  function_space_base<typename std::decay<FuncSpace>::type>,
828  typename std::decay<FuncSpace>::type
829 > {};
830 
831 } // namespace NiHu
832 
833 #endif // FUNCTION_SPACE_HPP_INCLUDED
834 
tmp::inherit
combine a sequence of classes so that the result is inherited from each element
Definition: algorithm.hpp:125
NiHu::function_space_impl< function_space< FieldTypeVector > >::m_fields
field_container_t m_fields
fields (BIG heterogeneous container)
Definition: function_space.hpp:611
NiHu::eigen_std_vector
Convert T to an std::vector<T> with Eigen allocator.
Definition: eigen_utils.hpp:41
NiHu::mesh::nDim
static const unsigned nDim
number of dimensions of the mesh
Definition: mesh.hpp:122
NiHu::volume_element
class describing a volume element that has no normal vector
Definition: element.hpp:455
NiHu::function_space_traits< function_space_view< Mesh, FieldOption, Dimension > >::mesh_t
Mesh mesh_t
the underlying mesh type
Definition: function_space.hpp:124
NiHu::function_space_traits< function_space< FieldTypeVector > >::field_type_vector_t
FieldTypeVector field_type_vector_t
the field type vector
Definition: function_space.hpp:445
NiHu::function_space_impl_internal::get_num_dofs
Definition: function_space.hpp:155
NiHu::field_option::constant
tag to describe a constant field
Definition: field.hpp:45
NiHu::function_space_impl< function_space< FieldTypeVector > >::field_end
traits_t::template iterator< FieldType >::type field_end() const
return end iterator of a subspace
Definition: function_space.hpp:570
NiHu::function_space_view
A mesh extended with a Field generating option.
Definition: function_space.hpp:116
tmp::deref
metafunction to dereference an iterator
Definition: sequence.hpp:114
NiHu::function_space_impl< function_space_view< Mesh, FieldOption, Dimension > >::field_begin
traits_t::template iterator< FieldType >::type field_begin() const
first field of given element type
Definition: function_space.hpp:220
NiHu::create_function_space_view
const function_space_view< Mesh, Option, Dimension > & create_function_space_view(mesh_base< Mesh > const &msh, Option, Dimension dim=Dimension())
factory function to transform a mesh into a function space
Definition: function_space.hpp:278
NiHu::function_space_traits< directional_derivative_function_space< FunctionSpace > >::base_traits
function_space_traits< original_function_space_t > base_traits
the parent traits
Definition: function_space.hpp:730
NiHu::directional_derivative_field_iterator< directional_derivative_field< Field >, OriginalIterator >::original_iterator_t
OriginalIterator original_iterator_t
Original iterator type.
Definition: function_space.hpp:689
NiHu::function_space_impl< function_space< FieldTypeVector > >::m_num_dofs
unsigned m_num_dofs
number of degrees of freedoms
Definition: function_space.hpp:613
NiHu::field_2_elem_type_vector::elemize
helper metafunction to extract the element type of a field
Definition: function_space.hpp:418
NiHu::dirac_space::traits_t
function_space_traits< dirac_space< FuncSpace > > traits_t
the traits class
Definition: function_space.hpp:362
NiHu::function_space_traits< function_space< FieldTypeVector > >::mesh_t
mesh< typename field_2_elem_type_vector< FieldTypeVector >::type > mesh_t
the underlying mesh type
Definition: function_space.hpp:442
NiHu::function_space_impl< function_space< FieldTypeVector > >::get_num_dofs
unsigned get_num_dofs() const
return number of dofs
Definition: function_space.hpp:604
NiHu::volume_element::coords_t
element_traits::coords_type< Derived >::type coords_t
matrix type that stores the element's corner nodes
Definition: element.hpp:235
NiHu::constant_view
const field_view< Elem, field_option::constant, Dimension > & constant_view(element_base< Elem > const &e, Dimension dim=Dimension())
constant field view factory
Definition: field.hpp:613
NiHu::function_space_impl< function_space< FieldTypeVector > >::get_mesh
const mesh_t & get_mesh() const
return underlying mesh reference
Definition: function_space.hpp:554
NiHu::is_function_space
metafunction determining if argument is function space expression
Definition: function_space.hpp:826
NiHu::function_space_impl
implementation class of function spaces
Definition: function_space.hpp:111
NiHu::function_space_base::x_t
tmp::deref< typename tmp::begin< typename mesh_t::elem_type_vector_t >::type >::type::x_t x_t
the location type in the function space
Definition: function_space.hpp:63
NiHu::function_space::function_space
function_space()
constructor
Definition: function_space.hpp:641
NiHu::directional_derivative_field
field class that computes the directional derivative of a field
Definition: field.hpp:496
tmp::begin
return begin iterator of a sequence
Definition: sequence.hpp:79
NiHu::space
class representing a coordinate space with a scalar and a dimension
Definition: space.hpp:36
NiHu::mesh::get_num_elements
unsigned get_num_elements() const
return number of elements
Definition: mesh.hpp:277
NiHu::function_space_base::mesh_t
traits_t::mesh_t mesh_t
the underlying mesh type
Definition: function_space.hpp:53
NiHu::casted_iterator
iterator class provides access to its value_t after static cast
Definition: casted_iterator.hpp:37
NiHu::function_space::field_type_vector_t
impl_t::field_type_vector_t field_type_vector_t
field type vector type redefined to avoid ambigous lookup
Definition: function_space.hpp:633
NIHU_CRTP_HELPERS
#define NIHU_CRTP_HELPERS
define CRTP helper function
Definition: crtp_base.hpp:29
NiHu::field_option::isoparametric
tag to describe an isoparametric field
Definition: field.hpp:43
NiHu::function_space_impl< function_space< FieldTypeVector > >::field_begin
traits_t::template iterator< FieldType >::type field_begin() const
return begin iterator of a subspace
Definition: function_space.hpp:562
NiHu::function_space_impl< function_space< FieldTypeVector > >::field_container_t
tmp::inherit< typename tmp::transform< field_type_vector_t, tmp::inserter< typename tmp::empty< field_type_vector_t >::type, tmp::push_back< tmp::_1, tmp::_2 > >, eigen_std_vector< tmp::_1 > >::type >::type field_container_t
combine field_type_vector into a BIG heterogeneous std::vector container
Definition: function_space.hpp:487
NiHu::function_space_impl< function_space_view< Mesh, FieldOption, Dimension > >::get_num_dofs
size_t get_num_dofs() const
return number of degrees of freedom
Definition: function_space.hpp:240
NiHu::function_space_base
CRTP base class of function spaces.
Definition: function_space.hpp:44
NiHu::directional_derivative
directional_derivative_field< Field > directional_derivative(field_base< Field > const &field, Eigen::MatrixBase< Direction > const &direction)
factory function to create a directional derivative field
Definition: field.hpp:604
NiHu::function_space_impl< function_space_view< Mesh, FieldOption, Dimension > >::get_mesh
const Mesh & get_mesh() const
return mesh reference
Definition: function_space.hpp:209
NiHu::function_space_traits< dirac_space< FuncSpace > >::field_type_vector_t
tmp::transform< typename base_traits::field_type_vector_t, tmp::inserter< typename tmp::empty< typename base_traits::field_type_vector_t >::type, tmp::push_back< tmp::_1, tmp::_2 > >, dirac_field< tmp::_1 > >::type field_type_vector_t
the field type vector
Definition: function_space.hpp:338
field.hpp
implementation of fields and field views
NiHu::isoparametric_view
const field_view< Elem, field_option::isoparametric, Dimension > & isoparametric_view(element_base< Elem > const &e, Dimension dim=Dimension())
isoparametric field view factory
Definition: field.hpp:621
NiHu::directional_derivative_function_space
directional derivative of a function space
Definition: function_space.hpp:721
NiHu::field_points::get_num_points
size_t get_num_points() const
return number of points
Definition: mesh.hpp:78
NiHu::function_space_traits< directional_derivative_function_space< FunctionSpace > >::field_type_vector_t
tmp::transform< typename base_traits::field_type_vector_t, tmp::inserter< typename tmp::empty< typename base_traits::field_type_vector_t >::type, tmp::push_back< tmp::_1, tmp::_2 > >, directional_derivative_field< tmp::_1 > >::type field_type_vector_t
the field type vector
Definition: function_space.hpp:745
NiHu::function_space_traits< directional_derivative_function_space< FunctionSpace > >::mesh_t
original_function_space_t::mesh_t mesh_t
the mesh type
Definition: function_space.hpp:733
NiHu::function_space_traits< function_space_view< Mesh, FieldOption, Dimension > >::field_type_vector_t
tmp::transform< etv_t, tmp::inserter< typename tmp::empty< etv_t >::type, tmp::push_back< tmp::_1, tmp::_2 > >, field_view< tmp::_1, FieldOption, Dimension > >::type field_type_vector_t
the field type vector
Definition: function_space.hpp:141
NiHu::function_space_base::field_begin
traits_t::template iterator< FieldType >::type field_begin() const
begin iterator of given field type
Definition: function_space.hpp:82
NiHu::directional_derivative_field_iterator
iterator class for iterating over a directional derivative function space
Definition: function_space.hpp:672
NiHu::function_space::function_space
function_space(node_matrix_t const &nodes, field_matrix_t const &fields)
constructor from node and field definition matrices
Definition: function_space.hpp:648
NiHu::function_space_impl< function_space_view< Mesh, FieldOption, Dimension > >::traits_t
function_space_traits< function_space_view< Mesh, FieldOption, Dimension > > traits_t
the traits class
Definition: function_space.hpp:190
NiHu::function_space_impl< function_space< FieldTypeVector > >
class describing a function space
Definition: function_space.hpp:464
tmp::unique
return a vector containing each element of Seq exactly once
Definition: algorithm.hpp:324
NiHu::function_space_base::field_type_vector_t
traits_t::field_type_vector_t field_type_vector_t
the field type vector
Definition: function_space.hpp:56
NiHu::dirac_space
Dirac-like extension of a function space.
Definition: function_space.hpp:312
NiHu::operator*
scaled_integral_operator< Scalar, typename std::enable_if< is_integral_operator< IntOp >::value, IntOp >::type > operator*(Scalar &&scalar, IntOp &&intop)
factory operator to create a scaled integral operator
Definition: integral_operator.hpp:189
NiHu::function_space::impl_t
function_space_impl< function_space< FieldTypeVector > > impl_t
the implementation type
Definition: function_space.hpp:627
tmp::empty
return empty sequence
Definition: sequence.hpp:64
NiHu::create_function_space
function_space< tmp::vector< typename tag2type< fields_t >::type... > > create_function_space(nodes_t const &nodes, elements_t const &elements, fields_t const &...fields)
factory function to create a function space from fields
Definition: function_space.hpp:664
NiHu::function_space_base::field_end
traits_t::template iterator< FieldType >::type field_end() const
end iterator of given field type
Definition: function_space.hpp:93
NiHu::function_space_view::impl_t
function_space_impl< function_space_view< Mesh, FieldOption, Dimension > > impl_t
the implementation class
Definition: function_space.hpp:260
NiHu::function_space_impl< function_space< FieldTypeVector > >::get_num_fields
unsigned get_num_fields() const
return number of fields
Definition: function_space.hpp:598
NiHu::volume_element::nodes_t
Eigen::Matrix< unsigned, num_nodes, 1 > nodes_t
vector type that stores the element's corner node indices
Definition: element.hpp:233
NiHu::field_base
CRTP base class of all fields.
Definition: field.hpp:111
NiHu::dirac_space::impl_t
function_space_impl< FuncSpace > impl_t
the implementation class
Definition: function_space.hpp:364
NiHu::function_space_base::traits_t
NIHU_CRTP_HELPERS typedef function_space_traits< Derived > traits_t
the traits class
Definition: function_space.hpp:50
NiHu::function_space_impl< function_space< FieldTypeVector > >::mesh_t
traits_t::mesh_t mesh_t
the underlying mesh type
Definition: function_space.hpp:475
NiHu::function_space_traits< dirac_space< FuncSpace > >::mesh_t
base_traits::mesh_t mesh_t
the mesh type
Definition: function_space.hpp:322
NiHu::directional_derivative_field_iterator< directional_derivative_field< Field >, OriginalIterator >::original_field_t
Field original_field_t
The original field type.
Definition: function_space.hpp:683
NiHu::directional_derivative_field::x_t
crtp_base_t::x_t x_t
the physical location type
Definition: field.hpp:539
NiHu::function_space_base::get_num_dofs
size_t get_num_dofs() const
return number of degrees of freedom
Definition: function_space.hpp:102
NiHu::dirac_space::field_end
traits_t::template iterator< dirac_field_t >::type field_end() const
return end iterator of a subvector of dirac fields
Definition: function_space.hpp:386
NiHu::function_space_impl< function_space< FieldTypeVector > >::field_type_vector_t
traits_t::field_type_vector_t field_type_vector_t
the field type vector
Definition: function_space.hpp:472
NiHu::field_2_elem_type_vector
metafunction to return the element type vector of a field type vector
Definition: function_space.hpp:414
NiHu::field_view::elem_t
crtp_base_t::elem_t elem_t
the element type shorthand
Definition: field.hpp:351
tmp::push_back
push an element to the back
Definition: sequence.hpp:99
NiHu::mesh::elem_type_vector_t
ElemTypeVector elem_type_vector_t
define template parameter as nested type
Definition: mesh.hpp:116
NiHu::field_2_elem_type_vector::type
tmp::unique< typename tmp::transform< FieldTypeVector, tmp::inserter< typename tmp::empty< FieldTypeVector >::type, tmp::push_back< tmp::_1, tmp::_2 > >, elemize< tmp::_1 > >::type >::type type
the element type vector
Definition: function_space.hpp:433
NiHu::function_space_base::get_mesh
const mesh_t & get_mesh() const
return reference to the underlying mesh
Definition: function_space.hpp:71
NiHu::field_view
Field automatically generated from an element using a field generation option.
Definition: field.hpp:222
NiHu::function_space_impl< function_space_view< Mesh, FieldOption, Dimension > >::field_end
traits_t::template iterator< FieldType >::type field_end() const
last field of given element type
Definition: function_space.hpp:231
NiHu::function_space_traits< dirac_space< FuncSpace > >::base_traits
function_space_traits< FuncSpace > base_traits
the parent traits
Definition: function_space.hpp:319
NiHu::mesh
container class for a mesh
Definition: mesh.hpp:110
NiHu::function_space_traits< function_space_view< Mesh, FieldOption, Dimension > >::etv_t
mesh_t::elem_type_vector_t etv_t
the mesh element type vector type
Definition: function_space.hpp:131
NiHu::function_space
class describing a function space
Definition: function_space.hpp:410
NiHu::function_space::mesh_t
impl_t::mesh_t mesh_t
mesh type redefined to avoid ambigous lookup
Definition: function_space.hpp:630
NiHu::dirac_field
dirac view of a field
Definition: field.hpp:175
NiHu::function_space_impl< function_space< FieldTypeVector > >::push_field
const field_t & push_field(field_base< field_t > const &f)
push a field to the vector of fields
Definition: function_space.hpp:588
tmp::transform
transform elements in a sequence using a user-specified metafunctor and an inserter
Definition: algorithm.hpp:212
NiHu::dirac_space::field_begin
traits_t::template iterator< dirac_field_t >::type field_begin() const
return begin iterator of a subvector of dirac fields
Definition: function_space.hpp:378
NiHu::function_space_impl< function_space< FieldTypeVector > >::add_field
bool add_field(unsigned const input[])
add a field to the function space
Definition: function_space.hpp:576
NiHu::function_space_impl< function_space< FieldTypeVector > >::function_space_impl
function_space_impl()
constructor
Definition: function_space.hpp:524
NiHu::function_space_impl< function_space< FieldTypeVector > >::function_space_impl
function_space_impl(node_matrix_t const &nodes, field_matrix_t const &fields)
constructor from node and field definition matrices
Definition: function_space.hpp:530
tmp::inserter
a compile time inserter
Definition: sequence.hpp:118
NiHu::dirac
const dirac_field< Field > & dirac(field_base< Field > const &f)
dirac field view factory
Definition: field.hpp:629
NiHu::mesh_base
Definition: mesh.hpp:98
NiHu::function_space_traits
traits class of function spaces
Definition: function_space.hpp:39
NiHu::function_space_impl< function_space< FieldTypeVector > >::traits_t
function_space_traits< function_space< FieldTypeVector > > traits_t
the traits class
Definition: function_space.hpp:469
mesh.hpp
Declaration of class Mesh.