Loading...
Searching...
No Matches
space_mpi.cc
Go to the documentation of this file.
#include "rheolef/config.h"
#ifdef _RHEOLEF_HAVE_MPI
#include "rheolef/space.h"
#include "rheolef/space_mult.h"
namespace rheolef {
template <class T>
space_rep<T,distributed>::space_rep (
const space_constitution<T,distributed>& constit)
: space_base_rep<T,distributed>::space_base_rep (constit),
_idof2ios_dis_idof(),
_ios_idof2dis_idof(),
_ext_iu_set(),
_ext_ib_set()
{
base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
}
template <class T>
space_rep<T,distributed>::space_rep (
const geo_basic<T,distributed>& omega_in,
std::string approx,
std::string valued)
: space_base_rep<T,distributed>::space_base_rep (omega_in, approx, valued),
_idof2ios_dis_idof(),
_ios_idof2dis_idof(),
_ext_iu_set(),
_ext_ib_set()
{
if (approx == "") return; // empty space cstor
base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
}
template <class T>
space_rep<T,distributed>::space_rep (
const geo_basic<T,distributed>& omega_in,
const basis_basic<T>& b)
: space_base_rep<T,distributed>::space_base_rep (omega_in, b),
_idof2ios_dis_idof(),
_ios_idof2dis_idof(),
_ext_iu_set(),
_ext_ib_set()
{
if (! b.is_initialized()) return; // empty space cstor
base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
}
template <class T>
space_rep<T,distributed>::space_rep (const space_mult_list<T,distributed>& expr)
: space_base_rep<T,distributed>::space_base_rep (expr),
_idof2ios_dis_idof(),
_ios_idof2dis_idof(),
_ext_iu_set(),
_ext_ib_set()
{
base::get_constitution().set_ios_permutations (_idof2ios_dis_idof, _ios_idof2dis_idof);
}
template <class T>
void
space_rep<T,distributed>::freeze_body () const
{
base::base_freeze_body();
// -----------------------------------------------------------------------
// 1) symbolic assembly:
// loop on elements & identify some dofs, that are referenced
// by locally-managed geo_elements, but these dofs are managed
// by another processor: e.g. dofs associated to vertices on
// a partition boundary.
// -----------------------------------------------------------------------
// set local numbering with global indexes
size_type first_dis_iu = base::_iu_ownership.first_index();
size_type first_dis_ib = base::_ib_ownership.first_index();
for (size_type idof = 0, ndof = base::_idof2blk_dis_iub.size(); idof < ndof; idof++) {
size_type first_dis_iub = base::_idof2blk_dis_iub [idof].is_blocked() ? first_dis_ib : first_dis_iu;
base::_idof2blk_dis_iub [idof].set_dis_iub (base::_idof2blk_dis_iub[idof].dis_iub() + first_dis_iub);
}
// -----------------------------------------------------------------------
// 2) get external dof numbering:
// -----------------------------------------------------------------------
std::set<size_type> ext_dof_set;
base::get_constitution().compute_external_dofs (ext_dof_set);
base::_idof2blk_dis_iub.set_dis_indexes (ext_dof_set);
// -----------------------------------------------------------------------
// 3) build also ext_iu_set and ext_ib_set, for field::dis_dof(dis_idof)
// -----------------------------------------------------------------------
for (typename std::set<size_type>::const_iterator iter = ext_dof_set.begin(), last = ext_dof_set.end();
iter != last; iter++) {
size_type dis_idof = *iter;
const space_pair_type& blk_dis_iub = base::_idof2blk_dis_iub.dis_at (dis_idof);
if (! blk_dis_iub.is_blocked()) {
_ext_iu_set.insert (blk_dis_iub.dis_iub());
} else {
_ext_ib_set.insert (blk_dis_iub.dis_iub());
}
}
}
// ----------------------------------------------------------------------------
// accessors for external dofs
// ----------------------------------------------------------------------------
template <class T>
typename space_rep<T,distributed>::size_type
space_rep<T,distributed>::dis_idof2dis_iub (size_type dis_idof) const
{
base::freeze_guard();
return base::_idof2blk_dis_iub.dis_at (dis_idof).dis_iub();
}
template <class T>
bool
space_rep<T,distributed>::dis_is_blocked (size_type dis_idof) const
{
base::freeze_guard();
return base::_idof2blk_dis_iub.dis_at (dis_idof).is_blocked();
}
// ----------------------------------------------------------------------------
// instanciation in library
// ----------------------------------------------------------------------------
template class space_rep<Float,distributed>;
} // namespace rheolef
#endif // _RHEOLEF_HAVE_MPI
rheolef::basis_basic
Definition basis.h:566
rheolef::geo_basic
generic mesh with rerefence counting
Definition geo.h:1089
rheolef::space_base_rep< T, distributed >::dis_idof
void dis_idof(const geo_element &K, std::vector< size_type > &dis_idof) const
rheolef::space_base_rep< T, distributed >::base_freeze_body
void base_freeze_body() const
rheolef::space_base_rep< T, distributed >::get_constitution
const space_constitution< T, distributed > & get_constitution() const
Definition space.h:188
rheolef::space_base_rep< T, distributed >::dis_iub
size_type dis_iub(size_type idof) const
Definition space.h:206
rheolef::space_base_rep< T, distributed >::space_base_rep
space_base_rep()
rheolef::space_base_rep< T, distributed >::size
size_type size() const
Definition space.h:193
rheolef::space_base_rep< T, distributed >::_iu_ownership
distributor _iu_ownership
Definition space.h:273
rheolef::space_base_rep< T, distributed >::_ib_ownership
distributor _ib_ownership
Definition space.h:274
rheolef::space_base_rep< T, distributed >::freeze_guard
void freeze_guard() const
Definition space.h:253
rheolef::space_base_rep< T, distributed >::ndof
size_type ndof() const
Definition space.h:184
rheolef::space_base_rep< T, distributed >::valued
const std::string & valued() const
Definition space.h:192
rheolef::space_base_rep< T, distributed >::_idof2blk_dis_iub
disarray< space_pair_type, distributed > _idof2blk_dis_iub
Definition space.h:270
rheolef::space_constitution
Definition space_constitution.h:405
rheolef::space_mult_list
Definition space_mult.h:54
rheolef::space_rep< T, distributed >::_ios_idof2dis_idof
disarray< size_type, distributed > _ios_idof2dis_idof
Definition space.h:371
rheolef::space_rep< T, distributed >::size_type
base::size_type size_type
Definition space.h:338
rheolef::space_rep< T, distributed >::_idof2ios_dis_idof
disarray< size_type, distributed > _idof2ios_dis_idof
Definition space.h:370
rheolef::space_rep< T, distributed >::space_rep
space_rep(const geo_basic< T, distributed > &omega, std::string approx, std::string prod_valued)
Definition space_mpi.cc:43
rheolef::space_rep< T, distributed >::_ext_ib_set
std::set< size_type > _ext_ib_set
Definition space.h:374
rheolef::space_rep< T, distributed >::_ext_iu_set
std::set< size_type > _ext_iu_set
Definition space.h:373
rheolef::space_rep
Definition space.h:294
T
Expr1::float_type T
Definition field_expr.h:230
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::distributed
Definition communicator.h:128
rheolef::space_pair_type
Definition space.h:121
rheolef::space_pair_type::dis_iub
size_type dis_iub() const
Definition space.h:126
rheolef::space_pair_type::is_blocked
bool is_blocked() const
Definition space.h:125