25 #include "rheolef/geo.h"
36 template<
class T,
class M>
40 const geo_base_rep<T,M>& omega,
41 const disarray<index_set,M>& ball)
49 const geo_base_rep<T,sequential>& omega,
50 const disarray<index_set,sequential>& ball)
53 #ifdef _RHEOLEF_HAVE_MPI
58 const geo_base_rep<T,distributed>& omega,
59 const disarray<index_set,distributed>& ball)
64 const hack_array<geo_element_hack,distributed>&
vertex = omega._geo_element[0];
65 typedef typename hack_array<geo_element_hack,distributed>::scatter_map_type map_t;
66 const map_t& map_vertex =
vertex.get_dis_map_entries();
68 for (
typename map_t::const_iterator
69 iter = map_vertex.begin(),
70 last = map_vertex.end(); iter != last; ++iter) {
72 check_macro (dis_iv < dis_nv,
"dis_iv="<<dis_iv<<
" out of range [0:"<<dis_nv<<
"[");
75 ball.set_dis_indexes (ext_iv_set);
81 template<
class T,
class M>
85 if (is_broken())
return;
91 for (
const_iterator iter_S = begin(sid_dim), last_S = end(sid_dim); iter_S != last_S; ++iter_S) {
93 S.
set_master (0, std::numeric_limits<size_type>::max());
94 S.
set_master (1, std::numeric_limits<size_type>::max());
98 std::array<index_set, reference_element::max_variant> ext_isv_set;
102 for (
size_type loc_is = 0, loc_ns = K.
n_subgeo(sid_dim); loc_is < loc_ns; ++loc_is) {
104 if (is_ownership.
is_owned (dis_is))
continue;
107 size_type dis_isv = _gs.dis_ige2dis_igev_by_dimension (sid_dim, dis_is,
variant);
108 ext_isv_set [
variant] += dis_isv;
109 ext_is_set += dis_is;
118 _geo_element [
variant].append_dis_indexes (ext_isv_set [
variant]);
122 distributor vertex_ownership = sizes().ownership_by_dimension[0];
128 for (
size_type loc_inod = 0, loc_nnod = K.
size(); loc_inod < loc_nnod; loc_inod++) {
131 ball.dis_entry (dis_iv) += dis_ie_set;
134 ball.dis_entry_assembly();
136 add_ball_externals (*
this, ball);
141 std::array<index_set, reference_element::max_variant> ext_igev_set;
145 side_marked.set_dis_indexes (ext_is_set);
148 for (
size_type loc_is = 0, loc_ns = K.
n_subgeo(sid_dim); loc_is < loc_ns; ++loc_is) {
149 size_type dis_is = (sid_dim == 0) ? K[loc_is] : ((sid_dim == 1) ? K.
edge(loc_is) : K.
face(loc_is));
150 if (side_marked.dis_at (dis_is))
continue;
151 side_marked.dis_entry (dis_is) = 1;
152 const geo_element& S = dis_get_geo_element (sid_dim, dis_is);
153 size_type dis_iv0 = dis_inod2dis_iv (S[0]);
154 index_set ball_intersect = ball.dis_at (dis_iv0);
155 for (
size_type loc_iv = 1, loc_nv = S.
size(); loc_iv < loc_nv; loc_iv++) {
156 size_type dis_iv = dis_inod2dis_iv (S[loc_iv]);
159 switch (ball_intersect.size()) {
161 index_set::const_iterator iter = ball_intersect.begin();
164 S.
set_master (1, std::numeric_limits<size_type>::max());
168 index_set::const_iterator iter = ball_intersect.begin();
173 if (! ie_ownership.
is_owned (dis_ie1)) std::swap (dis_ie1, dis_ie2);
174 if (! ie_ownership.
is_owned (dis_ie2)) {
177 size_type dis_igev2 = _gs.dis_ige2dis_igev_by_dimension (
map_dim, dis_ie2, variant2);
178 ext_igev_set [variant2] += dis_igev2;
179 ext_ie_set += dis_ie2;
187 if (orient < 0) std::swap (dis_ie1, dis_ie2);
193 error_macro (
"neighbour: side #"<< ball_intersect.size()<<
" connectivity problem");
202 _geo_element [
variant].update_dis_entries();
210 _geo_element [
variant].append_dis_indexes (ext_igev_set [
variant]);
213 for (index_set::const_iterator iter = ext_ie_set.begin(), last = ext_ie_set.end(); iter != last; ++iter) {
216 for (
size_type loc_inod = 0, loc_nnod = K.
n_node(); loc_inod < loc_nnod; loc_inod++) {
223 _node.append_dis_indexes (ext_inod_set);
232 template<
class T,
class M>
236 check_macro (_have_neighbour,
"neighbour_guard() may be called globally before local neighbour()");
240 <<
" is out of range [0:" << size(
map_dim) <<
"[");
244 case 3: dis_isid = K1.
face (loc_isid);
break;
245 case 2: dis_isid = K1.
edge (loc_isid);
break;
253 default:
return std::numeric_limits<size_type>::max();
256 const geo_element& S = dis_get_geo_element (sid_dim, dis_isid);
262 if (dis_ie2 != dis_ie1)
return dis_ie2;
268 #define _RHEOLEF_instanciation(T,M) \
269 template void geo_base_rep<T,M>::init_neighbour() const; \
270 template geo_base_rep<T,M>::size_type \
271 geo_base_rep<T,M>::neighbour (size_type, size_type) const;
274 #ifdef _RHEOLEF_HAVE_MPI
field::size_type size_type
see the Float page for the full documentation
see the disarray page for the full documentation
see the distributor page for the full documentation
size_type first_index(size_type iproc) const
global index range and local size owned by ip-th process
bool is_owned(size_type dis_i, size_type iproc) const
true when dis_i in [first_index(iproc):last_index(iproc)[
base::size_type size_type
void init_neighbour() const
size_type neighbour(size_type ie, size_type loc_isid) const
base::const_iterator const_iterator
see the geo_element page for the full documentation
geo_element_indirect::orientation_type orientation_type
size_type edge(size_type i) const
size_type face(size_type i) const
orientation_type get_side_orientation(const geo_element &S) const
size_type master(bool i) const
size_type n_subgeo(size_type subgeo_dim) const
void set_master(bool i, size_type dis_ie) const
void inplace_intersection(const index_set &b)
static variant_type last_variant_by_dimension(size_type dim)
static variant_type first_variant_by_dimension(size_type dim)
const point vertex[n_vertex]
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
void dis_inod(const basis_basic< T > &b, const geo_size &gs, const geo_element &K, typename std::vector< size_type >::iterator dis_inod_tab)
This file is part of Rheolef.
_RHEOLEF_instanciation(Float) _RHEOLEF_instanciation_evaluate(Float