rheolef  7.0
space_constitution.cc
Go to the documentation of this file.
1 
2 #include "rheolef/geo_domain.h"
3 #include "rheolef/space.h"
4 #include "rheolef/space_mult.h"
5 #include "rheolef/piola.h"
6 #include <sstream>
7 
8 namespace rheolef {
9 
10 template <class T, class M>
12  const geo_basic<T,M>& omega,
13  std::string approx,
14  std::string valued)
15  : _ownership(),
16  _start_by_component(),
17  _valued_tag(space_constant::scalar),
18  _is_hier(false),
19  _scalar_constit(),
20  _hier_constit()
21 {
22  if (valued == "scalar") {
23  _scalar_constit = scalar_type (omega, approx);
24  } else { // multi-valued:
25  _is_hier = true;
26  size_type d = omega.dimension();
28  size_type n_comp = space_constant::n_component (_valued_tag, d, omega.coordinate_system());
29  _hier_constit.resize(n_comp);
30  space_constitution<T,M> x (omega, approx, "scalar");
31  for (size_type i_comp = 0; i_comp < n_comp; i_comp++) {
32  _hier_constit [i_comp] = x;
33  }
34  }
35  initialize();
36 }
37 template <class T, class M>
39  : _ownership(),
41  _valued_tag(space_constant::mixed),
42  _is_hier(true),
44  _hier_constit(expr.size())
45 {
47  for (typename space_mult_list<T,M>::const_iterator iter = expr.begin(), last = expr.end(); iter != last; ++iter, ++iter_constit) {
48  const space_basic<T,M>& Xi = *iter;
49  *iter_constit = Xi.get_constitution();
50  }
51  initialize();
52 }
53 template <class T, class M>
54 void
56 {
59 }
60 template <class T, class M>
61 bool
63 {
64  if (_is_hier != V2._is_hier) return false;
65  if (!_is_hier) return (_scalar_constit == V2._scalar_constit);
66  if (_hier_constit.size() != V2._hier_constit.size()) return false;
67  for (const_iterator iter1 = _hier_constit.begin(), iter2 = V2._hier_constit.begin(), last1 = _hier_constit.end(); iter1 != last1; ++iter1, ++iter2) {
68  if (! (*iter1).data().operator==((*iter2).data())) { // recursive call
69  return false;
70  }
71  }
72  return true;
73 }
74 template <class T, class M>
77 {
78  if (! is_initialized()) { return communicator(); }
79  return get_geo().comm();
80 }
81 template <class T, class M>
84 {
85  if (!_is_hier) {
86  return _scalar_constit.get_geo().comm();
87  }
88  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
89  const space_constitution<T,M>& constit = *iter;
90  return constit.data().internal_comm(); // recursive call
91  }
92  return communicator();
93 }
94 template <class T, class M>
97 {
98  if (! is_initialized()) { return 0; }
99  return get_numbering().ndof (get_geo().sizes(), get_geo().map_dimension());
100 }
101 template <class T, class M>
104 {
105  if (!_is_hier) {
107  }
108  size_type ndof = 0;
109  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
110  const space_constitution<T,M>& constit = *iter;
111  ndof += constit.data().internal_ndof(); // recursive call
112  }
113  return ndof;
114 }
115 template <class T, class M>
118 {
119  if (! is_initialized()) { return 0; }
120  return get_numbering().dis_ndof (get_geo().sizes(), get_geo().map_dimension());
121 }
122 template <class T, class M>
125 {
126  if (!_is_hier) {
128  }
129  size_type dis_ndof = 0;
130  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
131  const space_constitution<T,M>& constit = *iter;
132  dis_ndof += constit.data().internal_dis_ndof(); // recursive call
133  }
134  return dis_ndof;
135 }
136 template<class T, class M>
137 std::ostream&
138 put (std::ostream& os, const space_constitution<T,M>& constit, size_t level = 0)
139 {
141  if (! constit.is_hierarchical()) {
142  const space_scalar_constitution<T,M>& scalar_constit = constit.get_scalar();
143  if (!scalar_constit.data().is_initialized()) return os; // no numbering available: TODO: scalar_constit.is_initialized()
144  os << scalar_constit.get_numbering().name() << "(" << scalar_constit.get_geo().name() << ")";
145  return os;
146  }
147  if (constit.valued_tag() == space_constant::vector ||
148  constit.valued_tag() == space_constant::tensor ||
150  assert_macro (constit.get_hierarchy().size() >= 1, "invalid space_constitution");
151  const space_constitution<T,M>& base_constit = *(constit.get_hierarchy().begin());
152  std::string spec = space_constant::valued_name (constit.valued_tag());
153  os << spec << "(";
154  put (os, base_constit, level+1);
155  os << ")";
156  return os;
157  }
158  if (level > 0) os << "(";
160  for (size_type i = 0, n = constit.get_hierarchy().size(); i < n; i++) {
161  const space_constitution<T,M>& xi = x[i];
162  put (os, xi, level+1); // recursive call
163  if (i+1 < n) { os << "*"; }
164  }
165  if (level > 0) os << ")";
166  return os;
167 }
168 template<class T, class M>
169 std::ostream&
170 operator<< (std::ostream& os, const space_constitution<T,M>& constit)
171 {
172  return put (os, constit);
173 }
174 template<class T, class M>
175 std::string
177 {
178  std::ostringstream ostrstr;
179  ostrstr << *this;
180  return ostrstr.str ();
181 }
182 template <class T, class M>
183 void
185 {
186  check_macro (!get_numbering().has_compact_support_inside_element(),
187  "try to [un]block domain `" << act.get_domain_name() << "' on discontinuous or bubble space("
188  << get_numbering().name()<<"(" <<_omega.name()<<"))");
189  _acts.push_back (act);
190 }
191 template <class T, class M>
192 void
194 {
196  if (! is_hierarchical()) {
197  space_scalar_constitution<T,M>& scalar_constit = get_scalar();
198  scalar_constit.do_act (act);
199  return;
200  }
201  for (iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
202  space_constitution<T,M>& constit = *iter;
203  constit.do_act (act); // recursive call
204  }
205 }
206 template <class T, class M>
207 void
209  disarray<size_type,M>& blocked_flag, // disarray<bool,M> not supported
210  const distributor& comp_ownership,
211  const distributor& start_by_component) const
212 {
213  check_macro (get_numbering().name() != "", "space with undefined finite element method cannot be used");
214  std::vector<size_type> comp_dis_idof_t;
215  distributor dof_ownership = blocked_flag.ownership();
216  size_type dis_ndof = dof_ownership.dis_size();
217  bool prev_act = space_act::block;
218  for (const_iterator iter = begin(), last = end(); iter != last; iter++) {
219  typename space_act::act_type act = (*iter).get_act();
220  const std::string& dom_name = (*iter).get_domain_name();
221  if (prev_act != act) {
222  blocked_flag.dis_entry_assembly();
223  prev_act = act;
224  }
225  const domain_indirect_basic<M>& dom = _omega.get_domain_indirect(dom_name);
226  size_type dom_dim = dom.map_dimension();
227  distributor ige_ownership = _omega.geo_element_ownership (dom_dim);
228  size_type first_dis_ige = ige_ownership.first_index();
229  size_type last_dis_ige = ige_ownership.last_index();
230  bool blk = (act == space_act::block) ? true : false;
231  for (size_type ioige = 0, noige = dom.size(); ioige < noige; ioige++) {
232  size_type ige = dom.oige (ioige).index();
233  size_type dis_ige = ige + first_dis_ige;
234  const geo_element& S = _omega.get_geo_element (dom_dim, ige);
235  get_numbering().dis_idof (_omega.sizes(), S, comp_dis_idof_t);
236  for (size_type loc_idof = 0, loc_ndof = comp_dis_idof_t.size(); loc_idof < loc_ndof; loc_idof++) {
237  size_type comp_dis_idof = comp_dis_idof_t [loc_idof];
238  size_type iproc = comp_ownership.find_owner (comp_dis_idof);
239  size_type first_comp_dis_idof = comp_ownership.first_index (iproc);
240  assert_macro (comp_dis_idof >= first_comp_dis_idof, "unexpected comp_dis_idof");
241  size_type comp_idof = comp_dis_idof - first_comp_dis_idof;
242  size_type comp_start_idof = start_by_component.size(iproc);
243  size_type idof = comp_start_idof + comp_idof;
244  size_type first_dis_idof = dof_ownership.first_index(iproc);
245  size_type dis_idof = first_dis_idof + idof;
246  assert_macro (dis_idof < dis_ndof, "unexpected dis_idof");
247  blocked_flag.dis_entry (dis_idof) = blk;
248  }
249  }
250  }
251 }
252 template <class T, class M>
253 void
255  disarray<size_type,M>& blocked_flag, // disarray<bool,M> not supported
256  const std::vector<distributor>& start_by_component,
257  size_type& i_comp) const
258 {
259  if (! is_hierarchical()) {
260  const space_scalar_constitution<T,M>& scalar_constit = get_scalar();
261  scalar_constit.data().build_blocked_flag (blocked_flag, ownership(), start_by_component [i_comp]);
262  i_comp++;
263  return;
264  }
265  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
266  const space_constitution<T,M>& constit = *iter;
267  constit.data().build_blocked_flag_recursive (blocked_flag, start_by_component, i_comp); // recursive call
268  }
269 }
270 template <class T, class M>
273 {
274  disarray<size_type,M> blocked_flag (ownership(), 0); // disarray<bool,M> not supported
275  size_type i_comp = 0;
276  build_blocked_flag_recursive (blocked_flag, _start_by_component, i_comp);
277  blocked_flag.dis_entry_assembly();
278  return blocked_flag;
279 }
280 template <class T, class M>
281 const geo_basic<T,M>&
283 {
284  if (! is_hierarchical()) {
285  return get_scalar().get_geo();
286  }
290  "get_geo: undefined for heterogeneous space products");
291  assert_macro (_hier_constit.size() > 0, "get_geo: empty vectorial/tensorial space product");
292  const_iterator iter = _hier_constit.begin();
293  const space_constitution<T,M>& constit = (*iter);
294  return constit.get_scalar().get_geo();
295 }
296 template <class T, class M>
297 const numbering<T,M>&
299 {
300  if (! is_hierarchical()) {
301  return get_scalar().get_numbering();
302  }
306  "get_numbering: undefined for heterogeneous space products");
307  assert_macro (_hier_constit.size() > 0, "get_numbering: empty vectorial/tensorial space product");
308  const_iterator iter = _hier_constit.begin();
309  const space_constitution<T,M>& constit = (*iter);
310  return constit.get_scalar().get_numbering();
311 }
312 template <class T, class M>
315 {
316  if (!_is_hier) {
319  distributor ios_ownership (dis_ndof, comm, distributor::decide);
320  return ios_ownership.size();
321  }
322  size_type ios_ndof = 0;
323  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
324  const space_constitution<T,M>& constit = *iter;
325  ios_ndof += constit.ios_ndof(); // recursive call
326  }
327  return ios_ndof;
328 }
329 template <class T, class M>
330 void
332  disarray<size_type,M>& idof2ios_dis_idof,
333  size_type& comp_start_idof,
334  size_type& comp_start_dis_idof) const
335 {
336  if (!_is_hier) {
337  disarray<size_type,M> comp_idof2ios_dis_idof;
338  disarray<size_type,M> comp_ios_idof2dis_idof;
339  _scalar_constit.get_numbering().set_ios_permutations (_scalar_constit.get_geo(), comp_idof2ios_dis_idof, comp_ios_idof2dis_idof);
340  size_type comp_ndof = comp_idof2ios_dis_idof.size();
341  size_type comp_dis_ndof = comp_idof2ios_dis_idof.dis_size();
342  size_type ndof = idof2ios_dis_idof.size();
343  size_type dis_ndof = idof2ios_dis_idof.dis_size();
344  for (size_type comp_idof = 0; comp_idof < comp_ndof; comp_idof++) {
345  size_type comp_ios_dis_idof = comp_idof2ios_dis_idof [comp_idof];
346  size_type ios_dis_idof = comp_start_dis_idof + comp_ios_dis_idof;
347  size_type idof = comp_start_idof + comp_idof;
348  assert_macro (idof < ndof, "unexpected idof="<<idof<<" out of range [0:"<<ndof<<"[");
349  assert_macro (ios_dis_idof < dis_ndof, "unexpected ios_dis_idof="<<ios_dis_idof<<" out of range [0:"<<dis_ndof<<"[");
350  idof2ios_dis_idof [idof] = ios_dis_idof;
351  }
352  comp_start_idof += comp_ndof;
353  comp_start_dis_idof += comp_dis_ndof;
354  return;
355  }
356  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
357  const space_constitution<T,M>& constit = *iter;
358  constit.set_ios_permutation_recursion (idof2ios_dis_idof, comp_start_idof, comp_start_dis_idof); // recursive call
359  }
360 }
361 template <class T, class M>
362 void
364  disarray<size_type,M>& idof2ios_dis_idof,
365  disarray<size_type,M>& ios_idof2dis_idof) const
366 {
367  if (!_is_hier) {
368  _scalar_constit.get_numbering().set_ios_permutations (_scalar_constit.get_geo(), idof2ios_dis_idof, ios_idof2dis_idof);
369  return;
370  }
371  communicator comm1 = comm();
372  distributor dof_ownership = ownership();
373  size_type ndof1 = dof_ownership.size();
374  size_type dis_ndof1 = dof_ownership.dis_size();
375  idof2ios_dis_idof.resize (dof_ownership, std::numeric_limits<size_type>::max());
376  size_type comp_start_idof = 0;
377  size_type comp_start_dis_idof = 0;
378  set_ios_permutation_recursion (idof2ios_dis_idof, comp_start_idof, comp_start_dis_idof);
379  size_type ios_ndof1 = ios_ndof();
380  distributor ios_dof_ownership (dis_ndof1, idof2ios_dis_idof.comm(), ios_ndof1);
381  ios_idof2dis_idof.resize (ios_dof_ownership, std::numeric_limits<size_type>::max());
382  idof2ios_dis_idof.reverse_permutation (ios_idof2dis_idof);
383 }
384 template <class T, class M>
387 {
388  switch (valued_tag()) {
389  case space_constant::scalar: {
390  return get_numbering().get_basis().size (hat_K);
391  }
395  size_type loc_comp_ndof = get_numbering().get_basis().size (hat_K);
396  size_type n_comp = size();
397  return n_comp*loc_comp_ndof;
398  }
399  default: {
400  fatal_macro ("dis_idof: hybrid multi-component: not yet");
401  return 0; // not reached
402  }
403  }
404 }
405 template <class T, class M>
406 void
407 space_constitution_rep<T,M>::dis_idof (const geo_element& K, std::vector<size_type>& dis_idof_t) const
408 {
409  size_type n_comp = size();
410  switch (valued_tag()) {
411  case space_constant::scalar: {
412  get_numbering().dis_idof (get_geo().sizes(), K, dis_idof_t);
413  return;
414  }
418  assert_macro (_hier_constit.size() > 0, "unexpected empty vector valued");
419  distributor comp_ownership = _hier_constit [0].ownership();
420  size_type comp_dis_ndof = get_numbering().dis_ndof (get_geo().sizes(), get_geo().map_dimension());
421  std::vector<size_type> comp_dis_idof_t;
422  get_numbering().dis_idof (get_geo().sizes(), K, comp_dis_idof_t);
423  size_type loc_ndof = comp_dis_idof_t.size();
424  dis_idof_t.resize (n_comp*loc_ndof);
425  for (size_type loc_idof = 0; loc_idof < loc_ndof; loc_idof++) {
426  size_type comp_dis_idof = comp_dis_idof_t [loc_idof];
427  size_type iproc = comp_ownership.find_owner (comp_dis_idof);
428  size_type comp_first_dis_idof = comp_ownership.first_index(iproc);
429  assert_macro (comp_dis_idof >= comp_first_dis_idof, "unexpected comp_dis_idof");
430  size_type comp_idof = comp_dis_idof - comp_first_dis_idof;
431  size_type first_dis_idof = ownership().first_index(iproc);
432  for (size_type i_comp = 0; i_comp < n_comp; i_comp++) {
433  size_type comp_start_idof = _start_by_component [i_comp].size(iproc);
434  size_type idof = comp_start_idof + comp_idof;
435  size_type dis_idof = first_dis_idof + idof;
436  dis_idof_t [i_comp*loc_ndof + loc_idof] = dis_idof;
437  }
438  }
439  return;
440  }
441  default: {
442  fatal_macro ("dis_idof: hybrid multi-component: not yet");
443  }
444  }
445 }
446 // => build _start_by_component : used by set_external_dof()
447 template <class T, class M>
450 {
451  if (!_is_hier) {
452  return 1;
453  }
454  size_type n_comp = 0;
455  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
456  n_comp += (*iter).data().n_component_recursive(); // recursive call
457  }
458  return n_comp;
459 }
460 template <class T, class M>
461 void
463  std::vector<distributor>& start_by_component,
464  size_type& i_comp,
465  const communicator& comm,
466  size_type& comp_start_idof,
467  size_type& comp_start_dis_idof) const
468 {
469  if (!_is_hier) {
470  start_by_component [i_comp] = distributor (comp_start_dis_idof, comm, comp_start_idof);
471  i_comp++;
472  comp_start_idof += ndof();
473  comp_start_dis_idof += dis_ndof();
474  return;
475  }
476  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
477  (*iter).data().init_start_by_component (start_by_component, i_comp, comm,
478  comp_start_idof, comp_start_dis_idof);
479  }
480 }
481 template <class T, class M>
482 void
484 {
485  size_type n_comp_rec = n_component_recursive();
486  _start_by_component.resize (n_comp_rec);
487  size_type i_comp = 0;
488  size_type comp_start_idof = 0;
489  size_type comp_start_dis_idof = 0;
490  init_start_by_component (_start_by_component, i_comp, comm(), comp_start_idof, comp_start_dis_idof);
491 }
492 // get external idofs: used by space<distributed>::freeze
493 template <class T, class M>
494 void
496  const geo_basic<T,M>& dom,
497  std::set<size_type>& ext_dof_set,
498  const distributor& dof_ownership,
499  const distributor& start_by_component) const
500 {
501  distributor comp_ownership = ownership();
502  size_type comp_dis_ndof = comp_ownership.dis_size();
503  std::vector<size_type> comp_dis_idof1;
504  for (size_type ie = 0, ne = dom.size(); ie < ne; ie++) {
505  const geo_element& K = dom [ie];
506  dis_idof (K, comp_dis_idof1);
507  for (size_type loc_idof = 0, loc_ndof = comp_dis_idof1.size(); loc_idof < loc_ndof; loc_idof++) {
508  size_type comp_dis_idof = comp_dis_idof1 [loc_idof];
509  assert_macro (comp_dis_idof < comp_dis_ndof, "idof " << comp_dis_idof1 [loc_idof] << " out of range[0:"<< comp_dis_ndof << "[");
510  if (! comp_ownership.is_owned (comp_dis_idof)) {
511  size_type iproc = comp_ownership.find_owner (comp_dis_idof);
512  size_type comp_first_dis_idof = comp_ownership.first_index(iproc);
513  assert_macro (comp_dis_idof >= comp_first_dis_idof, "unexpected comp_dis_idof");
514  size_type comp_idof = comp_dis_idof - comp_first_dis_idof;
515  size_type comp_start_idof = start_by_component.size(iproc);
516  size_type idof = comp_start_idof + comp_idof;
517  size_type first_dis_idof = dof_ownership.first_index(iproc);
518  size_type dis_idof = first_dis_idof + idof;
519  assert_macro (! dof_ownership.is_owned (dis_idof), "unexpected dis_idof="<<dis_idof<<" in range ["
520  << first_dis_idof << ":" << dof_ownership.last_index() << "[");
521  ext_dof_set.insert (dis_idof);
522  }
523  }
524  }
525 }
526 template <class T, class M>
527 void
529  const geo_basic<T,M>& dom,
530  std::set<size_type>& ext_dof_set,
531  const distributor& dof_ownership,
532  const distributor& start_by_component) const
533 {
534  size_type dim = dom.dimension();
535  size_type map_dim = dom.map_dimension();
536  if (dim > map_dim) {
537  return;
538  }
539  if (dom.name() != dom.get_background_geo().name()) {
540  return;
541  }
542  dom.neighbour_guard(); // uses S.master(i), a neighbour connnectivity
543  if (map_dim == 0) return; // no sides
544  size_type sid_dim = map_dim-1;
545  distributor comp_ownership = ownership();
546  size_type comp_dis_ndof = comp_ownership.dis_size();
547  std::vector<size_type> comp_dis_idof1;
548  distributor elt_ownership = dom.sizes().ownership_by_dimension[map_dim];
549  distributor sid_ownership = dom.sizes().ownership_by_dimension[sid_dim];
550  size_type first_dis_is = sid_ownership.first_index();
551  disarray<size_type, M> is_marked_side (sid_ownership, 0); // boolean: 0,1
552  for (typename geo_basic<T,M>::const_iterator iter_K0 = dom.begin(map_dim),
553  last_K0 = dom.end(map_dim);
554  iter_K0 != last_K0; ++iter_K0) {
555  const geo_element& K0 = *iter_K0;
556  for (size_type is_loc = 0, ns_loc = K0.n_subgeo(sid_dim); is_loc < ns_loc; ++is_loc) {
557  size_type dis_is = (map_dim == 1) ? K0[is_loc] : ((map_dim == 2) ? K0.edge(is_loc) : K0.face(is_loc));
558  if (sid_ownership.is_owned (dis_is) && is_marked_side [dis_is - first_dis_is]) continue;
559  if (sid_ownership.is_owned (dis_is)) is_marked_side [dis_is - first_dis_is] = 1;
560  const geo_element& S = dom.dis_get_geo_element (sid_dim, dis_is);
561  size_type dis_ie = (S.master(0) != K0.dis_ie()) ? S.master(0) : S.master(1);
562  if (dis_ie == std::numeric_limits<size_type>::max()) continue; // S is on the boundary
563  if (elt_ownership.is_owned (dis_ie)) continue;
564  const geo_element& K = dom.dis_get_geo_element (map_dim, dis_ie);
565  dis_idof (K, comp_dis_idof1);
566  for (size_type loc_idof = 0, loc_ndof = comp_dis_idof1.size(); loc_idof < loc_ndof; loc_idof++) {
567  size_type comp_dis_idof = comp_dis_idof1 [loc_idof];
568  assert_macro (comp_dis_idof < comp_dis_ndof,
569  "idof " << comp_dis_idof1 [loc_idof] << " out of range[0:"<< comp_dis_ndof << "[");
570  if (! comp_ownership.is_owned (comp_dis_idof)) {
571  size_type iproc = comp_ownership.find_owner (comp_dis_idof);
572  size_type comp_first_dis_idof = comp_ownership.first_index(iproc);
573  assert_macro (comp_dis_idof >= comp_first_dis_idof, "unexpected comp_dis_idof");
574  size_type comp_idof = comp_dis_idof - comp_first_dis_idof;
575  size_type comp_start_idof = start_by_component.size(iproc);
576  size_type idof = comp_start_idof + comp_idof;
577  size_type first_dis_idof = dof_ownership.first_index(iproc);
578  size_type dis_idof = first_dis_idof + idof;
579  assert_macro (! dof_ownership.is_owned (dis_idof), "unexpected dis_idof="<<dis_idof<<" in range ["
580  << first_dis_idof << ":" << dof_ownership.last_index() << "[");
581  ext_dof_set.insert (dis_idof);
582  }
583  }
584  }
585  }
586 }
587 template <class T, class M>
588 void
590  std::set<size_type>& ext_dof_set,
591  const distributor& dof_ownership,
592  const std::vector<distributor>& start_by_component,
593  size_type& i_comp) const
594 {
595  if (! is_hierarchical()) {
596  const space_scalar_constitution<T,M>& scalar_constit = get_scalar();
597  if (! scalar_constit.get_numbering().has_compact_support_inside_element()) {
598  continuous_append_external_dof (scalar_constit.get_geo(), ext_dof_set, dof_ownership, start_by_component [i_comp]);
599  for (size_type idom = 0, ndom = scalar_constit.get_geo().n_domain(); idom < ndom; idom++) {
600  const geo_basic<T,M>& dom = scalar_constit.get_geo().get_domain (idom);
601  continuous_append_external_dof (dom, ext_dof_set, dof_ownership, start_by_component [i_comp]);
602  }
603  } else {
604  discontinuous_append_external_dof (scalar_constit.get_geo(), ext_dof_set, dof_ownership, start_by_component [i_comp]);
605  }
606  i_comp++;
607  return;
608  }
609  for (const_iterator iter = _hier_constit.begin(), last = _hier_constit.end(); iter != last; ++iter) {
610  (*iter).data().compute_external_dofs (ext_dof_set, dof_ownership, start_by_component, i_comp);
611  }
612 }
613 template <class T, class M>
614 void
616  std::set<size_type>& ext_dof_set) const
617 {
618  ext_dof_set.clear();
619  size_type i_comp = 0;
620  compute_external_dofs (ext_dof_set, ownership(), _start_by_component, i_comp);
621 }
625 template std::ostream& operator<< (std::ostream&, const space_constitution<Float,sequential>&);
626 
627 #ifdef _RHEOLEF_HAVE_MPI
631 template std::ostream& operator<< (std::ostream&, const space_constitution<Float,distributed>&);
632 #endif // _RHEOLEF_HAVE_MPI
633 
634 } // namespace rheolef
distributor - data distribution table
Definition: distributor.h:19
#define fatal_macro(message)
Definition: compiler.h:98
const_iterator begin() const
Definition: space_mult.h:43
std::vector< distributor > _start_by_component
const_iterator end() const
Definition: space_mult.h:44
const std::string & get_domain_name() const
space_scalar_constitution< T, M > scalar_type
rep::const_iterator const_iterator
Definition: space_mult.h:36
reference_element - reference element
numbering - global degree of freedom numbering
Definition: numbering.h:56
void set_ios_permutation_recursion(disarray< size_type, M > &idof2ios_dis_idof, size_type &comp_start_idof, size_type &comp_start_dis_idof) const
const space_scalar_constitution< T, M > & get_scalar() const
const valued_type & valued_tag() const
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
Definition: tiny_lu.h:106
container_type::const_iterator const_iterator
size_type dis_ie() const
void do_act(const space_act &act)
void set_ios_permutation_recursion(disarray< size_type, M > &idof2ios_dis_idof, size_type &comp_start_idof, size_type &comp_start_dis_idof) const
hierarchy_type::size_type size_type
irheostream, orheostream - large data streams
Definition: compiler.h:7
size_type loc_ndof(const reference_element &hat_K) const
const hierarchy_type & get_hierarchy() const
const numbering< T, M > & get_numbering() const
#define assert_macro(ok_condition, message)
Definition: compiler.h:121
void dis_idof(const geo_element &K, std::vector< size_type > &dis_idof) const
size_type first_index(size_type ip) const
global index range and local size owned by ip-th process
Definition: distributor.h:98
space – piecewise polynomial finite element space
Definition: space.h:229
bool operator==(const space_constitution_rep< T, M > &V2) const
void build_blocked_flag(disarray< size_type, M > &blocked_flag, const distributor &comp_ownership, const distributor &start_by_component) const
#define check_macro(ok_condition, message)
Definition: compiler.h:104
const std::string & valued_name(valued_type valued_tag)
size_t d
size_type size(size_type ip) const
Definition: distributor.h:110
size_type master(bool i) const
hierarchy_type::const_iterator const_iterator
void compute_external_dofs(std::set< size_type > &ext_dof_set) const
void discontinuous_append_external_dof(const geo_basic< T, M > &dom, std::set< size_type > &ext_dof_set, const distributor &dof_ownership, const distributor &start_by_component) const
const geo_basic< T, M > & get_geo() const
static const size_type decide
Definition: distributor.h:31
size_type find_owner(size_type dis_i) const
find iproc associated to a global index dis_i: CPU=log(nproc)
Definition: distributor.cc:69
domain_indirect - a named part of a finite element mesh
const distributor & ownership() const
valued_type valued_tag(const std::string &name)
disarray< size_type, M > build_blocked_flag() const
void continuous_append_external_dof(const geo_basic< T, M > &dom, std::set< size_type > &ext_dof_set, const distributor &dof_ownership, const distributor &start_by_component) const
size_type face(size_type i_face) const
void do_act(const space_act &act)
void build_blocked_flag_recursive(disarray< size_type, M > &blocked_flag, const std::vector< distributor > &start_by_component, size_type &i_comp) const
size_type edge(size_type i_edge) const
const valued_type & valued_tag() const
geo_element - element of a mesh
Expr1::memory_type M
Definition: vec_expr_v2.h:310
const numbering< T, M > & get_numbering() const
void do_act(const space_act &act)
bool is_owned(size_type dis_i, size_type ip) const
true when dis_i in [first_index(ip):last_index(ip)[
Definition: distributor.h:160
size_type n_subgeo(size_type subgeo_dim) const
size_type dis_size() const
global and local sizes
Definition: distributor.h:154
std::allocator< int >::size_type size_type
Definition: distributor.h:23
hierarchy_type::iterator iterator
size_type n_component(valued_type valued_tag, size_type d, coordinate_type sys_coord)
void set_ios_permutations(disarray< size_type, M > &idof2ios_dis_idof, disarray< size_type, M > &ios_idof2dis_idof) const
const geo_basic< T, M > & get_geo() const
const scalar_type & get_scalar() const
size_type last_index(size_type ip) const
Definition: distributor.h:104