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;
56 check_macro (format[
iorheo::rheo],
"geo distributed: unsupported geo output file format=" << format);
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,
90 _point_put<T>(base::_dimension));
92 base::_node.permuted_put_values (ops,
94 _round_point_put<T>(base::_dimension, rounding_prec));
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());
124 geo_element_permuted_put put_element (node_perm);
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();
140 for (
typename std::vector<domain_indirect_basic<distributed> >::const_iterator
141 iter = base::_domains.begin(),
142 last = base::_domains.end();
143 iter != last; ++iter) {
145 (*iter).put (ops, *
this);
153 fatal_macro (
"dump: not yet");
155 base::_node.dump (
name +
"-node");
162 template class geo_rep<Float,distributed>;
void put(idiststream &in, odiststream &out, bool do_proj, bool do_lumped_mass, bool def_fill_opt, size_type extract_id, const Float &scale_value, const std::pair< Float, Float > &u_range, render_type render)
field::size_type size_type
static tag_type get_new_tag()
returns a new tag
reference_element::size_type size_type
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
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.