Rheolef  7.1
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 
169  space_base_rep ();
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);
177  space_base_rep (const space_constitution<T,M>& constit);
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(); }
191  valued_type valued_tag() const { return _constit.valued_tag(); }
192  const std::string& valued() const { return _constit.valued(); }
193  size_type size() const { return _constit.size(); }
196 
197  std::string name() const;
198 
199  void block (const domain_indirect_basic<M>& dom) { no_freeze_guard(); _constit.block (dom); }
200  void unblock(const domain_indirect_basic<M>& dom) { no_freeze_guard(); _constit.unblock(dom);}
201 
202  void block_n (const domain_indirect_basic<M>& dom) { no_freeze_guard(); _constit.block_n (dom); }
203  void unblock_n(const domain_indirect_basic<M>& dom) { no_freeze_guard(); _constit.unblock_n(dom);}
204 
205  bool is_blocked (size_type idof) const { freeze_guard(); return _idof2blk_dis_iub [idof].is_blocked(); }
206  size_type dis_iub (size_type idof) const { freeze_guard(); 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 protected:
240  template <class T1, class M1> friend class field_basic;
241 // internal:
242  void init_xdof();
243  void freeze_guard() const {
244  if (_have_freezed) return;
245  _have_freezed = true;
246  freeze_body();
247  }
248  void no_freeze_guard() const {
249  check_macro (!_have_freezed, "freezed space cannot accept new (un)blocked domains");
250  }
251  void base_freeze_body() const;
252  virtual void freeze_body() const { return base_freeze_body(); }
253 // data: lazy initialization (on demand only), thus most are mutable
255  disarray<point_basic<T>,M > _xdof; // nodal approx only
256  mutable bool _have_freezed;
257  mutable disarray<space_pair_type,M> _idof2blk_dis_iub; // pair (is_blocked ; dis_iu_or_ib); use ownership
258  mutable disarray<int,M> _has_nt_basis; // whether block_n or block_t : for piola ; use ownership
259  mutable disarray<point_basic<T>,M> _normal; // when block_{nt} ; use ownership
260  mutable distributor _iu_ownership; // unknown values distribution
261  mutable distributor _ib_ownership; // blocked values distribution
262 };
263 // ---------------------------------------------------------------------
264 template <class T, class M> class space_rep {};
265 
266 template <class T>
267 class space_rep<T,sequential> : public space_base_rep<T,sequential> {
268 public:
269 
270 // typedefs:
271 
273  typedef typename base::size_type size_type;
274 
275 // allocators:
276 
277  space_rep ( const geo_basic<T,sequential>& omega,
278  std::string approx,
279  std::string prod_valued);
280  space_rep ( const geo_basic<T,sequential>& omega,
281  const basis_basic<T>& b);
285 
286 // for compatibility with the distributed interface:
287 
288  bool dis_is_blocked (size_type dis_idof) const { return base::is_blocked(dis_idof); }
289  size_type dis_idof2dis_iub (size_type dis_idof) const { return base::dis_iub (dis_idof); }
290 
291  const distributor& ios_ownership() const { return base::ownership(); }
292  size_type idof2ios_dis_idof (size_type idof) const { return idof; }
293  size_type ios_idof2dis_idof (size_type ios_idof) const { return ios_idof; }
294 
295  // for compatibility with the distributed case:
296  const std::set<size_type>& ext_iu_set() const;
297  const std::set<size_type>& ext_ib_set() const;
298 };
299 // ---------------------------------------------------------------------
300 #ifdef _RHEOLEF_HAVE_MPI
301 template <class T>
302 class space_rep<T,distributed> : public space_base_rep<T,distributed> {
303 public:
304 
305 // typedefs:
306 
308  typedef typename base::size_type size_type;
309 
310 // allocators:
311 
312  space_rep ( const geo_basic<T,distributed>& omega,
313  std::string approx,
314  std::string prod_valued);
315  space_rep ( const geo_basic<T,distributed>& omega,
316  const basis_basic<T>& b);
320 
321 // accessors:
322 
323  const communicator& comm() const { return base::comm(); }
324 
325  bool dis_is_blocked (size_type dis_idof) const;
326  size_type dis_idof2dis_iub (size_type dis_idof) const;
327 
328  const distributor& ios_ownership() const { return _ios_idof2dis_idof.ownership(); }
329  size_type idof2ios_dis_idof (size_type idof) const { base::freeze_guard(); return _idof2ios_dis_idof [idof]; }
330  size_type ios_idof2dis_idof (size_type ios_idof) const { base::freeze_guard(); return _ios_idof2dis_idof [ios_idof]; }
331  const std::set<size_type>& ext_iu_set() const { return _ext_iu_set; }
332  const std::set<size_type>& ext_ib_set() const { return _ext_ib_set; }
333 
334 protected:
335  template <class T1, class M1> friend class field_basic;
336 // internal procedures:
337  void freeze_body() const;
338  void append_external_dof (const geo_basic<T,distributed>& dom, std::set<size_type>& ext_dof_set) const;
339 // data:
340  disarray<size_type,distributed> _idof2ios_dis_idof; // permut to/from ios dof numbering (before geo part), for i/o
342 // mutable data, affected by freeze_*()const:
343  mutable std::set<size_type> _ext_iu_set; // external dofs used by field::dis_dof
344  mutable std::set<size_type> _ext_ib_set;
345 };
346 #endif // _RHEOLEF_HAVE_MPI
347 // ====================================================================
348 // 2) wrapper class: seq & mpi specializations
349 // ====================================================================
351 template <class T, class M = rheo_default_memory_model>
352 class space_basic {
353 public:
354 };
355 // [verbatim_space]
357 // [verbatim_space]
358 // ---------------------------------------------------------------------
359 // [verbatim_space_basic]
360 template <class T>
361 class space_basic<T,sequential> : public smart_pointer<space_rep<T,sequential> > {
362 public:
363 
364 // typedefs:
365 
368  typedef typename rep::size_type size_type;
369  typedef typename rep::valued_type valued_type;
370 
371 // allocators:
372 
374  std::string approx = "",
375  std::string prod_valued = "scalar");
376  space_basic (const geo_basic<T,sequential>& omega,
377  const basis_basic<T>& b);
380  static space_basic<T,sequential> real();
381 
382 // accessors:
383 
384  void block (std::string dom_name);
385  void unblock(std::string dom_name);
386  void block (const domain_indirect_basic<sequential>& dom);
387  void unblock(const domain_indirect_basic<sequential>& dom);
388 
389  void block_n (std::string dom_name);
390  void unblock_n(std::string dom_name);
391  void block_n (const domain_indirect_basic<sequential>& dom);
392  void unblock_n(const domain_indirect_basic<sequential>& dom);
393 
394  const distributor& ownership() const;
395  const communicator& comm() const;
396  size_type ndof() const;
397  size_type dis_ndof() const;
398 
399  const geo_basic<T,sequential>& get_geo() const;
400  const basis_basic<T>& get_basis() const;
401  size_type size() const;
402  valued_type valued_tag() const;
403  const std::string& valued() const;
404  space_component<T,sequential> operator[] (size_type i_comp);
405  space_component_const<T,sequential> operator[] (size_type i_comp) const;
406  const space_constitution<T,sequential>& get_constitution() const;
407  size_type degree() const;
408  std::string get_approx() const;
409  std::string name() const;
410 
411  void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
412 
413  const distributor& iu_ownership() const;
414  const distributor& ib_ownership() const;
415 
416  bool is_blocked (size_type idof) const;
417  size_type dis_iub (size_type idof) const;
418  bool dis_is_blocked (size_type dis_idof) const;
419  size_type dis_idof2dis_iub (size_type dis_idof) const;
420 
421  const distributor& ios_ownership() const;
422  size_type idof2ios_dis_idof (size_type idof) const;
423  size_type ios_idof2dis_idof (size_type ios_idof) const;
424 
425  const point_basic<T>& xdof (size_type idof) const;
426  const disarray<point_basic<T>,sequential>& get_xdofs() const;
427 
428  template <class Function>
429  T momentum (const Function& f, size_type idof) const;
430 
431  template <class Function>
432  point_basic<T> vector_momentum (const Function& f, size_type idof) const;
433 
434  template <class Function>
435  tensor_basic<T> tensor_momentum (const Function& f, size_type idof) const;
436 
437  disarray<size_type, sequential> build_indirect_array (
438  const space_basic<T,sequential>& Wh, const std::string& dom_name) const;
439 
440  disarray<size_type, sequential> build_indirect_array (
441  const space_basic<T,sequential>& Wh, const geo_basic<T,sequential>& bgd_gamma) const;
442 
443  const std::set<size_type>& ext_iu_set() const { return base::data().ext_iu_set(); }
444  const std::set<size_type>& ext_ib_set() const { return base::data().ext_ib_set(); }
445 
446 // comparator:
447 
448  bool operator== (const space_basic<T,sequential>& V2) const { return base::data().operator==(V2.data()); }
449  bool operator!= (const space_basic<T,sequential>& V2) const { return ! operator== (V2); }
451  return are_compatible (V1.data(), V2.data()); }
452 };
453 // [verbatim_space_basic]
454 template<class T>
455 inline
457  const geo_basic<T,sequential>& omega,
458  std::string approx,
459  std::string prod_valued)
460  : base (new_macro(rep(omega, approx, prod_valued)))
461 {
462 }
463 template<class T>
464 inline
466  const geo_basic<T,sequential>& omega,
467  const basis_basic<T>& b)
468  : base (new_macro(rep(omega, b)))
469 {
470 }
471 template<class T>
472 inline
474  const space_constitution<T,sequential>& constit)
475  : base (new_macro(rep(constit)))
476 {
477 }
478 template<class T>
479 inline
481  : base (new_macro(rep(expr)))
482 {
483 }
484 template<class T>
485 inline
486 const distributor&
488 {
489  return base::data().ownership();
490 }
491 template<class T>
492 inline
493 const distributor&
495 {
496  return base::data().ios_ownership();
497 }
498 template<class T>
499 inline
500 const communicator&
502 {
503  return base::data().comm();
504 }
505 template<class T>
506 inline
509 {
510  return base::data().ndof();
511 }
512 template<class T>
513 inline
516 {
517  return base::data().dis_ndof();
518 }
519 template<class T>
520 inline
523 {
524  return base::data().get_geo();
525 }
526 template<class T>
527 inline
528 const basis_basic<T>&
530 {
531  return base::data().get_basis();
532 }
533 template<class T>
534 inline
537 {
538  return base::data().get_constitution();
539 }
540 template<class T>
541 inline
544 {
545  return base::data().size();
546 }
547 template<class T>
548 inline
549 const std::string&
551 {
552  return base::data().valued();
553 }
554 template<class T>
555 inline
558 {
559  return base::data().valued_tag();
560 }
561 template<class T>
562 inline
565 {
566  return base::data().operator[] (i_comp);
567 }
568 template<class T>
569 inline
572 {
573  return base::data().operator[] (i_comp);
574 }
575 template<class T>
576 inline
579 {
580  return get_basis().degree();
581 }
582 template<class T>
583 inline
584 std::string
586 {
587  return get_basis().name();
588 }
589 template<class T>
590 inline
591 std::string
593 {
594  return base::data().name();
595 }
596 template<class T>
597 inline
598 void
599 space_basic<T,sequential>::dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const
600 {
601  return base::data().dis_idof (K, dis_idof);
602 }
603 template<class T>
604 inline
607 {
608  return base::data().idof2ios_dis_idof (idof);
609 }
610 template<class T>
611 inline
614 {
615  return base::data().ios_idof2dis_idof (ios_idof);
616 }
617 template<class T>
618 inline
619 const distributor&
621 {
622  return base::data().iu_ownership();
623 }
624 template<class T>
625 inline
626 const distributor&
628 {
629  return base::data().ib_ownership();
630 }
631 template<class T>
632 inline
633 bool
635 {
636  return base::data().is_blocked (idof);
637 }
638 template<class T>
639 inline
642 {
643  return base::data().dis_iub (idof);
644 }
645 template<class T>
646 inline
647 bool
649 {
650  return base::data().dis_is_blocked (dis_idof);
651 }
652 template<class T>
653 inline
656 {
657  return base::data().dis_idof2dis_iub (dis_idof);
658 }
659 template<class T>
660 inline
661 void
662 space_basic<T,sequential>::block (std::string dom_name)
663 {
664  return base::data().block (get_geo().get_domain_indirect(dom_name));
665 }
666 template<class T>
667 inline
668 void
670 {
671  return base::data().unblock (get_geo().get_domain_indirect(dom_name));
672 }
673 template<class T>
674 inline
675 void
677 {
678  return base::data().block (dom);
679 }
680 template<class T>
681 inline
682 void
684 {
685  return base::data().unblock (dom);
686 }
687 template<class T>
688 inline
689 void
691 {
692  return base::data().block_n (get_geo().get_domain_indirect(dom_name));
693 }
694 template<class T>
695 inline
696 void
698 {
699  return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
700 }
701 template<class T>
702 inline
703 void
705 {
706  return base::data().block_n (dom);
707 }
708 template<class T>
709 inline
710 void
712 {
713  return base::data().unblock_n (dom);
714 }
715 template<class T>
716 inline
717 const point_basic<T>&
719 {
720  return base::data().xdof (idof);
721 }
722 template<class T>
723 inline
726 {
727  return base::data().get_xdofs();
728 }
729 template<class T>
730 template <class Function>
731 inline
732 T
734 {
735  return base::data().momentum (f, idof);
736 }
737 template<class T>
738 template <class Function>
739 inline
742 {
743  return base::data().vector_momentum (f, idof);
744 }
745 template<class T>
746 template <class Function>
749 {
750  return base::data().tensor_momentum (f, idof);
751 }
752 
753 // ---------------------------------------------------------------------
754 #ifdef _RHEOLEF_HAVE_MPI
755 //<verbatim:
756 template <class T>
757 class space_basic<T,distributed> : public smart_pointer<space_rep<T,distributed> > {
758 public:
759 
760 // typedefs:
761 
764  typedef typename rep::size_type size_type;
765  typedef typename rep::valued_type valued_type;
766 
767 // allocators:
768 
770  std::string approx = "",
771  std::string prod_valued = "scalar");
773  const basis_basic<T>& b);
776  static space_basic<T,distributed> real();
777 
778 // accessors:
779 
780  void block (std::string dom_name);
781  void unblock(std::string dom_name);
782  void block (const domain_indirect_basic<distributed>& dom);
783  void unblock(const domain_indirect_basic<distributed>& dom);
784 
785  void block_n (std::string dom_name);
786  void unblock_n(std::string dom_name);
787  void block_n (const domain_indirect_basic<distributed>& dom);
788  void unblock_n(const domain_indirect_basic<distributed>& dom);
789 
790  const distributor& ownership() const;
791  const communicator& comm() const;
792  size_type ndof() const;
793  size_type dis_ndof() const;
794 
795  const geo_basic<T,distributed>& get_geo() const;
796  const basis_basic<T>& get_basis() const;
797  size_type size() const;
798  valued_type valued_tag() const;
799  const std::string& valued() const;
800  space_component<T,distributed> operator[] (size_type i_comp);
801  space_component_const<T,distributed> operator[] (size_type i_comp) const;
802  const space_constitution<T,distributed>& get_constitution() const;
803  size_type degree() const;
804  std::string get_approx() const;
805  std::string name() const;
806 
807  void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
808 
809  const distributor& iu_ownership() const;
810  const distributor& ib_ownership() const;
811 
812  bool is_blocked (size_type idof) const;
813  size_type dis_iub (size_type idof) const;
814 
815  bool dis_is_blocked (size_type dis_idof) const;
816  size_type dis_idof2dis_iub (size_type dis_idof) const;
817 
818  const distributor& ios_ownership() const;
819  size_type idof2ios_dis_idof (size_type idof) const;
820  size_type ios_idof2dis_idof (size_type ios_idof) const;
821 
822  const point_basic<T>& xdof (size_type idof) const;
823  const disarray<point_basic<T>,distributed>& get_xdofs() const;
824 
825  template <class Function>
826  T momentum (const Function& f, size_type idof) const;
827 
828  template <class Function>
829  point_basic<T> vector_momentum (const Function& f, size_type idof) const;
830 
831  template <class Function>
832  tensor_basic<T> tensor_momentum (const Function& f, size_type idof) const;
833 
834  disarray<size_type, distributed> build_indirect_array (
835  const space_basic<T,distributed>& Wh, const std::string& dom_name) const;
836 
837  disarray<size_type, distributed> build_indirect_array (
838  const space_basic<T,distributed>& Wh, const geo_basic<T,distributed>& bgd_gamma) const;
839 
840  const std::set<size_type>& ext_iu_set() const { return base::data().ext_iu_set(); }
841  const std::set<size_type>& ext_ib_set() const { return base::data().ext_ib_set(); }
842 
843 // comparator:
844 
845  bool operator== (const space_basic<T,distributed>& V2) const { return base::data().operator==(V2.data()); }
846  bool operator!= (const space_basic<T,distributed>& V2) const { return ! operator== (V2); }
848  return are_compatible (V1.data(), V2.data()); }
849 };
850 //>verbatim:
851 
852 template<class T>
853 inline
855  const geo_basic<T,distributed>& omega,
856  std::string approx,
857  std::string prod_valued)
858  : base (new_macro(rep(omega, approx, prod_valued)))
859 {
860 }
861 template<class T>
862 inline
864  const geo_basic<T,distributed>& omega,
865  const basis_basic<T>& b)
866  : base (new_macro(rep(omega, b)))
867 {
868 }
869 template<class T>
870 inline
872  const space_constitution<T,distributed>& constit)
873  : base (new_macro(rep(constit)))
874 {
875 }
876 template<class T>
877 inline
879  : base (new_macro(rep(expr)))
880 {
881 }
882 template<class T>
883 inline
884 const distributor&
886 {
887  return base::data().ownership();
888 }
889 template<class T>
890 inline
891 const distributor&
893 {
894  return base::data().ios_ownership();
895 }
896 template<class T>
897 inline
898 const communicator&
900 {
901  return base::data().comm();
902 }
903 template<class T>
904 inline
907 {
908  return base::data().ndof();
909 }
910 template<class T>
911 inline
914 {
915  return base::data().dis_ndof();
916 }
917 template<class T>
918 inline
921 {
922  return base::data().get_geo();
923 }
924 template<class T>
925 inline
926 const basis_basic<T>&
928 {
929  return base::data().get_basis();
930 }
931 template<class T>
932 inline
935 {
936  return base::data().get_constitution();
937 }
938 template<class T>
939 inline
942 {
943  return base::data().size();
944 }
945 template<class T>
946 inline
947 const std::string&
949 {
950  return base::data().valued();
951 }
952 template<class T>
953 inline
956 {
957  return base::data().valued_tag();
958 }
959 template<class T>
960 inline
963 {
964  return base::data().operator[] (i_comp);
965 }
966 template<class T>
967 inline
970 {
971  return base::data().operator[] (i_comp);
972 }
973 template<class T>
974 inline
977 {
978  return get_basis().degree();
979 }
980 template<class T>
981 inline
982 std::string
984 {
985  return get_basis().name();
986 }
987 template<class T>
988 inline
989 std::string
991 {
992  return base::data().name();
993 }
994 template<class T>
995 inline
996 void
997 space_basic<T,distributed>::dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const
998 {
999  return base::data().dis_idof (K, dis_idof);
1000 }
1001 template<class T>
1002 inline
1005 {
1006  return base::data().idof2ios_dis_idof (idof);
1007 }
1008 template<class T>
1009 inline
1012 {
1013  return base::data().ios_idof2dis_idof (ios_idof);
1014 }
1015 template<class T>
1016 inline
1017 const distributor&
1019 {
1020  return base::data().iu_ownership();
1021 }
1022 template<class T>
1023 inline
1024 const distributor&
1026 {
1027  return base::data().ib_ownership();
1028 }
1029 template<class T>
1030 inline
1031 bool
1033 {
1034  return base::data().is_blocked (idof);
1035 }
1036 template<class T>
1037 inline
1040 {
1041  return base::data().dis_iub (idof);
1042 }
1043 template<class T>
1044 inline
1045 bool
1047 {
1048  return base::data().dis_is_blocked (dis_idof);
1049 }
1050 template<class T>
1051 inline
1054 {
1055  return base::data().dis_idof2dis_iub (dis_idof);
1056 }
1057 template<class T>
1058 inline
1059 void
1061 {
1062  return base::data().block (get_geo().get_domain_indirect(dom_name));
1063 }
1064 template<class T>
1065 inline
1066 void
1068 {
1069  return base::data().unblock (get_geo().get_domain_indirect(dom_name));
1070 }
1071 template<class T>
1072 inline
1073 void
1075 {
1076  base::data().block (dom);
1077 }
1078 template<class T>
1079 inline
1080 void
1082 {
1083  base::data().unblock (dom);
1084 }
1085 template<class T>
1086 inline
1087 void
1089 {
1090  return base::data().block_n (get_geo().get_domain_indirect(dom_name));
1091 }
1092 template<class T>
1093 inline
1094 void
1096 {
1097  return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
1098 }
1099 template<class T>
1100 inline
1101 void
1103 {
1104  base::data().block_n (dom);
1105 }
1106 template<class T>
1107 inline
1108 void
1110 {
1111  base::data().unblock_n (dom);
1112 }
1113 template<class T>
1114 inline
1115 const point_basic<T>&
1117 {
1118  return base::data().xdof (idof);
1119 }
1120 template<class T>
1121 inline
1124 {
1125  return base::data().get_xdofs();
1126 }
1127 template<class T>
1128 template <class Function>
1129 inline
1130 T
1132 {
1133  return base::data().momentum (f, idof);
1134 }
1135 template<class T>
1136 template <class Function>
1137 inline
1140 {
1141  return base::data().vector_momentum (f, idof);
1142 }
1143 template<class T>
1144 template <class Function>
1147 {
1148  return base::data().tensor_momentum (f, idof);
1149 }
1150 #endif // _RHEOLEF_HAVE_MPI
1151 
1152 // only valid when M=sequential or M=distributed => use a macro
1153 #define _RHEOLEF_space_build_indirect_array(M) \
1154 template<class T> \
1155 inline \
1156 disarray<typename space_basic<T,M>::size_type, M> \
1157 space_basic<T,M>::build_indirect_array ( \
1158  const space_basic<T,M>& Wh, \
1159  const std::string& dom_name) const \
1160 { \
1161  return base::data().build_indirect_array (Wh.data(), dom_name); \
1162 } \
1163 template<class T> \
1164 inline \
1165 disarray<typename space_basic<T,M>::size_type, M> \
1166 space_basic<T,M>::build_indirect_array ( \
1167  const space_basic<T,M>& Wh, \
1168  const geo_basic<T,M>& bgd_gamma) const \
1169 { \
1170  return base::data().build_indirect_array (Wh.data(), bgd_gamma); \
1171 }
1173 
1174 #ifdef _RHEOLEF_HAVE_MPI
1176 #endif // _RHEOLEF_HAVE_MPI
1177 
1178 #undef _RHEOLEF_space_build_indirect_array
1179 
1180 } // namespace rheolef
1181 #endif // _RHEOLEF_SPACE_H
rheolef::space_numbering::ndof
size_type ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
Definition: space_numbering.cc:28
rheolef::geo_basic
generic mesh with rerefence counting
Definition: domain_indirect.h:64
rheolef::space_base_rep::are_compatible
friend bool are_compatible(const space_base_rep< T, M > &V1, const space_base_rep< T, M > &V2)
Definition: space.h:236
rheolef::space_base_rep::_constit
space_constitution< T, M > _constit
Definition: space.h:254
rheolef::space_base_rep::dis_iub
size_type dis_iub(size_type idof) const
Definition: space.h:206
rheolef::operator!=
bool operator!=(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
Definition: heap_allocator.h:172
rheolef::space_base_rep::dis_idof
void dis_idof(const geo_element &K, std::vector< size_type > &dis_idof) const
Definition: space.cc:200
rheolef::space_rep< T, sequential >::base
space_base_rep< T, sequential > base
Definition: space.h:272
rheolef::space_rep< T, distributed >::_ios_idof2dis_idof
disarray< size_type, distributed > _ios_idof2dis_idof
Definition: space.h:341
rheolef::space_basic< T, distributed >::valued_type
rep::valued_type valued_type
Definition: space.h:765
rheolef::space_base_rep::~space_base_rep
virtual ~space_base_rep()
Definition: space.h:179
rheolef::space_rep< T, distributed >::_ext_iu_set
std::set< size_type > _ext_iu_set
Definition: space.h:343
rheolef::space_numbering::dis_ndof
size_type dis_ndof(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
Definition: space_numbering.cc:41
rheolef::space_base_rep::_has_nt_basis
disarray< int, M > _has_nt_basis
Definition: space.h:258
mkgeo_ball.expr
expr
Definition: mkgeo_ball.sh:361
rheolef::point_basic
Definition: point.h:87
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
rheolef::distributor::comm
const communicator_type & comm() const
Definition: distributor.h:145
rheolef::space_base_rep::freeze_guard
void freeze_guard() const
Definition: space.h:243
rheolef::space_pair_type::is_blocked
bool is_blocked() const
Definition: space.h:125
rheolef::space_base_rep::vector_momentum
point_basic< T > vector_momentum(const Function &f, size_type idof) const
Definition: space.h:220
rheolef::space_rep< T, distributed >::ios_ownership
const distributor & ios_ownership() const
Definition: space.h:328
rheolef::space_pair_type::_dis_iub
size_type _dis_iub
Definition: space.h:135
rheolef::space_pair_type::space_pair_type
space_pair_type()
Definition: space.h:123
rheolef::space_base_rep::iu_ownership
const distributor & iu_ownership() const
Definition: space.h:210
rheolef::space_rep< T, sequential >::idof2ios_dis_idof
size_type idof2ios_dis_idof(size_type idof) const
Definition: space.h:292
rheolef::space_pair_type::operator<<
friend std::ostream & operator<<(std::ostream &os, const space_pair_type &x)
Definition: space.h:129
rheolef::space_base_rep::operator==
bool operator==(const space_base_rep< T, M > &V2) const
Definition: space.h:233
rheolef::space_base_rep::get_basis
const basis_basic< T > & get_basis() const
Definition: space.h:190
rheolef::space_basic< T, distributed >::rep
space_rep< T, distributed > rep
Definition: space.h:762
rheolef::space_rep< T, distributed >::ios_idof2dis_idof
size_type ios_idof2dis_idof(size_type ios_idof) const
Definition: space.h:330
rheolef::space_rep< T, distributed >::ext_iu_set
const std::set< size_type > & ext_iu_set() const
Definition: space.h:331
rheolef::space_rep< T, distributed >::_idof2ios_dis_idof
disarray< size_type, distributed > _idof2ios_dis_idof
Definition: space.h:340
rheolef::space_rep< T, sequential >::size_type
base::size_type size_type
Definition: space.h:273
rheolef::space_rep< T, distributed >::ext_ib_set
const std::set< size_type > & ext_ib_set() const
Definition: space.h:332
rheolef::sequential
Definition: distributed.h:28
rheolef::valued_tag
space_constant::valued_type valued_tag() const
Definition: field_expr_recursive.h:579
rheolef::space_base_rep::build_indirect_array
disarray< size_type, M > build_indirect_array(const space_base_rep< T, M > &Wh, const std::string &dom_name) const
Definition: space.cc:229
rheolef::space_basic< T, sequential >::ext_iu_set
const std::set< size_type > & ext_iu_set() const
Definition: space.h:443
rheolef::space_base_rep::operator[]
space_component< T, M > operator[](size_type i_comp)
Definition: space_component.h:126
rheolef::space_pair_type::space_pair_type
space_pair_type(bool blk, size_type dis_iub)
Definition: space.h:124
rheolef::space_base_rep::tensor_momentum
tensor_basic< T > tensor_momentum(const Function &f, size_type idof) const
Definition: space.h:223
rheolef::space_base_rep::unblock_n
void unblock_n(const domain_indirect_basic< M > &dom)
Definition: space.h:203
rheolef::space_constant::valued_tag
valued_type valued_tag(const std::string &name)
Definition: space_constant.cc:50
rheolef::space_base_rep::ndof
size_type ndof() const
Definition: space.h:184
rheolef::space_basic
the finite element space
Definition: space.h:352
boost
Definition: mpi_pair_datatype.h:46
rheolef::distributor
see the distributor page for the full documentation
Definition: distributor.h:62
rheolef::tensor_basic
Definition: tensor.h:90
mkgeo_ball.f
f
Definition: mkgeo_ball.sh:221
rheolef-config.version
version
Definition: rheolef-config.in:126
rheolef::space_rep< T, sequential >::dis_idof2dis_iub
size_type dis_idof2dis_iub(size_type dis_idof) const
Definition: space.h:289
rheolef::geo_element
see the geo_element page for the full documentation
Definition: geo_element.h:102
rheolef::space_base_rep
Definition: space.h:159
rheolef::space_rep< T, distributed >::size_type
base::size_type size_type
Definition: space.h:308
rheolef::space_constant::valued_type
valued_type
Definition: space_constant.h:135
rheolef::space_rep< T, sequential >
Definition: space.h:267
rheolef::space_numbering::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)
Definition: space_numbering.cc:187
rheolef::space_rep< T, distributed >::comm
const communicator & comm() const
Definition: space.h:323
rheolef::space_base_rep::is_blocked
bool is_blocked(size_type idof) const
Definition: space.h:205
rheolef::space_base_rep::freeze_body
virtual void freeze_body() const
Definition: space.h:252
rheolef::space_basic< T, sequential >::base
smart_pointer< rep > base
Definition: space.h:367
rheolef::space_base_rep::valued
const std::string & valued() const
Definition: space.h:192
rheolef::space_basic< T, distributed >::are_compatible
friend bool are_compatible(const space_basic< T, distributed > &V1, const space_basic< T, distributed > &V2)
Definition: space.h:847
_RHEOLEF_space_build_indirect_array
#define _RHEOLEF_space_build_indirect_array(M)
Definition: space.h:1153
rheolef::space_rep< T, distributed >::_ext_ib_set
std::set< size_type > _ext_ib_set
Definition: space.h:344
rheolef::space_basic< T, sequential >::are_compatible
friend bool are_compatible(const space_basic< T, sequential > &V1, const space_basic< T, sequential > &V2)
Definition: space.h:450
rheolef::operator==
bool operator==(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
Definition: heap_allocator.h:167
rheolef::space_base_rep::get_geo
const geo_basic< T, M > & get_geo() const
Definition: space.h:189
rheolef::space_pair_type::set_dis_iub
void set_dis_iub(size_type dis_iub)
Definition: space.h:127
rheolef::space_base_rep::get_xdofs
const disarray< point_basic< T >, M > & get_xdofs() const
Definition: space.h:208
rheolef::basis_basic
Definition: basis.h:206
rheolef::space_component_const
Definition: space.h:113
rheolef::smart_pointer
see the smart_pointer page for the full documentation
Definition: smart_pointer.h:351
rheolef::space_basic< T, sequential >::valued_type
rep::valued_type valued_type
Definition: space.h:369
rheolef::domain_indirect_basic< distributed >
Definition: domain_indirect.h:559
rheolef::geo_basic< T, sequential >
Definition: geo.h:1108
rheolef::geo_basic< T, distributed >
distributed mesh with rerefence counting
Definition: geo.h:1367
boost::mpi
Definition: mpi_pair_datatype.h:47
rheolef::space_base_rep::_idof2blk_dis_iub
disarray< space_pair_type, M > _idof2blk_dis_iub
Definition: space.h:257
rheolef::space_base_rep::size
size_type size() const
Definition: space.h:193
rheolef::space_base_rep::no_freeze_guard
void no_freeze_guard() const
Definition: space.h:248
rheolef::space_base_rep::block
void block(const domain_indirect_basic< M > &dom)
e.g. "P1(square)", for field_expr<Expr> checks
Definition: space.h:199
rheolef::space_base_rep::name
std::string name() const
Definition: space.cc:210
rheolef::distributed
Definition: distributed.h:88
rheolef::space_base_rep::valued_type
space_constant::valued_type valued_type
Definition: space.h:165
rheolef::space
space_basic< Float > space
Definition: space.h:356
rheolef::space_pair_type::size_type
disarray< size_t >::size_type size_type
Definition: space.h:122
rheolef::space_base_rep::_ib_ownership
distributor _ib_ownership
Definition: space.h:261
rheolef::field_basic
Definition: field_expr_utilities.h:38
rheolef::space_pair_type::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: space.h:132
rheolef::space_base_rep::_xdof
disarray< point_basic< T >, M > _xdof
Definition: space.h:255
rheolef::space_component
Definition: space.h:112
rheolef::space_base_rep::get_constitution
const space_constitution< T, M > & get_constitution() const
Definition: space.h:188
rheolef::space_base_rep::unblock
void unblock(const domain_indirect_basic< M > &dom)
Definition: space.h:200
rheolef::space_rep< T, distributed >::~space_rep
~space_rep()
Definition: space.h:319
rheolef::space_pair_type
Definition: space.h:121
rheolef::space_mult_list
Definition: space.h:111
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::distributor::dis_size
size_type dis_size() const
global and local sizes
Definition: distributor.h:207
rheolef::space_basic< T, sequential >::size_type
rep::size_type size_type
Definition: space.h:368
rheolef::smart_pointer_base::data
const T & data() const
Definition: smart_pointer.h:266
rheolef::Function
rheolef::std Function
rheolef::space_base_rep::_iu_ownership
distributor _iu_ownership
Definition: space.h:260
rheolef::space_basic< T, distributed >
Definition: space.h:757
rheolef::space_base_rep::base_freeze_body
void base_freeze_body() const
Definition: space.cc:157
rheolef::space_rep< T, distributed >
Definition: space.h:302
rheolef::space_rep< T, sequential >::ios_idof2dis_idof
size_type ios_idof2dis_idof(size_type ios_idof) const
Definition: space.h:293
rheolef::disarray
see the disarray page for the full documentation
Definition: disarray.h:459
rheolef::domain_indirect_basic< sequential >
Definition: domain_indirect.h:342
mkgeo_ball.b
b
Definition: mkgeo_ball.sh:152
rheolef::space_base_rep::space_base_rep
space_base_rep()
rheolef::space_basic< T, distributed >::size_type
rep::size_type size_type
Definition: space.h:764
rheolef::space_base_rep::block_n
void block_n(const domain_indirect_basic< M > &dom)
Definition: space.h:202
rheolef::space_basic< T, sequential >::ext_ib_set
const std::set< size_type > & ext_ib_set() const
Definition: space.h:444
rheolef::space_base_rep::dis_ndof
size_type dis_ndof() const
Definition: space.h:185
rheolef::space_base_rep::size_type
space_pair_type::size_type size_type
Definition: space.h:164
rheolef::space_base_rep::ownership
const distributor & ownership() const
Definition: space.h:183
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::space_pair_type::dis_iub
size_type dis_iub() const
Definition: space.h:126
rheolef::space_rep< T, distributed >::idof2ios_dis_idof
size_type idof2ios_dis_idof(size_type idof) const
Definition: space.h:329
rheolef::space_rep< T, sequential >::ios_ownership
const distributor & ios_ownership() const
Definition: space.h:291
rheolef::space_base_rep::xdof
const point_basic< T > & xdof(size_type idof) const
Definition: space.h:207
rheolef::space_base_rep::_have_freezed
bool _have_freezed
Definition: space.h:256
rheolef::space_base_rep::_normal
disarray< point_basic< T >, M > _normal
Definition: space.h:259
get_geo
void get_geo(istream &in, my_geo &omega)
Definition: field2gmsh_pos.cc:126
rheolef::space_base_rep::init_xdof
void init_xdof()
Definition: space.cc:114
rheolef::space_basic< T, distributed >::base
smart_pointer< rep > base
Definition: space.h:763
rheolef::space_base_rep::valued_tag
valued_type valued_tag() const
Definition: space.h:191
f
Definition: cavity_dg.h:29
rheolef::distributed
distributed
Definition: asr.cc:228
rheolef::space_basic< T, sequential >
Definition: space.h:361
rheolef::space_basic< T, distributed >::ext_ib_set
const std::set< size_type > & ext_ib_set() const
Definition: space.h:841
rheolef::space_base_rep::comm
const communicator & comm() const
Definition: space.h:186
rheolef::domain_indirect_basic
the finite element boundary domain
Definition: domain_indirect.h:335
rheolef::space_pair_type::_blk
bool _blk
Definition: space.h:134
rheolef::space_base_rep::momentum
T momentum(const Function &f, size_type idof) const
Definition: space.h:217
rheolef::space_base_rep::ib_ownership
const distributor & ib_ownership() const
Definition: space.h:211
rheolef::std
Definition: vec_expr_v2.h:391
rheolef::space_rep< T, sequential >::~space_rep
~space_rep()
Definition: space.h:284
rheolef::space_pair_type::set_blocked
void set_blocked(bool blk)
Definition: space.h:128
rheolef::space_rep< T, distributed >::base
space_base_rep< T, distributed > base
Definition: space.h:307
mkgeo_contraction.name
name
Definition: mkgeo_contraction.sh:133
M
Expr1::memory_type M
Definition: vec_expr_v2.h:385
rheolef::space_rep< T, sequential >::dis_is_blocked
bool dis_is_blocked(size_type dis_idof) const
Definition: space.h:288
rheolef::space_rep
Definition: space.h:264
rheolef::distributor::size
size_type size(size_type iproc) const
Definition: distributor.h:163
rheolef::space_constitution
Definition: space_constitution.h:32
rheolef::space_basic< T, sequential >::rep
space_rep< T, sequential > rep
Definition: space.h:366
T
Expr1::float_type T
Definition: field_expr.h:218
rheolef::space_basic< T, distributed >::ext_iu_set
const std::set< size_type > & ext_iu_set() const
Definition: space.h:840