Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
space_mpi.cc
Go to the documentation of this file.
1
21
22#include "rheolef/config.h"
23
24#ifdef _RHEOLEF_HAVE_MPI
25
26#include "rheolef/space.h"
27#include "rheolef/space_mult.h"
28
29namespace rheolef {
30
31template <class T>
35 _idof2ios_dis_idof(),
36 _ios_idof2dis_idof(),
37 _ext_iu_set(),
38 _ext_ib_set()
39{
40 base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
41}
42template <class T>
44 const geo_basic<T,distributed>& omega_in,
45 std::string approx,
46 std::string valued)
47 : space_base_rep<T,distributed>::space_base_rep (omega_in, approx, valued),
48 _idof2ios_dis_idof(),
49 _ios_idof2dis_idof(),
50 _ext_iu_set(),
51 _ext_ib_set()
52{
53 if (approx == "") return; // empty space cstor
54 base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
55}
56template <class T>
58 const geo_basic<T,distributed>& omega_in,
59 const basis_basic<T>& b)
61 _idof2ios_dis_idof(),
62 _ios_idof2dis_idof(),
63 _ext_iu_set(),
64 _ext_ib_set()
65{
66 if (! b.is_initialized()) return; // empty space cstor
67 base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
68}
69template <class T>
72 _idof2ios_dis_idof(),
73 _ios_idof2dis_idof(),
74 _ext_iu_set(),
75 _ext_ib_set()
76{
77 base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
78}
79template <class T>
80void
82{
83 base::base_freeze_body();
84 // -----------------------------------------------------------------------
85 // 1) symbolic assembly:
86 // loop on elements & identify some dofs, that are referenced
87 // by locally-managed geo_elements, but these dofs are managed
88 // by another processor: e.g. dofs associated to vertices on
89 // a partition boundary.
90 // -----------------------------------------------------------------------
91 // set local numbering with global indexes
92 size_type first_dis_iu = base::_iu_ownership.first_index();
93 size_type first_dis_ib = base::_ib_ownership.first_index();
94 for (size_type idof = 0, ndof = base::_idof2blk_dis_iub.size(); idof < ndof; idof++) {
95 size_type first_dis_iub = base::_idof2blk_dis_iub [idof].is_blocked() ? first_dis_ib : first_dis_iu;
96 base::_idof2blk_dis_iub [idof].set_dis_iub (base::_idof2blk_dis_iub[idof].dis_iub() + first_dis_iub);
97 }
98 // -----------------------------------------------------------------------
99 // 2) get external dof numbering:
100 // -----------------------------------------------------------------------
101 std::set<size_type> ext_dof_set;
102 base::get_constitution().compute_external_dofs (ext_dof_set);
103 base::_idof2blk_dis_iub.set_dis_indexes (ext_dof_set);
104 // -----------------------------------------------------------------------
105 // 3) build also ext_iu_set and ext_ib_set, for field::dis_dof(dis_idof)
106 // -----------------------------------------------------------------------
107 for (typename std::set<size_type>::const_iterator iter = ext_dof_set.begin(), last = ext_dof_set.end();
108 iter != last; iter++) {
109 size_type dis_idof = *iter;
110 const space_pair_type& blk_dis_iub = base::_idof2blk_dis_iub.dis_at (dis_idof);
111 if (! blk_dis_iub.is_blocked()) {
112 _ext_iu_set.insert (blk_dis_iub.dis_iub());
113 } else {
114 _ext_ib_set.insert (blk_dis_iub.dis_iub());
115 }
116 }
117}
118// ----------------------------------------------------------------------------
119// accessors for external dofs
120// ----------------------------------------------------------------------------
121template <class T>
124{
125 base::freeze_guard();
126 return base::_idof2blk_dis_iub.dis_at (dis_idof).dis_iub();
127}
128template <class T>
129bool
131{
132 base::freeze_guard();
133 return base::_idof2blk_dis_iub.dis_at (dis_idof).is_blocked();
134}
135// ----------------------------------------------------------------------------
136// instanciation in library
137// ----------------------------------------------------------------------------
138template class space_rep<Float,distributed>;
139
140} // namespace rheolef
141#endif // _RHEOLEF_HAVE_MPI
generic mesh with rerefence counting
Definition geo.h:1089
Expr1::float_type T
Definition field_expr.h:230
This file is part of Rheolef.
size_type dis_iub() const
Definition space.h:126
bool is_blocked() const
Definition space.h:125