Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
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
26namespace rheolef {
101} // namespace rheolef
102
103#include "rheolef/geo.h"
104#include "rheolef/geo_domain.h"
105#include "rheolef/space_constitution.h"
106
107namespace rheolef {
108
109// forward declarations:
110template <class T, class M> class field_basic;
111template <class T, class M> class space_mult_list;
112template <class T, class M> class space_component;
113template <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; }
133protected:
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.:
146namespace 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
153namespace rheolef {
154
155// =====================================================================
156// 1) representation: space_base_rep and space_rep
157// =====================================================================
158template <class T, class M>
160public:
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
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
249protected:
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};
279template <class T, class M>
280template <class Set>
281void
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// ---------------------------------------------------------------------
294template <class T, class M> class space_rep {};
295
296template <class T>
297class space_rep<T,sequential> : public space_base_rep<T,sequential> {
298public:
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
331template <class T>
332class space_rep<T,distributed> : public space_base_rep<T,distributed> {
333public:
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
364protected:
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// ====================================================================
381template <class T, class M = rheo_default_memory_model>
383public:
384};
385// [verbatim_space]
387// [verbatim_space]
388// ---------------------------------------------------------------------
389// [verbatim_space_basic]
390template <class T>
391class space_basic<T,sequential> : public smart_pointer<space_rep<T,sequential> > {
392public:
393
394// typedefs:
395
398 typedef typename rep::size_type size_type;
400
401// allocators:
402
404 std::string approx = "",
405 std::string prod_valued = "scalar");
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]
492template<class T>
493inline
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}
501template<class T>
502inline
504 const geo_basic<T,sequential>& omega,
505 const basis_basic<T>& b)
506 : base (new_macro(rep(omega, b)))
507{
508}
509template<class T>
510inline
513 : base (new_macro(rep(constit)))
514{
515}
516template<class T>
517inline
519 : base (new_macro(rep(expr)))
520{
521}
522template<class T>
523inline
524const distributor&
526{
527 return base::data().ownership();
528}
529template<class T>
530inline
531const distributor&
533{
534 return base::data().ios_ownership();
535}
536template<class T>
537inline
538const communicator&
540{
541 return base::data().comm();
542}
543template<class T>
544inline
547{
548 return base::data().ndof();
549}
550template<class T>
551inline
554{
555 return base::data().dis_ndof();
556}
557template<class T>
558inline
561{
562 return base::data().get_geo();
563}
564template<class T>
565inline
566const basis_basic<T>&
568{
569 return base::data().get_basis();
570}
571template<class T>
572inline
575{
576 return base::data().get_constitution();
577}
578template<class T>
579inline
582{
583 return base::data().size();
584}
585template<class T>
586inline
587const std::string&
589{
590 return base::data().valued();
591}
592template<class T>
593inline
596{
597 return base::data().valued_tag();
598}
599template<class T>
600inline
603{
604 return base::data().operator[] (i_comp);
605}
606template<class T>
607inline
610{
611 return base::data().operator[] (i_comp);
612}
613template<class T>
614inline
617{
618 return get_basis().degree();
619}
620template<class T>
621inline
622std::string
624{
625 return get_basis().name();
626}
627template<class T>
628inline
629std::string
631{
632 return base::data().name();
633}
634template<class T>
635inline
636void
637space_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}
641template<class T>
642inline
645{
646 return base::data().idof2ios_dis_idof (idof);
647}
648template<class T>
649inline
652{
653 return base::data().ios_idof2dis_idof (ios_idof);
654}
655template<class T>
656inline
657const distributor&
659{
660 return base::data().iu_ownership();
661}
662template<class T>
663inline
664const distributor&
666{
667 return base::data().ib_ownership();
668}
669template<class T>
670inline
671bool
673{
674 return base::data().is_blocked (idof);
675}
676template<class T>
677inline
680{
681 return base::data().dis_iub (idof);
682}
683template<class T>
684inline
685bool
687{
688 return base::data().dis_is_blocked (dis_idof);
689}
690template<class T>
691inline
694{
695 return base::data().dis_idof2dis_iub (dis_idof);
696}
697template<class T>
698inline
699void
701{
702 return base::data().block (get_geo().get_domain_indirect(dom_name));
703}
704template<class T>
705inline
706void
708{
709 return base::data().unblock (get_geo().get_domain_indirect(dom_name));
710}
711template<class T>
712inline
713void
715{
716 return base::data().block (dom);
717}
718template<class T>
719inline
720void
722{
723 return base::data().unblock (dom);
724}
725template<class T>
726inline
727void
729{
730 return base::data().block_n (get_geo().get_domain_indirect(dom_name));
731}
732template<class T>
733inline
734void
736{
737 return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
738}
739template<class T>
740inline
741void
743{
744 return base::data().block_n (dom);
745}
746template<class T>
747inline
748void
750{
751 return base::data().unblock_n (dom);
752}
753template<class T>
754inline
755const point_basic<T>&
757{
758 return base::data().xdof (idof);
759}
760template<class T>
761inline
764{
765 return base::data().get_xdofs();
766}
767template<class T>
768template <class Function>
769inline
770T
772{
773 return base::data().momentum (f, idof);
774}
775template<class T>
776template <class Function>
777inline
780{
781 return base::data().vector_momentum (f, idof);
782}
783template<class T>
784template <class Function>
787{
788 return base::data().tensor_momentum (f, idof);
789}
790
791// ---------------------------------------------------------------------
792#ifdef _RHEOLEF_HAVE_MPI
793//<verbatim:
794template <class T>
795class space_basic<T,distributed> : public smart_pointer<space_rep<T,distributed> > {
796public:
797
798// typedefs:
799
802 typedef typename rep::size_type size_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
898template<class T>
899inline
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}
907template<class T>
908inline
910 const geo_basic<T,distributed>& omega,
911 const basis_basic<T>& b)
912 : base (new_macro(rep(omega, b)))
913{
914}
915template<class T>
916inline
919 : base (new_macro(rep(constit)))
920{
921}
922template<class T>
923inline
928template<class T>
929inline
930const distributor&
932{
933 return base::data().ownership();
934}
935template<class T>
936inline
937const distributor&
939{
940 return base::data().ios_ownership();
941}
942template<class T>
943inline
944const communicator&
946{
947 return base::data().comm();
948}
949template<class T>
950inline
953{
954 return base::data().ndof();
955}
956template<class T>
957inline
960{
961 return base::data().dis_ndof();
962}
963template<class T>
964inline
967{
968 return base::data().get_geo();
969}
970template<class T>
971inline
972const basis_basic<T>&
974{
975 return base::data().get_basis();
976}
977template<class T>
978inline
981{
982 return base::data().get_constitution();
983}
984template<class T>
985inline
988{
989 return base::data().size();
990}
991template<class T>
992inline
993const std::string&
995{
996 return base::data().valued();
997}
998template<class T>
999inline
1002{
1003 return base::data().valued_tag();
1004}
1005template<class T>
1006inline
1009{
1010 return base::data().operator[] (i_comp);
1011}
1012template<class T>
1013inline
1016{
1017 return base::data().operator[] (i_comp);
1018}
1019template<class T>
1020inline
1023{
1024 return get_basis().degree();
1025}
1026template<class T>
1027inline
1028std::string
1030{
1031 return get_basis().name();
1032}
1033template<class T>
1034inline
1035std::string
1037{
1038 return base::data().name();
1039}
1040template<class T>
1041inline
1042void
1043space_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}
1047template<class T>
1048inline
1051{
1052 return base::data().idof2ios_dis_idof (idof);
1053}
1054template<class T>
1055inline
1058{
1059 return base::data().ios_idof2dis_idof (ios_idof);
1060}
1061template<class T>
1062inline
1063const distributor&
1065{
1066 return base::data().iu_ownership();
1067}
1068template<class T>
1069inline
1070const distributor&
1072{
1073 return base::data().ib_ownership();
1074}
1075template<class T>
1076inline
1077bool
1079{
1080 return base::data().is_blocked (idof);
1081}
1082template<class T>
1083inline
1086{
1087 return base::data().dis_iub (idof);
1088}
1089template<class T>
1090inline
1091bool
1093{
1094 return base::data().dis_is_blocked (dis_idof);
1095}
1096template<class T>
1097inline
1100{
1101 return base::data().dis_idof2dis_iub (dis_idof);
1102}
1103template<class T>
1104inline
1105void
1107{
1108 return base::data().block (get_geo().get_domain_indirect(dom_name));
1109}
1110template<class T>
1111inline
1112void
1114{
1115 return base::data().unblock (get_geo().get_domain_indirect(dom_name));
1116}
1117template<class T>
1118inline
1119void
1121{
1122 base::data().block (dom);
1123}
1124template<class T>
1125inline
1126void
1128{
1129 base::data().unblock (dom);
1130}
1131template<class T>
1132inline
1133void
1135{
1136 return base::data().block_n (get_geo().get_domain_indirect(dom_name));
1137}
1138template<class T>
1139inline
1140void
1142{
1143 return base::data().unblock_n (get_geo().get_domain_indirect(dom_name));
1144}
1145template<class T>
1146inline
1147void
1149{
1150 base::data().block_n (dom);
1151}
1152template<class T>
1153inline
1154void
1156{
1157 base::data().unblock_n (dom);
1158}
1159template<class T>
1160inline
1161const point_basic<T>&
1163{
1164 return base::data().xdof (idof);
1165}
1166template<class T>
1167inline
1170{
1171 return base::data().get_xdofs();
1172}
1173template<class T>
1174template <class Function>
1175inline
1176T
1178{
1179 return base::data().momentum (f, idof);
1180}
1181template<class T>
1182template <class Function>
1183inline
1186{
1187 return base::data().vector_momentum (f, idof);
1188}
1189template<class T>
1190template <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) \
1200template<class T> \
1201inline \
1202disarray<typename space_basic<T,M>::size_type, M> \
1203space_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} \
1209template<class T> \
1210inline \
1211disarray<typename space_basic<T,M>::size_type, M> \
1212space_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
rep::base::size_type size_type
Definition disarray.h:501
see the distributor page for the full documentation
Definition distributor.h:69
size_type dis_size() const
global and local sizes
size_type size(size_type iproc) const
const communicator_type & comm() const
the finite element boundary domain
generic mesh with rerefence counting
Definition geo.h:1089
see the geo_element page for the full documentation
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
const basis_basic< T > & get_basis() const
Definition space.h:190
const space_constitution< T, M > & get_constitution() const
Definition space.h:188
size_type dis_ndof() const
Definition space.h:185
const point_basic< T > & xdof(size_type idof) const
Definition space.h:207
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
disarray< size_type, M > build_dom_dis_idof2bgd_dis_idof(const space_base_rep< T, M > &Wh, const std::string &dom_name) const
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)
const disarray< point_basic< T >, M > & get_xdofs() const
Definition space.h:208
disarray< size_type, M > _parent_subgeo_owner
Definition space.h:277
tensor_basic< T > tensor_momentum(const Function &f, size_type idof) const
Definition space.h:223
void unblock_n(const domain_indirect_basic< M > &dom)
Definition space.h:203
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
point_basic< T > vector_momentum(const Function &f, size_type idof) const
Definition space.h:220
disarray< int, M > _has_nt_basis
Definition space.h:271
virtual void freeze_body() const
Definition space.h:265
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
const distributor & iu_ownership() const
Definition space.h:210
void unblock(const domain_indirect_basic< M > &dom)
Definition space.h:200
space_component< T, M > operator[](size_type i_comp)
distributor _ib_ownership
Definition space.h:274
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 distributor & ib_ownership() const
Definition space.h:211
size_type ndof() const
Definition space.h:184
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
const std::string & valued() const
Definition space.h:192
const geo_basic< T, M > & get_geo() const
Definition space.h:189
void freeze_check() const
Definition space.h:258
disarray< space_pair_type, M > _idof2blk_dis_iub
Definition space.h:270
const distributor & ownership() const
Definition space.h:183
bool operator==(const space_base_rep< T, M > &V2) const
Definition space.h:233
const communicator & comm() const
Definition space.h:186
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_ib_set() const
Definition space.h:879
disarray< size_type, distributed > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, distributed > &Wh, const geo_basic< T, distributed > &bgd_gamma) const
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
size_type get_parent_subgeo_owner(size_type dis_idof) const
Definition space.h:893
space_rep< T, distributed > rep
Definition space.h:800
static space_basic< T, distributed > real()
const std::set< size_type > & ext_iu_set() const
Definition space.h:878
static space_basic< T, sequential > real()
disarray< size_type, sequential > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, sequential > &Wh, const geo_basic< T, sequential > &bgd_gamma) const
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
disarray< size_type, sequential > build_dom_dis_idof2bgd_dis_idof(const space_basic< T, sequential > &Wh, const std::string &dom_name) const
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
const std::set< size_type > & ext_iu_set() const
Definition space.h:473
the finite element space
Definition space.h:382
const basis_basic< T > & get_basis() const
void block(const domain_indirect_basic< M > &dom)
const valued_type & valued_tag() const
void unblock_n(const domain_indirect_basic< M > &dom)
void block_n(const domain_indirect_basic< M > &dom)
void unblock(const domain_indirect_basic< M > &dom)
const std::string & valued() const
const geo_basic< T, M > & get_geo() const
space_base_rep< T, distributed > base
Definition space.h:337
void append_external_dof(const geo_basic< T, distributed > &dom, std::set< size_type > &ext_dof_set) const
const std::set< size_type > & ext_ib_set() const
Definition space.h:362
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 std::set< size_type > & ext_iu_set() const
Definition space.h:361
std::set< size_type > _ext_iu_set
Definition space.h:373
const communicator & comm() const
Definition space.h:353
size_type idof2ios_dis_idof(size_type idof) const
Definition space.h:322
const distributor & ios_ownership() const
Definition space.h:321
size_type dis_idof2dis_iub(size_type dis_idof) const
Definition space.h:319
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
space_basic< Float > space
Definition space.h:386
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)")
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
STL namespace.
#define _RHEOLEF_space_build_dom_dis_idof2bgd_dis_idof(M)
Definition space.h:1199
Definition cavity_dg.h:29
friend std::ostream & operator<<(std::ostream &os, const space_pair_type &x)
Definition space.h:129
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() const
Definition space.h:126
void serialize(Archive &ar, const unsigned int version)
Definition space.h:132
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