rheolef  6.5
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 
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; }
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 
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
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
146