Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
geo_domain.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_GEO_DOMAIN_H
2#define _RHEOLEF_GEO_DOMAIN_H
23
24/*Class:domain
25NAME: @code{geo_domain} - a named part of a finite element mesh that behaves as a mesh
26@cindex mesh boundary
27@clindex geo_domain
28DESCRIPTION:
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.
35IMPLEMENTATION 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.
39AUTHOR: Pierre.Saramito@imag.fr
40DATE: 16 february 2011
41End:
42*/
43
44#include "rheolef/geo.h"
45#include "rheolef/geo_domain_indirect.h"
46
47namespace rheolef {
48
49// ========================================================================
50// representation
51// ========================================================================
52template <class T, class M>
53class geo_domain_rep : public geo_rep<T,M> {
54public:
55// typedefs:
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
84protected:
85// data:
87 std::map<size_type,size_type> _bgd_ie2dom_ie,
89};
90// ------------------------------------------------------------------------
91// inlined
92// ------------------------------------------------------------------------
93template <class T, class M>
94inline
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}
102template <class T, class M>
103inline
104const domain_indirect_basic<M>&
109template <class T, class M>
110inline
111const domain_indirect_basic<M>&
112geo_domain_rep<T,M>::get_domain_indirect (const std::string& name) const
113{
115}
116// ------------------------------------------------------------------------
117// geo_basic<T,M> complement
118// ------------------------------------------------------------------------
119template <class T, class M>
121compact (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) \
125template <class T> \
126inline \
127const geo_basic<T,M>& \
128geo_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) \
144template <class T> \
145inline \
146geo_basic<T,M> \
147geo_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
field::size_type size_type
Definition branch.cc:430
the finite element boundary domain
abstract base interface class
Definition geo.h:248
abstract interface class
Definition geo.h:401
generic mesh with rerefence counting
Definition geo.h:1089
const geo_basic< T, M > & get_background_geo() const
Definition geo_domain.h:78
const geo_element & dom2bgd_geo_element(const geo_element &dom_K) const
const domain_indirect_basic< M > & get_domain_indirect(size_type i) const
Definition geo_domain.h:105
size_type bgd_ie2dom_ie(size_type bgd_ie) const
Definition geo_domain.cc:64
geo_domain_indirect_rep< T, M > _dom
Definition geo_domain.h:86
std::map< size_type, size_type > _bgd_ie2dom_ie
Definition geo_domain.h:87
base::size_type size_type
Definition geo_domain.h:57
geo_abstract_rep< T, M > * clone() const
Definition geo_domain.cc:40
size_type dis_bgd_ie2dis_dom_ie(size_type dis_bgd_ie) const
Definition geo_domain.cc:75
size_type n_domain_indirect() const
Definition geo_domain.h:72
size_type variant() const
Definition geo_domain.h:67
bool is_broken() const
Definition geo_domain.h:68
std::map< size_type, size_type > _dis_bgd_ie2dis_dom_ie
Definition geo_domain.h:88
geo_basic< T, M > get_background_domain() const
Definition geo_domain.h:96
const geo_element & bgd2dom_geo_element(const geo_element &bgd_K) const
Definition geo_domain.cc:93
geo_rep< T, M > base
Definition geo_domain.h:56
see the geo_element page for the full documentation
sequential mesh representation
Definition geo.h:778
This file is part of Rheolef.
geo_basic< T, M > compact(const geo_basic< T, M > &gamma)
Definition geo.cc:219