Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
space_component.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_SPACE_COMPONENT_H
2#define _RHEOLEF_SPACE_COMPONENT_H
23
24#include "rheolef/space.h"
25
26namespace rheolef {
27
28template<class T, class M>
30public:
31
33
34// allocators:
35
37 : _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
38 _i_comp (sc.is_hierarchical() ? _unset : i_comp)
39 {}
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");
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) {
62 } else {
64 }
65 }
66 void block (const domain_indirect_basic<M>& dom) {
67 if (_i_comp == _unset) {
69 } else {
71 }
72 }
73
74protected:
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// ===========================================================================
83template<class T, class M>
85public:
86
88
89// allocators:
90
92 : _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
93 _i_comp (sc.is_hierarchical() ? _unset : i_comp)
94 {}
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");
103 }
104
105// accessor:
106
107#ifdef TODO
108 space_component_const<T,M> operator[] (size_type i_comp) const {
110 return sub;
111 }
112#endif // TODO
113
114protected:
115 static const size_type _unset = std::numeric_limits<size_type>::max();
116// data:
119};
120// ========================================
121// inlined
122// ========================================
123template <class T, class M>
124inline
127{
128 space_component<T,M> Vi (_constit, i_comp);
129 return Vi;
130}
131template <class T, class M>
132inline
133space_component_const<T,M>
135{
136 return space_component_const<T,M> (_constit, i_comp);
137}
138
139} // namespace rheolef
140#endif // _RHEOLEF_SPACE_COMPONENT_H
field::size_type size_type
Definition branch.cc:430
the finite element boundary domain
space_component< T, M > operator[](size_type i_comp)
the finite element space
Definition space.h:382
const space_constitution< T, M > & _constit
space_component_const(const space_component< T, M > &x)
space_basic< T, M >::size_type size_type
space_component_const(const space_constitution< T, M > &sc, size_type i_comp)
static const size_type _unset
space_component(space_constitution< T, M > &sc, size_type i_comp)
void block(const domain_indirect_basic< M > &dom)
void block(std::string dom_name)
space_basic< T, M >::size_type size_type
space_component(const space_component< T, M > &x)
space_constitution< T, M > & _constit
space_component< T, M > operator[](size_type i_comp) const
static const size_type _unset
void do_act(const space_act &act)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.