Rheolef  7.1
an efficient C++ finite element environment
geo_domain.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_GEO_DOMAIN_H
2 #define _RHEOLEF_GEO_DOMAIN_H
3 
24 /*Class:domain
25 NAME: @code{geo_domain} - a named part of a finite element mesh that behaves as a mesh
26 @cindex mesh boundary
27 @clindex geo_domain
28 DESCRIPTION:
29  @noindent
30  The @code{geo_domain} class defines a container for a part of a
31  finite element mesh.
32  This class re-describes the vertices, edges or faces in
33  a compact way, i.e. by skipping unused elements from
34  the surrounding mesh.
35 IMPLEMENTATION NOTE:
36  The @code{geo_domain} class conserves the link to the original mesh
37  such that fields defined on a @code{geo_domain} can inter-operate with
38  fields defined on the surrounding mesh.
39 AUTHOR: Pierre.Saramito@imag.fr
40 DATE: 16 february 2011
41 End:
42 */
43 
44 #include "rheolef/geo.h"
45 #include "rheolef/geo_domain_indirect.h"
46 
47 namespace rheolef {
48 
49 // ========================================================================
50 // representation
51 // ========================================================================
52 template <class T, class M>
53 class geo_domain_rep : public geo_rep<T,M> {
54 public:
55 // typedefs:
56  typedef geo_rep<T,M> base;
57  typedef typename base::size_type size_type;
58 
59 // allocators:
60 
64 
65 // accessors: the geo_abstract interface overloaded here:
66 
68  bool is_broken() const { return _dom.is_broken(); }
69  const geo_element& bgd2dom_geo_element (const geo_element& bgd_K) const;
70  const geo_element& dom2bgd_geo_element (const geo_element& dom_K) const;
71 
72  size_type n_domain_indirect() const { return 0; }
73  const domain_indirect_basic<M>& get_domain_indirect (size_type i) const;
74  const domain_indirect_basic<M>& get_domain_indirect (const std::string& name) const;
75 
76 // extended accessors:
77 
78  const geo_basic<T,M>& get_background_geo() const { return _dom.get_background_geo(); }
80 
81  size_type bgd_ie2dom_ie (size_type bgd_ie) const;
82  size_type dis_bgd_ie2dis_dom_ie (size_type dis_bgd_ie) const;
83 
84 protected:
85 // data:
87  std::map<size_type,size_type> _bgd_ie2dom_ie,
89 };
90 // ------------------------------------------------------------------------
91 // inlined
92 // ------------------------------------------------------------------------
93 template <class T, class M>
94 inline
97 {
98  const domain_indirect_basic<M>& indirect = _dom.get_indirect ();
99  const geo_basic<T,M>& omega = _dom.get_background_geo ();
100  return geo_basic<T,M> (indirect, omega);
101 }
102 template <class T, class M>
103 inline
104 const domain_indirect_basic<M>&
106 {
108 }
109 template <class T, class M>
110 inline
111 const domain_indirect_basic<M>&
113 {
115 }
116 // ------------------------------------------------------------------------
117 // geo_basic<T,M> complement
118 // ------------------------------------------------------------------------
119 template <class T, class M>
121 compact (const geo_basic<T,M>& gamma);
122 
123 // only two specialized M=seq & dist have the member fct; thus, use a macro:
124 #define _RHEOLEF_get_bgd_geo(M) \
125 template <class T> \
126 inline \
127 const geo_basic<T,M>& \
128 geo_basic<T,M>::get_background_geo() const \
129 { \
130  if (variant() == geo_abstract_base_rep<T>::geo_domain) { \
131  const geo_domain_rep<T,M>& dom \
132  = dynamic_cast<const geo_domain_rep<T,M>&>(base::data()); \
133  return dom.get_background_geo(); \
134  } \
135  if (variant() == geo_abstract_base_rep<T>::geo_domain_indirect) { \
136  const geo_domain_indirect_rep<T,M>& dom \
137  = dynamic_cast<const geo_domain_indirect_rep<T,M>&>(base::data()); \
138  return dom.get_background_geo(); \
139  } \
140  /* else classic geo: is its own background_geo */ \
141  return *this; \
142 }
143 #define _RHEOLEF_get_bgd_domain(M) \
144 template <class T> \
145 inline \
146 geo_basic<T,M> \
147 geo_basic<T,M>::get_background_domain() const \
148 { \
149  if (variant() == geo_abstract_base_rep<T>::geo_domain) { \
150  const geo_domain_rep<T,M>& dom \
151  = dynamic_cast<const geo_domain_rep<T,M>&>(base::data()); \
152  return dom.get_background_domain(); \
153  } \
154  if (variant() == geo_abstract_base_rep<T>::geo_domain_indirect) { \
155  return *this; \
156  } \
157  /* else classic geo: is its own background_geo */ \
158  return *this; \
159 }
160 
161 _RHEOLEF_get_bgd_geo(sequential)
162 _RHEOLEF_get_bgd_domain(sequential)
163 
164 #ifdef _RHEOLEF_HAVE_MPI
165 _RHEOLEF_get_bgd_geo(distributed)
166 _RHEOLEF_get_bgd_domain(distributed)
167 #endif // _RHEOLEF_HAVE_MPI
168 
169 #undef _RHEOLEF_get_bgd_geo
170 #undef _RHEOLEF_get_bgd_domain
171 
172 } // namespace rheolef
173 #endif // _RHEOLEF_GEO_DOMAIN_H
rheolef::geo_domain_indirect_rep
Definition: geo.h:187
rheolef::geo_domain_rep::variant
size_type variant() const
Definition: geo_domain.h:67
rheolef::geo_domain_rep::_bgd_ie2dom_ie
std::map< size_type, size_type > _bgd_ie2dom_ie
Definition: geo_domain.h:87
rheolef::compact
geo_basic< T, M > compact(const geo_basic< T, M > &gamma)
Definition: geo.cc:219
rheolef::geo_domain_rep::size_type
base::size_type size_type
Definition: geo_domain.h:57
rheolef::geo_basic
generic mesh with rerefence counting
Definition: domain_indirect.h:64
rheolef::geo_domain_rep
Definition: geo_domain.h:53
rheolef::geo_domain_rep::base
geo_rep< T, M > base
Definition: geo_domain.h:56
rheolef::sequential
Definition: distributed.h:28
rheolef::geo_element
see the geo_element page for the full documentation
Definition: geo_element.h:102
rheolef::geo_rep
sequential mesh representation
Definition: domain_indirect.h:63
rheolef::geo_domain_rep::get_background_domain
geo_basic< T, M > get_background_domain() const
Definition: geo_domain.h:96
rk::gamma
Float gamma[][pmax+1]
Definition: runge_kutta_semiimplicit.icc:70
rheolef::geo_domain_rep::get_domain_indirect
const domain_indirect_basic< M > & get_domain_indirect(size_type i) const
Definition: geo_domain.h:105
rheolef::geo_abstract_base_rep
abstract base interface class
Definition: geo.h:248
rheolef::geo_domain_rep::_dis_bgd_ie2dis_dom_ie
std::map< size_type, size_type > _dis_bgd_ie2dis_dom_ie
Definition: geo_domain.h:87
rheolef::geo_domain_rep::geo_domain_rep
geo_domain_rep(const geo_domain_rep< T, M > &)
Definition: geo_domain.cc:30
rheolef::distributed
Definition: distributed.h:88
rheolef::geo_abstract_rep
abstract interface class
Definition: domain_indirect.h:62
rheolef::geo_domain_rep::bgd2dom_geo_element
const geo_element & bgd2dom_geo_element(const geo_element &bgd_K) const
Definition: geo_domain.cc:93
rheolef::geo_domain_rep::bgd_ie2dom_ie
size_type bgd_ie2dom_ie(size_type bgd_ie) const
Definition: geo_domain.cc:64
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::geo_domain_rep::_dom
geo_domain_indirect_rep< T, M > _dom
Definition: geo_domain.h:86
rheolef::geo_domain_rep::n_domain_indirect
size_type n_domain_indirect() const
Definition: geo_domain.h:72
rheolef::geo_domain_rep::get_background_geo
const geo_basic< T, M > & get_background_geo() const
Definition: geo_domain.h:78
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::geo_domain_rep::is_broken
bool is_broken() const
Definition: geo_domain.h:68
rheolef::domain_indirect_basic
the finite element boundary domain
Definition: domain_indirect.h:335
mkgeo_contraction.name
name
Definition: mkgeo_contraction.sh:133
rheolef::geo_domain_rep::dom2bgd_geo_element
const geo_element & dom2bgd_geo_element(const geo_element &dom_K) const
Definition: geo_domain.cc:112
rheolef::geo_domain_rep::clone
geo_abstract_rep< T, M > * clone() const
Definition: geo_domain.cc:40
rheolef::geo_domain_rep::dis_bgd_ie2dis_dom_ie
size_type dis_bgd_ie2dis_dom_ie(size_type dis_bgd_ie) const
Definition: geo_domain.cc:75