21#include "rheolef/space_numbering.h"
22#include "rheolef/geo.h"
23#include "rheolef/rheostream.h"
81template <
class Callback>
85 const Callback& nxxx_on_subgeo,
88 typename std::vector<size_t>::iterator dis_ixxx_tab)
90 typedef size_t size_type;
93 size_type n_comp = nxxx_on_subgeo.n_component();
94 size_type first_loc_ixxx = 0;
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;
154struct 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); }
159 size_t n_component()
const {
return 1; }
160 size_t degree()
const {
return _b.degree(); }
165struct 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); }
170 size_t n_component()
const {
return _b.size(); }
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());
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());
221 dis_idof (b, gs, K, dis_idof_tab.begin());
223#ifdef _RHEOLEF_HAVE_MPI
247 variant < variant_last;
253 idof2ios_dis_idof.resize (dof_ownership);
260 variant < variant_last;
262 size_type loc_ndof = b.ndof_on_subgeo (map_d, variant);
264 size_type ios_dis_igev = igev2ios_dis_igev [variant] [igev];
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);
292#define _RHEOLEF_instanciate(T) \
293template size_type ndof ( \
294 const basis_basic<T>& b, \
295 const geo_size& gs, \
296 size_type map_dim); \
297template size_type nnod ( \
298 const basis_basic<T>& b, \
299 const geo_size& gs, \
300 size_type map_dim); \
301template size_type dis_ndof ( \
302 const basis_basic<T>& b, \
303 const geo_size& gs, \
304 size_type map_dim); \
305template size_type dis_nnod ( \
306 const basis_basic<T>& b, \
307 const geo_size& gs, \
308 size_type map_dim); \
309template 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); \
314template 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); \
319template 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); \
324template 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) \
334template 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); \
341template 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); \
field::size_type size_type
see the Float page for the full documentation
see the communicator page for the full documentation
see the disarray page for the full documentation
see the distributor page for the full documentation
size_type find_owner(size_type dis_i) const
find iproc associated to a global index dis_i: CPU=log(nproc)
size_type dis_size() const
global and local sizes
size_type size(size_type iproc) const
size_type first_index(size_type iproc) const
global index range and local size owned by ip-th process
static const size_type decide
const communicator_type & comm() const
generic mesh with rerefence counting
see the geo_element page for the full documentation
reference_element::size_type size_type
static size_type fix_indirect(const geo_element &K, size_type subgeo_variant, size_type loc_ige, size_type loc_comp_idof_on_subgeo, size_type order)
variant_type variant() const
size_type subgeo_dis_index(size_type subgeo_dim, size_type i) const
see the reference_element page for the full documentation
reference_element subgeo(size_type subgeo_dim, size_type loc_isid) const
static const variant_type max_variant
static variant_type last_variant_by_dimension(size_type dim)
size_type local_subgeo_index2index_by_variant(size_type subgeo_variant, size_type i) const
size_type dimension() const
static variant_type first_variant_by_dimension(size_type dim)
size_type n_subgeo_by_variant(size_type subgeo_variant) const
variant_type variant() const
size_type n_subgeo(size_type subgeo_dim) const
#define _RHEOLEF_instanciate(T)
void generic_set_ios_permutation(const basis_basic< T > &b, size_t map_d, const geo_size &gs, const std::array< disarray< size_t, distributed >, reference_element::max_variant > &igev2ios_dis_igev, disarray< size_t, distributed > &idof2ios_dis_idof)
void dis_idof(const basis_basic< T > &b, const geo_size &gs, const geo_element &K, typename std::vector< size_type >::iterator dis_idof_tab)
void set_ios_permutations(const basis_basic< T > &b, const geo_basic< T, distributed > &omega, disarray< size_type, distributed > &idof2ios_dis_idof, disarray< size_type, distributed > &ios_idof2dis_idof)
size_type nnod(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
size_type dis_nnod(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
size_type dis_ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
size_type ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
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)
geo_element::size_type size_type
This file is part of Rheolef.
#define _RHEOLEF_instanciate_distributed(T)
size_type dis_ige2dis_igev_by_variant(size_type variant, size_type dis_ige) const
distributor ownership_by_variant[reference_element::max_variant]
size_type map_dimension() const
size_type dis_inod2dis_iv(size_type dis_inod) const