1 
2 //  Copyright (c) 2012 Thomas Heller
3 //
4 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
5 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #include <hpx/hpx.hpp>
8 #include <hpx/lcos/wait_all.hpp>
9 #include <hpx/include/iostreams.hpp>
10 
11 #include <cstddef>
12 #include <vector>
13 
14 #include "grid.hpp"
15 #include "row.hpp"
16 
17 namespace jacobi
18 {
grid(std::size_t nx,std::size_t ny,double value)19     grid::grid(std::size_t nx, std::size_t ny, double value)
20         //: rows(ny)
21     {
22         std::vector<hpx::id_type> ids = hpx::new_<server::row[]>(
23             hpx::default_layout(hpx::find_all_localities()), ny).get();
24 
25         rows.reserve(ny);
26         std::vector<hpx::lcos::future<void> > init_futures;
27         init_futures.reserve(ny);
28         for (hpx::naming::id_type const& id : ids)
29         {
30             row r; r.id = id;
31             init_futures.push_back(r.init(nx, value));
32             rows.push_back(r);
33         }
34 
35         hpx::wait_all(init_futures);
36     }
37 }
38