rheolef  6.6
geo_domain.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_GEO_DOMAIN_H
2 #define _RHEOLEF_GEO_DOMAIN_H
3 
4 #include "rheolef/geo.h"
5 #include "rheolef/geo_domain_indirect.h"
6 
7 namespace rheolef {
8 
25 template <class T, class M>
26 class geo_domain_rep : public geo_rep<T,M> {
27 public:
28  typedef geo_rep<T,M> base;
29  typedef typename base::size_type size_type;
30 
31 
35 
36 
37  size_type variant() const { return geo_abstract_base_rep<T>::geo_domain; }
38  const geo_element& bgd2dom_geo_element (const geo_element& bgd_K) const;
39  const geo_element& dom2bgd_geo_element (const geo_element& dom_K) const;
40 
41  size_type n_domain_indirect() const { return 0; }
42  const domain_indirect_basic<M>& get_domain_indirect (size_type i) const;
43  const domain_indirect_basic<M>& get_domain_indirect (const std::string& name) const;
44 
45 
46  const geo_basic<T,M>& get_background_geo() const { return _dom.get_background_geo(); }
48 
49  size_type bgd_ie2dom_ie (size_type bgd_ie) const {
50  typename std::map<size_type,size_type>::const_iterator iter = _bgd_ie2dom_ie.find (bgd_ie);
51  return (iter != _bgd_ie2dom_ie.end()) ? (*iter).second
53  }
54 protected:
56  std::map<size_type,size_type> _bgd_ie2dom_ie;
57 };
58 template <class T, class M>
59 inline
62 {
63  const domain_indirect_basic<M>& indirect = _dom.get_indirect ();
64  const geo_basic<T,M>& omega = _dom.get_background_geo ();
65  return geo_basic<T,M> (indirect, omega);
66 }
67 template <class T, class M>
68 inline
71 {
73 }
74 template <class T, class M>
75 inline
77 geo_domain_rep<T,M>::get_domain_indirect (const std::string& name) const
78 {
80 }
81 // geo_basic<T,M> complement
82 template <class T, class M>
84 compact (const geo_basic<T,M>& gamma)
85 {
86  if (gamma.variant() != geo_abstract_base_rep<T>::geo_domain_indirect) {
87  return gamma;
88  }
89  /* allocate a new geo_rep object */
90  const geo_domain_indirect_rep<T,M>* dom_ptr
91  = dynamic_cast<const geo_domain_indirect_rep<T,M>*>(gamma.operator->());
92  geo_domain_rep<T,M>* geo_ptr
93  = new_macro((geo_domain_rep<T,M>)(*dom_ptr));
94  geo_basic<T,M> new_gamma;
95  new_gamma.geo_basic<T,M>::base::operator= (geo_ptr);
96  return new_gamma;
97 }
98 #define _RHEOLEF_get_bgd_geo(M) \
99 template <class T> \
100 const geo_basic<T,M>& \
101 geo_basic<T,M>::get_background_geo() const \
102 { \
103  if (variant() == geo_abstract_base_rep<T>::geo_domain) { \
104  const geo_domain_rep<T,M>& dom \
105  = dynamic_cast<const geo_domain_rep<T,M>&>(base::data()); \
106  return dom.get_background_geo(); \
107  } \
108  if (variant() == geo_abstract_base_rep<T>::geo_domain_indirect) { \
109  const geo_domain_indirect_rep<T,M>& dom \
110  = dynamic_cast<const geo_domain_indirect_rep<T,M>&>(base::data()); \
111  return dom.get_background_geo(); \
112  } \
113  /* else classic geo: is its own background_geo */ \
114  return *this; \
115 }
116 #define _RHEOLEF_get_bgd_domain(M) \
117 template <class T> \
118 geo_basic<T,M> \
119 geo_basic<T,M>::get_background_domain() const \
120 { \
121  if (variant() == geo_abstract_base_rep<T>::geo_domain) { \
122  const geo_domain_rep<T,M>& dom \
123  = dynamic_cast<const geo_domain_rep<T,M>&>(base::data()); \
124  return dom.get_background_domain(); \
125  } \
126  if (variant() == geo_abstract_base_rep<T>::geo_domain_indirect) { \
127  return *this; \
128  } \
129  /* else classic geo: is its own background_geo */ \
130  return *this; \
131 }
132 
133 _RHEOLEF_get_bgd_geo(sequential)
134 _RHEOLEF_get_bgd_domain(sequential)
135 
136 #ifdef _RHEOLEF_HAVE_MPI
137 _RHEOLEF_get_bgd_geo(distributed)
138 _RHEOLEF_get_bgd_domain(distributed)
139 #endif // _RHEOLEF_HAVE_MPI
140 
141 #undef _RHEOLEF_get_bgd_geo
142 #undef _RHEOLEF_get_bgd_domain
143 
144 } // namespace rheolef
145 #endif // _RHEOLEF_GEO_DOMAIN_H
geo_domain_indirect_rep< T, M > _dom
Definition: geo_domain.h:55
#define new_macro(obj)
Definition: compiler.h:364
geo_basic< T, M > compact(const geo_basic< T, M > &gamma)
Definition: geo_domain.h:84
size_type n_domain_indirect() const
Definition: geo_domain.h:41
const domain_indirect_basic< M > & get_domain_indirect(size_type i) const
Definition: geo_domain.h:70
irheostream, orheostream - large data streams
Definition: compiler.h:7
geo_basic< T, M > get_background_domain() const
Definition: geo_domain.h:61
geo_domain - a named part of a finite element mesh that behaves as a mesh
Definition: geo_domain.h:26
const geo_basic< T, M > & get_background_geo() const
Definition: geo_domain.h:46
const geo_element & dom2bgd_geo_element(const geo_element &dom_K) const
Definition: geo_domain.cc:48
geo_abstract_rep< T, M > * clone() const
Definition: geo_domain.cc:16
std::map< size_type, size_type > _bgd_ie2dom_ie
Definition: geo_domain.h:56
domain_indirect - a named part of a finite element mesh
const geo_element & bgd2dom_geo_element(const geo_element &bgd_K) const
Definition: geo_domain.cc:35
geo_domain_rep(const geo_domain_rep< T, M > &)
Definition: geo_domain.cc:7
#define _RHEOLEF_get_bgd_domain(M)
Definition: geo_domain.h:116
size_type variant() const
Definition: geo_domain.h:37
base::size_type size_type
Definition: geo_domain.h:29
geo_rep< T, M > base
Definition: geo_domain.h:28
boost::proto::result_of::make_expr< boost::proto::tag::function, vec_domain, const vec_detail::max_, const int &, const vec< T, M > & >::type max(const int &x, const vec< T, M > &y)
geo_element - element of a mesh
size_type bgd_ie2dom_ie(size_type bgd_ie) const
Definition: geo_domain.h:49
#define _RHEOLEF_get_bgd_geo(M)
Definition: geo_domain.h:98
reference_element_H::size_type size_type