~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to skit/plib2/mpi_scatter_end.h

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
END:
43
43
*/
44
44
 
45
 
 
46
 
template <
47
 
    class InputIterator, 
48
 
    class OutputIterator, 
49
 
    class SetOp, 
50
 
    class Container,
51
 
    class Tag,
52
 
    class Comm>
53
 
void
54
 
mpi_scatter_end(
55
 
    InputIterator                       x,
56
 
    OutputIterator                      y,
57
 
    scatter_message<Container>&         from,
58
 
    scatter_message<Container>&         to,
59
 
    SetOp                               op,
60
 
    Tag                                 tag,
61
 
    Comm                                comm)
62
 
{
63
 
    error_macro ("undefined scatter for " << typename_macro(Container));
64
 
}
65
45
//<mpi_scatter_end:
66
46
template <
67
47
    class InputIterator, 
68
48
    class OutputIterator, 
 
49
    class Message,
69
50
    class SetOp, 
70
 
    class T,
71
51
    class Tag,
72
52
    class Comm>
73
53
void
74
54
mpi_scatter_end(
75
55
    InputIterator                       x,
76
56
    OutputIterator                      y,
77
 
    scatter_message<std::vector<T> >&   from,
78
 
    scatter_message<std::vector<T> >&   to,
 
57
    Message&                            from,
 
58
    Message&                            to,
79
59
    SetOp                               op,
80
60
    Tag                                 tag,
81
61
    Comm                                comm)
82
62
{
 
63
    typedef typename Message::base_value_type data_type; // the data type to be received by mpi
83
64
    typedef boost::transform_iterator<select2nd<size_t,mpi::request>, std::list<std::pair<size_t,mpi::request> >::iterator>
84
65
            request_iterator;
85
66
 
87
68
    // 1) wait on receives and unpack receives into local space
88
69
    // -----------------------------------------------------------
89
70
    while (from.requests.size() != 0) {
90
 
        typedef T data_type; // the data to be received are of type T
91
71
        request_iterator iter_r_waits (from.requests.begin(), select2nd<size_t,mpi::request>()),
92
72
                         last_r_waits (from.requests.end(),   select2nd<size_t,mpi::request>());
93
73
        // waits on any receive...
101
81
        size_t i_msg_size = (size_t)i_msg_size_opt.get();
102
82
        std::list<std::pair<size_t,mpi::request> >::iterator i_pair_ptr = pair_status.second.base();
103
83
        size_t i_receive = (*i_pair_ptr).first;
104
 
        check_macro (i_msg_size == from.starts[i_receive+1] - from.starts[i_receive], "unexpected size");
 
84
        check_macro (i_msg_size == from.starts()[i_receive+1] - from.starts()[i_receive], "unexpected size");
105
85
 
106
86
        // unpack receives into our local space
107
 
        msg_left_permutation_apply (
108
 
            from.values.begin()  + from.starts[i_receive],
109
 
            op,
110
 
            from.indices.begin() + from.starts[i_receive],
111
 
            from.indices.begin() + from.starts[i_receive+1],
112
 
            y);
113
 
 
 
87
        from.store_values (y, i_receive, op);
114
88
        from.requests.erase (i_pair_ptr);
115
89
    }
116
90
    // -----------------------------------------------------------