1 #include "rheolef/config.h"
22 #ifdef _RHEOLEF_HAVE_MPI
23 #include "rheolef/geo.h"
24 #include "rheolef/geo_domain.h"
25 #include "rheolef/dis_macros.h"
26 #include "rheolef/rheostream.h"
27 #include "rheolef/iorheo.h"
28 #include "rheolef/index_set.h"
36 struct permutation_proxy {
38 permutation_proxy (
const hack_array<geo_element_hack>& elts,
size_type first_dis_v = 0)
39 : _elts(elts), _first_dis_v(first_dis_v) {}
40 size_type size()
const {
return _elts.size(); }
42 const geo_element& K = _elts [ie];
43 return K.ios_dis_ie() - _first_dis_v;
45 const permutation_proxy& data()
const {
return *
this; }
47 const hack_array<geo_element_hack>& _elts;
55 iorheo::flag_type format = iorheo::flags(ops.
os()) & iorheo::format_field;
67 ops << setprecision(numeric_limits<Float>::digits10)
74 h.dimension = base::_dimension;
75 h.sys_coord = base::_sys_coord;
77 h.dis_size_by_variant [0] = base::_node.dis_size();
79 h.dis_size_by_variant [
variant] = base::_geo_element [
variant].dis_size();
81 ops << endl <<
h << endl;
85 if (base::_dimension > 0) {
86 T rounding_prec = iorheo::getrounding_precision(ops.
os());
87 if (rounding_prec == 0) {
88 base::_node.permuted_put_values (ops,
92 base::_node.permuted_put_values (ops,
104 std::vector<size_type> node_perm ((my_proc == io_proc) ?
dis_nnod : 0);
106 if (my_proc == io_proc) {
107 size_type i_start = _inod2ios_dis_inod.ownership().first_index(my_proc);
108 size_type i_size = _inod2ios_dis_inod.ownership().size (my_proc);
110 node_perm [i_start + i] = _inod2ios_dis_inod [i];
112 for (
size_type iproc = 0; iproc < nproc; iproc++) {
113 if (iproc == my_proc)
continue;
114 size_type i_start = _inod2ios_dis_inod.ownership().first_index(iproc);
115 size_type i_size = _inod2ios_dis_inod.ownership().size (iproc);
116 comm.recv (iproc, tag_gather, node_perm.begin().operator->() + i_start, i_size);
119 comm.send (0, tag_gather, _inod2ios_dis_inod.begin().operator->(), _inod2ios_dis_inod.size());
130 if (base::_gs.ownership_by_variant[
variant].dis_size() == 0)
continue;
131 permutation_proxy perm (base::_geo_element [
variant], first_dis_v);
132 base::_geo_element [
variant].permuted_put_values (ops, perm, put_element);
133 first_dis_v += base::_gs.ownership_by_variant[
variant].dis_size();
141 iter = base::_domains.begin(),
142 last = base::_domains.end();
143 iter != last; ++iter) {
145 (*iter).put (ops, *
this);
155 base::_node.dump (
name +
"-node");
field::size_type size_type
static tag_type get_new_tag()
returns a new tag
geo_element_hack::size_type size_type
reference_element::size_type size_type
sequential mesh representation
odiststream: see the diststream page for the full documentation
static size_type io_proc()
static const variant_type max_variant
static variant_type last_variant_by_dimension(size_type dim)
static variant_type first_variant_by_dimension(size_type dim)
static const variant_type p
#define fatal_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format dump
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color rheo
size_type dis_nnod(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
This file is part of Rheolef.
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
point output helper, with rounding feature