Loading...
Searching...
No Matches
space_component.h
Go to the documentation of this file.
#ifndef _RHEOLEF_SPACE_COMPONENT_H
#define _RHEOLEF_SPACE_COMPONENT_H
#include "rheolef/space.h"
namespace rheolef {
template<class T, class M>
class space_component {
public:
typedef typename space_basic<T,M>::size_type size_type;
// allocators:
space_component (space_constitution<T,M>& sc, size_type i_comp)
: _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
_i_comp (sc.is_hierarchical() ? _unset : i_comp)
{}
space_component (const space_component<T,M>& x)
: _constit(x._constit), _i_comp(x._i_comp) {}
// implicit conversion to space:
operator space_basic<T,M>() const {
check_macro (_i_comp == _unset, "space-component building from non-hierarchical basis: not yet supported");
return space_basic<T,M>(_constit);
}
// accessor:
space_component<T,M> operator[] (size_type i_comp) const {
space_component<T,M> sub (_constit, i_comp);
return sub;
}
// modifier:
void block (std::string dom_name) {
if (_i_comp == _unset) {
_constit.do_act (space_act(dom_name, space_act::block));
} else {
_constit.do_act (space_act(dom_name, _i_comp, space_act::block));
}
}
void block (const domain_indirect_basic<M>& dom) {
if (_i_comp == _unset) {
_constit.do_act (space_act(dom.name(), space_act::block));
} else {
_constit.do_act (space_act(dom.name(), _i_comp, space_act::block));
}
}
protected:
static const size_type _unset = std::numeric_limits<size_type>::max();
// data:
space_constitution<T,M>& _constit; // non-const reference: block() modify the _constit
size_type _i_comp; // used only when vector/tensor basis
};
// ===========================================================================
// const version
// ===========================================================================
template<class T, class M>
class space_component_const {
public:
typedef typename space_basic<T,M>::size_type size_type;
// allocators:
space_component_const (const space_constitution<T,M>& sc, size_type i_comp)
: _constit(sc.is_hierarchical() ? sc [i_comp] : sc),
_i_comp (sc.is_hierarchical() ? _unset : i_comp)
{}
space_component_const (const space_component<T,M>& x)
: _constit(x._constit), _i_comp(x._i_comp) {}
// implicit conversion to space:
operator space_basic<T,M>() const {
check_macro (_i_comp == _unset, "space-component building from non-hierarchical basis: not yet supported");
return space_basic<T,M>(_constit);
}
// accessor:
#ifdef TODO
space_component_const<T,M> operator[] (size_type i_comp) const {
space_component_const<T,M> sub (_constit [i_comp]);
return sub;
}
#endif // TODO
protected:
static const size_type _unset = std::numeric_limits<size_type>::max();
// data:
const space_constitution<T,M>& _constit;
size_type _i_comp;
};
// ========================================
// inlined
// ========================================
template <class T, class M>
inline
space_component<T,M>
space_base_rep<T,M>::operator[] (size_type i_comp)
{
space_component<T,M> Vi (_constit, i_comp);
return Vi;
}
template <class T, class M>
inline
space_component_const<T,M>
space_base_rep<T,M>::operator[] (size_type i_comp) const
{
return space_component_const<T,M> (_constit, i_comp);
}
} // namespace rheolef
#endif // _RHEOLEF_SPACE_COMPONENT_H
size_type
field::size_type size_type
Definition branch.cc:430
rheolef::domain_indirect_basic
the finite element boundary domain
Definition domain_indirect.h:335
rheolef::space_act
Definition space_constitution.h:38
rheolef::space_act::block
@ block
Definition space_constitution.h:47
rheolef::space_base_rep::operator[]
space_component< T, M > operator[](size_type i_comp)
rheolef::space_basic
the finite element space
Definition space.h:382
rheolef::space_component_const
Definition space_component.h:84
rheolef::space_component_const::_constit
const space_constitution< T, M > & _constit
Definition space_component.h:117
rheolef::space_component_const::space_component_const
space_component_const(const space_component< T, M > &x)
Definition space_component.h:95
rheolef::space_component_const::_i_comp
size_type _i_comp
Definition space_component.h:118
rheolef::space_component_const::size_type
space_basic< T, M >::size_type size_type
Definition space_component.h:87
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::space_component_const::_unset
static const size_type _unset
Definition space_component.h:115
rheolef::space_component
Definition space_component.h:29
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(const domain_indirect_basic< M > &dom)
Definition space_component.h:66
rheolef::space_component::block
void block(std::string dom_name)
Definition space_component.h:59
rheolef::space_component::_i_comp
size_type _i_comp
Definition space_component.h:78
rheolef::space_component::size_type
space_basic< T, M >::size_type size_type
Definition space_component.h:32
rheolef::space_component::space_component
space_component(const space_component< T, M > &x)
Definition space_component.h:40
rheolef::space_component::_constit
space_constitution< T, M > & _constit
Definition space_component.h:77
rheolef::space_component::operator[]
space_component< T, M > operator[](size_type i_comp) const
Definition space_component.h:52
rheolef::space_component::_unset
static const size_type _unset
Definition space_component.h:75
rheolef::space_constitution
Definition space_constitution.h:405
rheolef::space_constitution::do_act
void do_act(const space_act &act)
Definition space_constitution.h:448
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
This file is part of Rheolef.
Definition compiler_eigen.h:39