1 #include "rheolef/space_numbering.h"
22 #include "rheolef/geo.h"
23 #include "rheolef/rheostream.h"
24 namespace rheolef {
namespace space_numbering {
81 template <
class Callback>
85 const Callback& nxxx_on_subgeo,
88 typename std::vector<size_t>::iterator dis_ixxx_tab)
93 size_type n_comp = nxxx_on_subgeo.n_component();
95 for (
size_type subgeo_dim = 0; subgeo_dim <= K_map_dim; ++subgeo_dim) {
98 if (subgeo_dim == K_map_dim && subgeo_variant != hat_K.
variant())
continue;
101 if (loc_ngev == 0)
continue;
102 size_type loc_nxxx_on_subgeo = nxxx_on_subgeo (hat_S.variant());
103 size_type loc_comp_nxxx_on_subgeo = loc_nxxx_on_subgeo / n_comp;
105 if (loc_nxxx_on_subgeo == 0)
continue;
107 for (
size_type loc_ige = 0, loc_nge = hat_K.
n_subgeo (hat_S.dimension()); loc_ige < loc_nge; ++ loc_ige) {
109 if (hat_S2.
variant() != hat_S.variant())
continue;
114 if (hat_S.dimension() == 0) { dis_ige = gs.
dis_inod2dis_iv (dis_ige); }
120 prev_subgeo_variant < hat_S.variant();
121 prev_subgeo_variant++) {
124 * nxxx_on_subgeo (prev_subgeo_variant);
126 dis_ixxx_loc_start += dis_igev*nxxx_on_subgeo (hat_S.variant());
127 for (
size_type next_subgeo_variant = hat_S.variant()+1;
129 next_subgeo_variant++) {
132 * nxxx_on_subgeo (next_subgeo_variant);
135 size_type loc_ixxx_loc_start = first_loc_ixxx + loc_igev*loc_nxxx_on_subgeo;
136 for (
size_type loc_comp_ixxx_on_subgeo = 0; loc_comp_ixxx_on_subgeo < loc_comp_nxxx_on_subgeo; ++loc_comp_ixxx_on_subgeo) {
138 for (
size_type i_comp = 0; i_comp < n_comp; ++i_comp) {
139 size_type loc_ixxx = loc_ixxx_loc_start + loc_comp_ixxx_on_subgeo *n_comp + i_comp;
140 dis_ixxx_tab [loc_ixxx] = dis_ixxx_loc_start + loc_comp_ixxx_on_subgeo_fixed*n_comp + i_comp;
144 first_loc_ixxx += loc_ngev*loc_nxxx_on_subgeo;
154 struct nnod_callback {
155 nnod_callback (
const basis_basic<T>&
b,
size_t map_d)
156 : _b(
b), _map_d(map_d) {}
157 size_t operator() (
size_t variant)
const {
158 return _b.nnod_on_subgeo (_map_d,
variant); }
160 size_t degree()
const {
return _b.degree(); }
165 struct ndof_callback {
166 ndof_callback (
const basis_basic<T>&
b,
size_t map_d)
167 : _b(
b), _map_d(map_d) {}
168 size_t operator() (
size_t variant)
const {
169 return _b.ndof_on_subgeo (_map_d,
variant); }
171 size_t degree()
const {
return _b.degree(); }
181 typename std::vector<size_type>::iterator dis_inod_tab)
183 dis_ixxx (nnod_callback<T> (
b, gs.
map_dimension()), gs, K, dis_inod_tab);
191 typename std::vector<size_type>::iterator dis_idof_tab)
193 dis_ixxx (ndof_callback<T> (
b, gs.
map_dimension()), gs, K, dis_idof_tab);
201 std::vector<size_type>& dis_inod_tab)
203 dis_inod_tab.resize (
b.nnod (K.
variant()));
204 #ifdef _RHEOLEF_PARANO
205 std::fill (dis_inod_tab.begin(), dis_inod_tab.end(), std::numeric_limits<size_type>::max());
206 #endif // _RHEOLEF_PARANO
207 dis_inod (
b, gs, K, dis_inod_tab.begin());
215 std::vector<size_type>& dis_idof_tab)
217 dis_idof_tab.resize (
b.ndof (K.
variant()));
218 #ifdef _RHEOLEF_PARANO
219 std::fill (dis_idof_tab.begin(), dis_idof_tab.end(), std::numeric_limits<size_type>::max());
220 #endif // _RHEOLEF_PARANO
221 dis_idof (
b, gs, K, dis_idof_tab.begin());
223 #ifdef _RHEOLEF_HAVE_MPI
253 idof2ios_dis_idof.resize (dof_ownership);
265 for (
size_type loc_idof = 0; loc_idof < loc_ndof; loc_idof++, idof++) {
266 size_type ios_dis_idof = first_ios_dis_v + ios_dis_igev*loc_ndof + loc_idof;
267 idof2ios_dis_idof [idof] = ios_dis_idof;
284 ios_idof2dis_idof.resize (ios_dof_ownership, std::numeric_limits<size_type>::max());
285 idof2ios_dis_idof.reverse_permutation (ios_idof2dis_idof);
287 #endif // _RHEOLEF_HAVE_MPI
292 #define _RHEOLEF_instanciate(T) \
293 template size_type ndof ( \
294 const basis_basic<T>& b, \
295 const geo_size& gs, \
296 size_type map_dim); \
297 template size_type nnod ( \
298 const basis_basic<T>& b, \
299 const geo_size& gs, \
300 size_type map_dim); \
301 template size_type dis_ndof ( \
302 const basis_basic<T>& b, \
303 const geo_size& gs, \
304 size_type map_dim); \
305 template size_type dis_nnod ( \
306 const basis_basic<T>& b, \
307 const geo_size& gs, \
308 size_type map_dim); \
309 template void dis_idof ( \
310 const basis_basic<T>& b, \
311 const geo_size& gs, \
312 const geo_element& K, \
313 typename std::vector<size_type>::iterator dis_inod_tab); \
314 template void dis_inod ( \
315 const basis_basic<T>& b, \
316 const geo_size& gs, \
317 const geo_element& K, \
318 typename std::vector<size_type>::iterator dis_inod_tab); \
319 template void dis_idof ( \
320 const basis_basic<T>& b, \
321 const geo_size& gs, \
322 const geo_element& K, \
323 std::vector<size_type>& dis_inod_tab); \
324 template void dis_inod ( \
325 const basis_basic<T>& b, \
326 const geo_size& gs, \
327 const geo_element& K, \
328 std::vector<size_type>& dis_inod_tab); \
332 #ifdef _RHEOLEF_HAVE_MPI
333 #define _RHEOLEF_instanciate_distributed(T) \
334 template void generic_set_ios_permutation ( \
335 const basis_basic<T>& b, \
337 const geo_size& gs, \
338 const std::array<disarray<size_t,distributed>,reference_element::max_variant>& \
340 disarray<size_t,distributed>& idof2ios_dis_idof); \
341 template void set_ios_permutations ( \
342 const basis_basic<T>& b, \
343 const geo_basic<T,distributed>& omega, \
344 disarray<size_type,distributed>& idof2ios_dis_idof, \
345 disarray<size_type,distributed>& ios_idof2dis_idof); \
348 #endif // _RHEOLEF_HAVE_MPI