Rheolef  7.1
an efficient C++ finite element environment
space_component.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_SPACE_COMPONENT_H
2 #define _RHEOLEF_SPACE_COMPONENT_H
3 
24 #include "rheolef/space.h"
25 
26 namespace rheolef {
27 
28 template<class T, class M>
30 public:
31 
33 
34 // allocators:
35 
37  : _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
38  _i_comp (sc.is_hierarchical() ? _unset : i_comp)
39  {}
41  : _constit(x._constit), _i_comp(x._i_comp) {}
42 
43 // implicit conversion to space:
44 
45  operator space_basic<T,M>() const {
46  check_macro (_i_comp == _unset, "space-component building from non-hierarchical basis: not yet supported");
47  return space_basic<T,M>(_constit);
48  }
49 
50 // accessor:
51 
53  space_component<T,M> sub (_constit, i_comp);
54  return sub;
55  }
56 
57 // modifier:
58 
59  void block (std::string dom_name) {
60  if (_i_comp == _unset) {
61  _constit.do_act (space_act(dom_name, space_act::block));
62  } else {
63  _constit.do_act (space_act(dom_name, _i_comp, space_act::block));
64  }
65  }
66  void block (const domain_indirect_basic<M>& dom) {
67  if (_i_comp == _unset) {
68  _constit.do_act (space_act(dom.name(), space_act::block));
69  } else {
70  _constit.do_act (space_act(dom.name(), _i_comp, space_act::block));
71  }
72  }
73 
74 protected:
75  static const size_type _unset = std::numeric_limits<size_type>::max();
76 // data:
77  space_constitution<T,M>& _constit; // non-const reference: block() modify the _constit
78  size_type _i_comp; // used only when vector/tensor basis
79 };
80 // ===========================================================================
81 // const version
82 // ===========================================================================
83 template<class T, class M>
85 public:
86 
88 
89 // allocators:
90 
92  : _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
93  _i_comp (sc.is_hierarchical() ? _unset : i_comp)
94  {}
96  : _constit(x._constit), _i_comp(x._i_comp) {}
97 
98 // implicit conversion to space:
99 
100  operator space_basic<T,M>() const {
101  check_macro (_i_comp == _unset, "space-component building from non-hierarchical basis: not yet supported");
102  return space_basic<T,M>(_constit);
103  }
104 
105 // accessor:
106 
107 #ifdef TODO
108  space_component_const<T,M> operator[] (size_type i_comp) const {
109  space_component_const<T,M> sub (_constit [i_comp]);
110  return sub;
111  }
112 #endif // TODO
113 
114 protected:
115  static const size_type _unset = std::numeric_limits<size_type>::max();
116 // data:
119 };
120 // ========================================
121 // inlined
122 // ========================================
123 template <class T, class M>
124 inline
127 {
128  space_component<T,M> Vi (_constit, i_comp);
129  return Vi;
130 }
131 template <class T, class M>
132 inline
135 {
136  return space_component_const<T,M> (_constit, i_comp);
137 }
138 
139 } // namespace rheolef
140 #endif // _RHEOLEF_SPACE_COMPONENT_H
rheolef::space_component_const::_i_comp
size_type _i_comp
Definition: space_component.h:118
rheolef::space_component::space_component
space_component(space_constitution< T, M > &sc, size_type i_comp)
Definition: space_component.h:36
rheolef::space_component::block
void block(std::string dom_name)
Definition: space_component.h:59
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
rheolef::space_component::operator[]
space_component< T, M > operator[](size_type i_comp) const
Definition: space_component.h:52
rheolef::space_component::_i_comp
size_type _i_comp
Definition: space_component.h:78
rheolef::space_component::_unset
static const size_type _unset
Definition: space_component.h:75
rheolef::space_base_rep::operator[]
space_component< T, M > operator[](size_type i_comp)
Definition: space_component.h:126
rheolef::space_basic
the finite element space
Definition: space.h:352
rheolef::space_act
Definition: space_constitution.h:38
rheolef::space_act::block
@ block
Definition: space_constitution.h:47
rheolef::space_component::space_component
space_component(const space_component< T, M > &x)
Definition: space_component.h:40
rheolef::space_component_const
Definition: space_component.h:84
rheolef::space_component::block
void block(const domain_indirect_basic< M > &dom)
Definition: space_component.h:66
rheolef::space_component_const::space_component_const
space_component_const(const space_component< T, M > &x)
Definition: space_component.h:95
rheolef::space_component
Definition: space_component.h:29
rheolef::space_component_const::space_component_const
space_component_const(const space_constitution< T, M > &sc, size_type i_comp)
Definition: space_component.h:91
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::space_component_const::size_type
space_basic< T, M >::size_type size_type
Definition: space_component.h:87
rheolef::space_component_const::_unset
static const size_type _unset
Definition: space_component.h:115
rheolef::space_component_const::_constit
const space_constitution< T, M > & _constit
Definition: space_component.h:117
rheolef::space_base_rep::size_type
space_pair_type::size_type size_type
Definition: space.h:164
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::space_component::size_type
space_basic< T, M >::size_type size_type
Definition: space_component.h:32
rheolef::space_component::_constit
space_constitution< T, M > & _constit
Definition: space_component.h:77
rheolef::domain_indirect_basic
the finite element boundary domain
Definition: domain_indirect.h:335
rheolef::space_constitution
Definition: space_constitution.h:381