Rheolef  7.2
an efficient C++ finite element environment
space.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_SPACE_H
2 #define _RHEOLEF_SPACE_H
3 //
4 // This file is part of Rheolef.
5 //
6 // Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7 //
8 // Rheolef is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // Rheolef is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Rheolef; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //
22 // =========================================================================
23 // AUTHORS: Pierre.Saramito@imag.fr
24 // DATE: 14 december 2010
25 
26 namespace rheolef {
101 } // namespace rheolef
102 
103 #include "rheolef/geo.h"
104 #include "rheolef/geo_domain.h"
105 #include "rheolef/space_constitution.h"
106 
107 namespace rheolef {
108 
109 // forward declarations:
110 template <class T, class M> class field_basic;
111 template <class T, class M> class space_mult_list;
112 template <class T, class M> class space_component;
113 template <class T, class M> class space_component_const;
114 
115 // =====================================================================
116 // a dof = a degree-of-freedom
117 // = space_pair
118 // = pair (bool is_blocked ; size_t dis_iub)
119 // =====================================================================
120 // TODO: compact the bool as an extra bit in size_type ?
123  space_pair_type () : _blk(false), _dis_iub (std::numeric_limits<size_type>::max()) {}
125  bool is_blocked() const { return _blk; }
126  size_type dis_iub() const { return _dis_iub; }
128  void set_blocked (bool blk) { _blk = blk; }
129  friend std::ostream& operator<< (std::ostream& os, const space_pair_type& x) {
130  return os << "{" << x.is_blocked() << "," << x.dis_iub() << "}"; }
131  template<class Archive>
132  void serialize (Archive& ar, const unsigned int version) { ar & _blk; ar & _dis_iub; }
133 protected:
134  bool _blk;
136 };
137 
138 } // namespace rheolef
139 
140 #ifdef _RHEOLEF_HAVE_MPI
141 // =====================================================================
142 // Some serializable types, like geo_element, have a fixed amount of data stored at fixed field positions.
143 // When this is the case, boost::mpi can optimize their serialization and transmission to avoid extraneous
144 // copy operations.
145 // To enable this optimization, we specialize the type trait is_mpi_datatype, e.g.:
146 namespace boost {
147  namespace mpi {
148  template <> struct is_mpi_datatype<rheolef::space_pair_type> : mpl::true_ { };
149  } // namespace mpi
150 } // namespace boost
151 #endif // _RHEOLEF_HAVE_MPI
152 
153 namespace rheolef {
154 
155 // =====================================================================
156 // 1) representation: space_base_rep and space_rep
157 // =====================================================================
158 template <class T, class M>
160 public:
161 
162 // typedefs:
163 
166 
167 // allocators:
168 
171  const geo_basic<T,M>& omega,
172  std::string approx,
173  std::string prod_valued);
175  const geo_basic<T,M>& omega,
176  const basis_basic<T>& b);
179  virtual ~space_base_rep () {}
180 
181 // accessors:
182 
183  const distributor& ownership() const { return _idof2blk_dis_iub.ownership(); }
184  size_type ndof() const { return ownership().size(); }
185  size_type dis_ndof() const { return ownership().dis_size(); }
186  const communicator& comm() const { return ownership().comm(); }
187 
189  const geo_basic<T,M>& get_geo() const { return _constit.get_geo(); }
190  const basis_basic<T>& get_basis() const { return _constit.get_basis(); }
192  const std::string& valued() const { return _constit.valued(); }
193  size_type size() const { return _constit.size(); }
196 
197  std::string name() const;
198 
201 
204 
205  bool is_blocked (size_type idof) const { freeze_check(); return _idof2blk_dis_iub [idof].is_blocked(); }
206  size_type dis_iub (size_type idof) const { freeze_check(); return _idof2blk_dis_iub [idof].dis_iub(); }
207  const point_basic<T>& xdof (size_type idof) const { return _xdof [idof]; }
208  const disarray<point_basic<T>,M >& get_xdofs() const { return _xdof; }
209 
210  const distributor& iu_ownership() const { freeze_guard(); return _iu_ownership; }
211  const distributor& ib_ownership() const { freeze_guard(); return _ib_ownership; }
212 
213  void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
214 
215  // TODO: merge all V.xxx_momentum: the return type can be computed from Function::result_type
216  template <class Function>
217  T momentum (const Function& f, size_type idof) const { return f (xdof(idof)); }
218 
219  template <class Function>
220  point_basic<T> vector_momentum (const Function& f, size_type idof) const { return f (xdof(idof)); }
221 
222  template <class Function>
223  tensor_basic<T> tensor_momentum (const Function& f, size_type idof) const { return f (xdof(idof)); }
224 
226  const space_base_rep<T,M>& Wh, const std::string& dom_name) const;
227 
229  const space_base_rep<T,M>& Wh, const geo_basic<T,M>& bgd_gamma) const;
230 
231 // comparator:
232 
233  bool operator== (const space_base_rep<T,M>& V2) const {
234  return _constit.operator==(V2._constit); } // TODO: compare also blocked/unknown sizes:
235 
236  friend bool are_compatible (const space_base_rep<T,M>& V1, const space_base_rep<T,M>& V2) {
237  return V1._constit.operator==(V2._constit); }
238 
239 // for lazy (un-assembled) on geo_domains:
240 
242  check_macro (_parent_subgeo_owner_initialized, "parent_subgeo_owner_guard() should be called before local accessors");
243  }
246  template <class Set>
247  void get_parent_subgeo_owner_dis_indexes (Set& ext_dis_idofs) const;
248 
249 protected:
250  template <class T1, class M1> friend class field_basic;
251 // internal:
252  void init_xdof();
253  void freeze_guard() const {
254  if (_have_freezed) return;
255  _have_freezed = true;
256  freeze_body();
257  }
258  void freeze_check() const {
259  check_macro (_have_freezed, "space should be freezed before calling local accessors");
260  }
261  void no_freeze_check() const {
262  check_macro (!_have_freezed, "freezed space cannot accept new (un)blocked domains");
263  }
264  void base_freeze_body() const;
265  virtual void freeze_body() const { return base_freeze_body(); }
266 // data: lazy initialization (on demand only), thus most are mutable
268  disarray<point_basic<T>,M > _xdof; // nodal approx only
269  mutable bool _have_freezed;
270  mutable disarray<space_pair_type,M> _idof2blk_dis_iub; // pair (is_blocked ; dis_iu_or_ib); use ownership
271  mutable disarray<int,M> _has_nt_basis; // whether block_n or block_t : for piola ; use ownership
272  mutable disarray<point_basic<T>,M> _normal; // when block_{nt} ; use ownership
273  mutable distributor _iu_ownership; // unknown values distribution
274  mutable distributor _ib_ownership; // blocked values distribution
278 };
279 template <class T, class M>
280 template <class Set>
281 void
283 {
284  parent_subgeo_owner_guard();
285  if (! _parent_subgeo_owner_reattribution_required) {
286  ext_dis_idofs = Set();
287  return;
288  }
289  _parent_subgeo_owner.get_dis_indexes (ext_dis_idofs);
290 }
291 // ---------------------------------------------------------------------
292 // space_rep
293 // ---------------------------------------------------------------------
294 template <class T, class M> class space_rep {};
295 
296 template <class T>
297 class space_rep<T,sequential> : public space_base_rep<T,sequential> {
298 public:
299 
300 // typedefs:
301 
303  typedef typename base::size_type size_type;
304 
305 // allocators:
306 
307  space_rep ( const geo_basic<T,sequential>& omega,
308  std::string approx,
309  std::string prod_valued);
310  space_rep ( const geo_basic<T,sequential>& omega,
311  const basis_basic<T>& b);
315 
316 // for compatibility with the distributed interface:
317 
318  bool dis_is_blocked (size_type dis_idof) const { return base::is_blocked(dis_idof); }
319  size_type dis_idof2dis_iub (size_type dis_idof) const { return base::dis_iub (dis_idof); }
320 
321  const distributor& ios_ownership() const { return base::ownership(); }
322  size_type idof2ios_dis_idof (size_type idof) const { return idof; }
323  size_type ios_idof2dis_idof (size_type ios_idof) const { return ios_idof; }
324 
325  // for compatibility with the distributed case:
326  const std::set<size_type>& ext_iu_set() const;
327  const std::set<size_type>& ext_ib_set() const;
328 };
329 // ---------------------------------------------------------------------
330 #ifdef _RHEOLEF_HAVE_MPI
331 template <class T>
332 class space_rep<T,distributed> : public space_base_rep<T,distributed> {
333 public:
334 
335 // typedefs:
336 
338  typedef typename base::size_type size_type;
339 
340 // allocators:
341 
342  space_rep ( const geo_basic<T,distributed>& omega,
343  std::string approx,
344  std::string prod_valued);
345  space_rep ( const geo_basic<T,distributed>& omega,
346  const basis_basic<T>& b);
350 
351 // accessors:
352 
353  const communicator& comm() const { return base::comm(); }
354 
355  bool dis_is_blocked (size_type dis_idof) const;
356  size_type dis_idof2dis_iub (size_type dis_idof) const;
357 
358  const distributor& ios_ownership() const { return _ios_idof2dis_idof.ownership(); }
359  size_type idof2ios_dis_idof (size_type idof) const { base::freeze_guard(); return _idof2ios_dis_idof [idof]; }
360  size_type ios_idof2dis_idof (size_type ios_idof) const { base::freeze_guard(); return _ios_idof2dis_idof [ios_idof]; }
361  const std::set<size_type>& ext_iu_set() const { return _ext_iu_set; }
362  const std::set<size_type>& ext_ib_set() const { return _ext_ib_set; }
363 
364 protected:
365  template <class T1, class M1> friend class field_basic;
366 // internal procedures:
367  void freeze_body() const;
368  void append_external_dof (const geo_basic<T,distributed>& dom, std::set<size_type>& ext_dof_set) const;
369 // data:
370  disarray<size_type,distributed> _idof2ios_dis_idof; // permut to/from ios dof numbering (before geo part), for i/o
372 // mutable data, affected by freeze_*()const:
373  mutable std::set<size_type> _ext_iu_set; // external dofs used by field::dis_dof
374  mutable std::set<size_type> _ext_ib_set;
375 };
376 #endif // _RHEOLEF_HAVE_MPI
377 // ====================================================================
378 // 2) wrapper class: seq & mpi specializations
379 // ====================================================================
381 template <class T, class M = rheo_default_memory_model>
382 class space_basic {
383 public:
384 };
385 // [verbatim_space]
387 // [verbatim_space]
388 // ---------------------------------------------------------------------
389 // [verbatim_space_basic]
390 template <class T>
391 class space_basic<T,sequential> : public smart_pointer<space_rep<T,sequential> > {
392 public:
393 
394 // typedefs:
395 
398  typedef typename rep::size_type size_type;
399  typedef typename rep::valued_type valued_type;
400 
401 // allocators:
402 
404  std::string approx = "",
405  std::string prod_valued = "scalar");
406  space_basic (const geo_basic<T,sequential>& omega,
407  const basis_basic<T>& b);
411 
412 // accessors:
413 
414  void block (std::string dom_name);
415  void unblock(std::string dom_name);
416  void block (const domain_indirect_basic<sequential>& dom);
417  void unblock(const domain_indirect_basic<sequential>& dom);
418 
419  void block_n (std::string dom_name);
420  void unblock_n(std::string dom_name);
421  void block_n (const domain_indirect_basic<sequential>& dom);
422  void unblock_n(const domain_indirect_basic<sequential>& dom);
423 
424  const distributor& ownership() const;
425  const communicator& comm() const;
426  size_type ndof() const;
427  size_type dis_ndof() const;
428 
429  const geo_basic<T,sequential>& get_geo() const;
430  const basis_basic<T>& get_basis() const;
431  size_type size() const;
432  valued_type valued_tag() const;
433  const std::string& valued() const;
434  space_component<T,sequential> operator[] (size_type i_comp);
435  space_component_const<T,sequential> operator[] (size_type i_comp) const;
436  const space_constitution<T,sequential>& get_constitution() const;
437  size_type degree() const;
438  std::string get_approx() const;
439  std::string name() const;
440 
441  void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
442 
443  const distributor& iu_ownership() const;
444  const distributor& ib_ownership() const;
445 
446  bool is_blocked (size_type idof) const;
447  size_type dis_iub (size_type idof) const;
448  bool dis_is_blocked (size_type dis_idof) const;
449  size_type dis_idof2dis_iub (size_type dis_idof) const;
450 
451  const distributor& ios_ownership() const;
452  size_type idof2ios_dis_idof (size_type idof) const;
453  size_type ios_idof2dis_idof (size_type ios_idof) const;
454 
455  const point_basic<T>& xdof (size_type idof) const;
456  const disarray<point_basic<T>,sequential>& get_xdofs() const;
457 
458  template <class Function>
459  T momentum (const Function& f, size_type idof) const;
460 
461  template <class Function>
462  point_basic<T> vector_momentum (const Function& f, size_type idof) const;
463 
464  template <class Function>
465  tensor_basic<T> tensor_momentum (const Function& f, size_type idof) const;
466 
468  const space_basic<T,sequential>& Wh, const std::string& dom_name) const;
469 
471  const space_basic<T,sequential>& Wh, const geo_basic<T,sequential>& bgd_gamma) const;
472 
473  const std::set<size_type>& ext_iu_set() const { return base::data().ext_iu_set(); }
474  const std::set<size_type>& ext_ib_set() const { return base::data().ext_ib_set(); }
475 
476 // comparator:
477 
478  bool operator== (const space_basic<T,sequential>& V2) const { return base::data().operator==(V2.data()); }
479  bool operator!= (const space_basic<T,sequential>& V2) const { return ! operator== (V2); }
481  return are_compatible (V1.data(), V2.data()); }
482 
483 // for lazy (un-assembled) on geo_domains:
484 
485  template <class Set>
486  void get_parent_subgeo_owner_dis_indexes (Set& ext_dis_idofs) const
487  { base::data().get_parent_subgeo_owner_dis_indexes (ext_dis_idofs); }
489  { return base::data().get_parent_subgeo_owner (dis_idof); }
490 };
491 // [verbatim_space_basic]
492 template<class T>
493 inline
495  const geo_basic<T,sequential>& omega,
496  std::string approx,
497  std::string prod_valued)
498  : base (new_macro(rep(omega, approx, prod_valued)))
499 {
500 }
501 template<class T>
502 inline
504  const geo_basic<T,sequential>& omega,
505  const basis_basic<T>& b)
506  : base (new_macro(rep(omega, b)))
507 {
508 }
509 template<class T>
510 inline
512  const space_constitution<T,sequential>& constit)
513  : base (new_macro(rep(constit)))
514 {
515 }
516 template<class T>
517 inline
519  : base (new_macro(rep(expr)))
520 {
521 }
522 template<class T>
523 inline
524 const distributor&
526 {
527  return base::data().ownership();
528 }
529 template<class T>
530 inline
531 const distributor&
533 {
534  return base::data().ios_ownership();
535 }
536 template<class T>
537 inline
538 const communicator&
540 {
541  return base::data().comm();
542 }
543 template<class T>
544 inline
547 {
548  return base::data().ndof();
549 }
550 template<class T>
551 inline
554 {
555  return base::data().dis_ndof();
556 }
557 template<class T>
558 inline
561 {
562  return base::data().get_geo();
563 }
564 template<class T>
565 inline
566 const basis_basic<T>&
568 {
569  return base::data().get_basis();
570 }
571 template<class T>
572 inline
575 {
576  return base::data().get_constitution();
577 }
578 template<class T>
579 inline
582 {
583  return base::data().size();
584 }
585 template<class T>
586 inline
587 const std::string&
589 {
590  return base::data().valued();
591 }
592 template<class T>
593 inline
596 {
597  return base::data().valued_tag();
598 }
599 template<class T>
600 inline
603 {
604  return base::data().operator[] (i_comp);
605 }
606 template<class T>
607 inline
610 {
611  return base::data().operator[] (i_comp);
612 }
613 template<class T>
614 inline
617 {
618  return get_basis().degree();
619 }
620 template<class T>
621 inline
622 std::string
624 {
625  return get_basis().name();
626 }
627 template<class T>
628 inline
629 std::string
631 {
632  return base::data().name();
633 }
634 template<class T>
635 inline
636 void
637 space_basic<T,sequential>::dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const
638 {
639  return base::data().dis_idof (K, dis_idof);
640 }
641 template<class T>
642 inline
645 {
646  return base::data().idof2ios_dis_idof (idof);
647 }
648 template<class T>
649 inline
652 {
653  return base::data().ios_idof2dis_idof (ios_idof);
654 }
655 template<class T>
656 inline
657 const distributor&
659 {
660  return base::data().iu_ownership();
661 }
662 template<class T>
663 inline
664 const distributor&
666 {
667  return base::data().ib_ownership();
668 }
669 template<class T>
670 inline
671 bool
673 {
674  return base::data().is_blocked (idof);
675 }
676 template<class T>
677 inline
680 {
681  return base::data().dis_iub (idof);
682 }
683 template<class T>
684 inline
685 bool
687 {
688  return base::data().dis_is_blocked (dis_idof);
689 }
690 template<class T>
691 inline
694 {
695  return base::data().dis_idof2dis_iub (dis_idof);
696 }
697 template<class T>
698 inline
699 void
700 space_basic<T,sequential>::block (std::string dom_name)
701 {
702  return base::data().block (get_geo().get_domain_indirect(dom_name));
703 }
704 template<class T>
705 inline
706 void
708 {
709  return base::data().unblock (get_geo().get_domain_indirect(dom_name));
710 }
711 template<class T>
712 inline
713 void
715 {
716  return base::data().block (dom);
717 }
718 template<class T>
719 inline
720 void
722 {
723  return base::data().unblock (dom);
724 }
725 template<class T>
726 inline
727 void
729 {
730  return base::data().block_n (get_geo().get_domain_indirect(dom_name));
731 }
732 template<class T>
733 inline
734 void
736 {
737  return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
738 }
739 template<class T>
740 inline
741 void
743 {
744  return base::data().block_n (dom);
745 }
746 template<class T>
747 inline
748 void
750 {
751  return base::data().unblock_n (dom);
752 }
753 template<class T>
754 inline
755 const point_basic<T>&
757 {
758  return base::data().xdof (idof);
759 }
760 template<class T>
761 inline
764 {
765  return base::data().get_xdofs();
766 }
767 template<class T>
768 template <class Function>
769 inline
770 T
772 {
773  return base::data().momentum (f, idof);
774 }
775 template<class T>
776 template <class Function>
777 inline
780 {
781  return base::data().vector_momentum (f, idof);
782 }
783 template<class T>
784 template <class Function>
787 {
788  return base::data().tensor_momentum (f, idof);
789 }
790 
791 // ---------------------------------------------------------------------
792 #ifdef _RHEOLEF_HAVE_MPI
793 //<verbatim:
794 template <class T>
795 class space_basic<T,distributed> : public smart_pointer<space_rep<T,distributed> > {
796 public:
797 
798 // typedefs:
799 
802  typedef typename rep::size_type size_type;
803  typedef typename rep::valued_type valued_type;
804 
805 // allocators:
806 
808  std::string approx = "",
809  std::string prod_valued = "scalar");
811  const basis_basic<T>& b);
815 
816 // accessors:
817 
818  void block (std::string dom_name);
819  void unblock(std::string dom_name);
820  void block (const domain_indirect_basic<distributed>& dom);
821  void unblock(const domain_indirect_basic<distributed>& dom);
822 
823  void block_n (std::string dom_name);
824  void unblock_n(std::string dom_name);
825  void block_n (const domain_indirect_basic<distributed>& dom);
826  void unblock_n(const domain_indirect_basic<distributed>& dom);
827 
828  const distributor& ownership() const;
829  const communicator& comm() const;
830  size_type ndof() const;
831  size_type dis_ndof() const;
832 
833  const geo_basic<T,distributed>& get_geo() const;
834  const basis_basic<T>& get_basis() const;
835  size_type size() const;
836  valued_type valued_tag() const;
837  const std::string& valued() const;
838  space_component<T,distributed> operator[] (size_type i_comp);
839  space_component_const<T,distributed> operator[] (size_type i_comp) const;
840  const space_constitution<T,distributed>& get_constitution() const;
841  size_type degree() const;
842  std::string get_approx() const;
843  std::string name() const;
844 
845  void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
846 
847  const distributor& iu_ownership() const;
848  const distributor& ib_ownership() const;
849 
850  bool is_blocked (size_type idof) const;
851  size_type dis_iub (size_type idof) const;
852 
853  bool dis_is_blocked (size_type dis_idof) const;
854  size_type dis_idof2dis_iub (size_type dis_idof) const;
855 
856  const distributor& ios_ownership() const;
857  size_type idof2ios_dis_idof (size_type idof) const;
858  size_type ios_idof2dis_idof (size_type ios_idof) const;
859 
860  const point_basic<T>& xdof (size_type idof) const;
861  const disarray<point_basic<T>,distributed>& get_xdofs() const;
862 
863  template <class Function>
864  T momentum (const Function& f, size_type idof) const;
865 
866  template <class Function>
867  point_basic<T> vector_momentum (const Function& f, size_type idof) const;
868 
869  template <class Function>
870  tensor_basic<T> tensor_momentum (const Function& f, size_type idof) const;
871 
873  const space_basic<T,distributed>& Wh, const std::string& dom_name) const;
874 
876  const space_basic<T,distributed>& Wh, const geo_basic<T,distributed>& bgd_gamma) const;
877 
878  const std::set<size_type>& ext_iu_set() const { return base::data().ext_iu_set(); }
879  const std::set<size_type>& ext_ib_set() const { return base::data().ext_ib_set(); }
880 
881 // comparator:
882 
883  bool operator== (const space_basic<T,distributed>& V2) const { return base::data().operator==(V2.data()); }
884  bool operator!= (const space_basic<T,distributed>& V2) const { return ! operator== (V2); }
886  return are_compatible (V1.data(), V2.data()); }
887 
888 // for lazy (un-assembled) on geo_domains:
889 
890  template <class Set>
891  void get_parent_subgeo_owner_dis_indexes (Set& ext_dis_idofs) const
892  { base::data().get_parent_subgeo_owner_dis_indexes (ext_dis_idofs); }
894  { return base::data().get_parent_subgeo_owner (dis_idof); }
895 };
896 //>verbatim:
897 
898 template<class T>
899 inline
901  const geo_basic<T,distributed>& omega,
902  std::string approx,
903  std::string prod_valued)
904  : base (new_macro(rep(omega, approx, prod_valued)))
905 {
906 }
907 template<class T>
908 inline
910  const geo_basic<T,distributed>& omega,
911  const basis_basic<T>& b)
912  : base (new_macro(rep(omega, b)))
913 {
914 }
915 template<class T>
916 inline
918  const space_constitution<T,distributed>& constit)
919  : base (new_macro(rep(constit)))
920 {
921 }
922 template<class T>
923 inline
925  : base (new_macro(rep(expr)))
926 {
927 }
928 template<class T>
929 inline
930 const distributor&
932 {
933  return base::data().ownership();
934 }
935 template<class T>
936 inline
937 const distributor&
939 {
940  return base::data().ios_ownership();
941 }
942 template<class T>
943 inline
944 const communicator&
946 {
947  return base::data().comm();
948 }
949 template<class T>
950 inline
953 {
954  return base::data().ndof();
955 }
956 template<class T>
957 inline
960 {
961  return base::data().dis_ndof();
962 }
963 template<class T>
964 inline
967 {
968  return base::data().get_geo();
969 }
970 template<class T>
971 inline
972 const basis_basic<T>&
974 {
975  return base::data().get_basis();
976 }
977 template<class T>
978 inline
981 {
982  return base::data().get_constitution();
983 }
984 template<class T>
985 inline
988 {
989  return base::data().size();
990 }
991 template<class T>
992 inline
993 const std::string&
995 {
996  return base::data().valued();
997 }
998 template<class T>
999 inline
1002 {
1003  return base::data().valued_tag();
1004 }
1005 template<class T>
1006 inline
1009 {
1010  return base::data().operator[] (i_comp);
1011 }
1012 template<class T>
1013 inline
1016 {
1017  return base::data().operator[] (i_comp);
1018 }
1019 template<class T>
1020 inline
1023 {
1024  return get_basis().degree();
1025 }
1026 template<class T>
1027 inline
1028 std::string
1030 {
1031  return get_basis().name();
1032 }
1033 template<class T>
1034 inline
1035 std::string
1037 {
1038  return base::data().name();
1039 }
1040 template<class T>
1041 inline
1042 void
1043 space_basic<T,distributed>::dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const
1044 {
1045  return base::data().dis_idof (K, dis_idof);
1046 }
1047 template<class T>
1048 inline
1051 {
1052  return base::data().idof2ios_dis_idof (idof);
1053 }
1054 template<class T>
1055 inline
1058 {
1059  return base::data().ios_idof2dis_idof (ios_idof);
1060 }
1061 template<class T>
1062 inline
1063 const distributor&
1065 {
1066  return base::data().iu_ownership();
1067 }
1068 template<class T>
1069 inline
1070 const distributor&
1072 {
1073  return base::data().ib_ownership();
1074 }
1075 template<class T>
1076 inline
1077 bool
1079 {
1080  return base::data().is_blocked (idof);
1081 }
1082 template<class T>
1083 inline
1086 {
1087  return base::data().dis_iub (idof);
1088 }
1089 template<class T>
1090 inline
1091 bool
1093 {
1094  return base::data().dis_is_blocked (dis_idof);
1095 }
1096 template<class T>
1097 inline
1100 {
1101  return base::data().dis_idof2dis_iub (dis_idof);
1102 }
1103 template<class T>
1104 inline
1105 void
1107 {
1108  return base::data().block (get_geo().get_domain_indirect(dom_name));
1109 }
1110 template<class T>
1111 inline
1112 void
1114 {
1115  return base::data().unblock (get_geo().get_domain_indirect(dom_name));
1116 }
1117 template<class T>
1118 inline
1119 void
1121 {
1122  base::data().block (dom);
1123 }
1124 template<class T>
1125 inline
1126 void
1128 {
1129  base::data().unblock (dom);
1130 }
1131 template<class T>
1132 inline
1133 void
1135 {
1136  return base::data().block_n (get_geo().get_domain_indirect(dom_name));
1137 }
1138 template<class T>
1139 inline
1140 void
1142 {
1143  return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
1144 }
1145 template<class T>
1146 inline
1147 void
1149 {
1150  base::data().block_n (dom);
1151 }
1152 template<class T>
1153 inline
1154 void
1156 {
1157  base::data().unblock_n (dom);
1158 }
1159 template<class T>
1160 inline
1161 const point_basic<T>&
1163 {
1164  return base::data().xdof (idof);
1165 }
1166 template<class T>
1167 inline
1170 {
1171  return base::data().get_xdofs();
1172 }
1173 template<class T>
1174 template <class Function>
1175 inline
1176 T
1178 {
1179  return base::data().momentum (f, idof);
1180 }
1181 template<class T>
1182 template <class Function>
1183 inline
1186 {
1187  return base::data().vector_momentum (f, idof);
1188 }
1189 template<class T>
1190 template <class Function>
1193 {
1194  return base::data().tensor_momentum (f, idof);
1195 }
1196 #endif // _RHEOLEF_HAVE_MPI
1197 
1198 // only valid when M=sequential or M=distributed => use a macro
1199 #define _RHEOLEF_space_build_dom_dis_idof2bgd_dis_idof(M) \
1200 template<class T> \
1201 inline \
1202 disarray<typename space_basic<T,M>::size_type, M> \
1203 space_basic<T,M>::build_dom_dis_idof2bgd_dis_idof ( \
1204  const space_basic<T,M>& Wh, \
1205  const std::string& dom_name) const \
1206 { \
1207  return base::data().build_dom_dis_idof2bgd_dis_idof (Wh.data(), dom_name); \
1208 } \
1209 template<class T> \
1210 inline \
1211 disarray<typename space_basic<T,M>::size_type, M> \
1212 space_basic<T,M>::build_dom_dis_idof2bgd_dis_idof ( \
1213  const space_basic<T,M>& Wh, \
1214  const geo_basic<T,M>& bgd_gamma) const \
1215 { \
1216  return base::data().build_dom_dis_idof2bgd_dis_idof (Wh.data(), bgd_gamma); \
1217 }
1219 
1220 #ifdef _RHEOLEF_HAVE_MPI
1222 #endif // _RHEOLEF_HAVE_MPI
1223 
1224 #undef _RHEOLEF_space_build_dom_dis_idof2bgd_dis_idof
1225 
1226 } // namespace rheolef
1227 #endif // _RHEOLEF_SPACE_H
field::size_type size_type
Definition: branch.cc:430
see the disarray page for the full documentation
Definition: disarray.h:497
see the distributor page for the full documentation
Definition: distributor.h:69
size_type dis_size() const
global and local sizes
Definition: distributor.h:214
size_type size(size_type iproc) const
Definition: distributor.h:170
const communicator_type & comm() const
Definition: distributor.h:152
distributed mesh with rerefence counting
Definition: geo.h:1367
see the geo_element page for the full documentation
Definition: geo_element.h:102
see the smart_pointer page for the full documentation
space_base_rep(const space_mult_list< T, M > &)
space_base_rep(const space_constitution< T, M > &constit)
disarray< point_basic< T >, M > _normal
Definition: space.h:272
void dis_idof(const geo_element &K, std::vector< size_type > &dis_idof) const
friend bool are_compatible(const space_base_rep< T, M > &V1, const space_base_rep< T, M > &V2)
Definition: space.h:236
void base_freeze_body() const
std::string name() const
disarray< size_type, M > build_dom_dis_idof2bgd_dis_idof(const space_base_rep< T, M > &Wh, const geo_basic< T, M > &bgd_gamma) const
size_type dis_ndof() const
Definition: space.h:185
size_type dis_iub(size_type idof) const
Definition: space.h:206
space_constitution< T, M > _constit
Definition: space.h:267
bool _parent_subgeo_owner_reattribution_required
Definition: space.h:276
valued_type valued_tag() const
Definition: space.h:191
void block(const domain_indirect_basic< M > &dom)
e.g. "P1(square)", for field_expr<Expr> checks
Definition: space.h:199
virtual ~space_base_rep()
Definition: space.h:179
bool _parent_subgeo_owner_initialized
Definition: space.h:275
const geo_basic< T, M > & get_geo() const
Definition: space.h:189
const disarray< point_basic< T >, M > & get_xdofs() const
Definition: space.h:208
const point_basic< T > & xdof(size_type idof) const
Definition: space.h:207
void get_parent_subgeo_owner_dis_indexes(Set &ext_dis_idofs) const
disarray< point_basic< T >, M > _xdof
Definition: space.h:268
size_type size() const
Definition: space.h:193
space_base_rep(const geo_basic< T, M > &omega, const basis_basic< T > &b)
disarray< size_type, M > _parent_subgeo_owner
Definition: space.h:277
void unblock_n(const domain_indirect_basic< M > &dom)
Definition: space.h:203
space_component< T, M > operator[](size_type i_comp)
const std::string & valued() const
Definition: space.h:192
space_constant::valued_type valued_type
Definition: space.h:165
size_type get_parent_subgeo_owner(size_type dis_idof) const
distributor _iu_ownership
Definition: space.h:273
disarray< int, M > _has_nt_basis
Definition: space.h:271
virtual void freeze_body() const
Definition: space.h:265
const distributor & ownership() const
Definition: space.h:183
space_pair_type::size_type size_type
Definition: space.h:164
T momentum(const Function &f, size_type idof) const
Definition: space.h:217
space_base_rep(const geo_basic< T, M > &omega, std::string approx, std::string prod_valued)
bool parent_subgeo_owner_guard() const
bool is_blocked(size_type idof) const
Definition: space.h:205
void block_n(const domain_indirect_basic< M > &dom)
Definition: space.h:202
disarray< size_type, M > build_dom_dis_idof2bgd_dis_idof(const space_base_rep< T, M > &Wh, const std::string &dom_name) const
const space_constitution< T, M > & get_constitution() const
Definition: space.h:188
const distributor & iu_ownership() const
Definition: space.h:210
tensor_basic< T > tensor_momentum(const Function &f, size_type idof) const
Definition: space.h:223
void unblock(const domain_indirect_basic< M > &dom)
Definition: space.h:200
distributor _ib_ownership
Definition: space.h:274
point_basic< T > vector_momentum(const Function &f, size_type idof) const
Definition: space.h:220
void freeze_guard() const
Definition: space.h:253
void no_freeze_check() const
Definition: space.h:261
void parent_subgeo_owner_check() const
Definition: space.h:241
const communicator & comm() const
Definition: space.h:186
size_type ndof() const
Definition: space.h:184
const distributor & ib_ownership() const
Definition: space.h:211
void freeze_check() const
Definition: space.h:258
disarray< space_pair_type, M > _idof2blk_dis_iub
Definition: space.h:270
bool operator==(const space_base_rep< T, M > &V2) const
Definition: space.h:233
const basis_basic< T > & get_basis() const
Definition: space.h:190
static space_basic< T, distributed > real()
const std::set< size_type > & ext_ib_set() const
Definition: space.h:879
void get_parent_subgeo_owner_dis_indexes(Set &ext_dis_idofs) const
Definition: space.h:891
friend bool are_compatible(const space_basic< T, distributed > &V1, const space_basic< T, distributed > &V2)
Definition: space.h:885
disarray< size_type, distributed > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, distributed > &Wh, const geo_basic< T, distributed > &bgd_gamma) const
size_type get_parent_subgeo_owner(size_type dis_idof) const
Definition: space.h:893
smart_pointer< rep > base
Definition: space.h:801
space_rep< T, distributed > rep
Definition: space.h:800
disarray< size_type, distributed > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, distributed > &Wh, const std::string &dom_name) const
const std::set< size_type > & ext_iu_set() const
Definition: space.h:878
const std::set< size_type > & ext_ib_set() const
Definition: space.h:474
void get_parent_subgeo_owner_dis_indexes(Set &ext_dis_idofs) const
Definition: space.h:486
space_rep< T, sequential > rep
Definition: space.h:396
size_type get_parent_subgeo_owner(size_type dis_idof) const
Definition: space.h:488
friend bool are_compatible(const space_basic< T, sequential > &V1, const space_basic< T, sequential > &V2)
Definition: space.h:480
smart_pointer< rep > base
Definition: space.h:397
static space_basic< T, sequential > real()
const std::set< size_type > & ext_iu_set() const
Definition: space.h:473
disarray< size_type, sequential > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, sequential > &Wh, const std::string &dom_name) const
disarray< size_type, sequential > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, sequential > &Wh, const geo_basic< T, sequential > &bgd_gamma) const
the finite element space
Definition: space.h:382
const valued_type & valued_tag() const
void block(const domain_indirect_basic< M > &dom)
const geo_basic< T, M > & get_geo() const
void unblock_n(const domain_indirect_basic< M > &dom)
const std::string & valued() const
void block_n(const domain_indirect_basic< M > &dom)
void unblock(const domain_indirect_basic< M > &dom)
const basis_basic< T > & get_basis() const
space_base_rep< T, distributed > base
Definition: space.h:337
const std::set< size_type > & ext_ib_set() const
Definition: space.h:362
void append_external_dof(const geo_basic< T, distributed > &dom, std::set< size_type > &ext_dof_set) const
size_type idof2ios_dis_idof(size_type idof) const
Definition: space.h:359
disarray< size_type, distributed > _ios_idof2dis_idof
Definition: space.h:371
const distributor & ios_ownership() const
Definition: space.h:358
disarray< size_type, distributed > _idof2ios_dis_idof
Definition: space.h:370
size_type ios_idof2dis_idof(size_type ios_idof) const
Definition: space.h:360
std::set< size_type > _ext_ib_set
Definition: space.h:374
const communicator & comm() const
Definition: space.h:353
const std::set< size_type > & ext_iu_set() const
Definition: space.h:361
std::set< size_type > _ext_iu_set
Definition: space.h:373
size_type idof2ios_dis_idof(size_type idof) const
Definition: space.h:322
size_type dis_idof2dis_iub(size_type dis_idof) const
Definition: space.h:319
const distributor & ios_ownership() const
Definition: space.h:321
bool dis_is_blocked(size_type dis_idof) const
Definition: space.h:318
size_type ios_idof2dis_idof(size_type ios_idof) const
Definition: space.h:323
space_base_rep< T, sequential > base
Definition: space.h:302
distributed
Definition: asr.cc:228
space_basic< Float > space
Definition: space.h:386
rheolef::std Function
void get_geo(istream &in, my_geo &omega)
Expr1::float_type T
Definition: field_expr.h:230
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
valued_type valued_tag(const std::string &name)
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)
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)
This file is part of Rheolef.
bool operator==(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
bool operator!=(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
space_constant::valued_type valued_tag() const
#define _RHEOLEF_space_build_dom_dis_idof2bgd_dis_idof(M)
Definition: space.h:1199
Definition: cavity_dg.h:29
disarray< size_t >::size_type size_type
Definition: space.h:122
void set_dis_iub(size_type dis_iub)
Definition: space.h:127
void set_blocked(bool blk)
Definition: space.h:128
size_type _dis_iub
Definition: space.h:135
size_type dis_iub() const
Definition: space.h:126
void serialize(Archive &ar, const unsigned int version)
Definition: space.h:132
friend std::ostream & operator<<(std::ostream &os, const space_pair_type &x)
Definition: space.h:129
space_pair_type(bool blk, size_type dis_iub)
Definition: space.h:124
bool is_blocked() const
Definition: space.h:125
Expr1::memory_type M
Definition: vec_expr_v2.h:416