Advertisement
Guest User

Untitled

a guest
Mar 14th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. void bulk_function(hpx::lcos::spmd_block block,
  2.                    hpx::partitioned_vector<double> data,
  3.                    size_t global_nx,
  4.                    size_t global_ny,
  5.                    size_t ngc) {
  6.  
  7.    
  8.     using view_2d = hpx::partitioned_vector_view<double,2>;
  9.  
  10.     //pad with barriers (ngc on both ends)
  11.     std::size_t NX = global_nx + 2*ngc;
  12.     std::size_t NY = global_ny + 2*ngc;
  13.  
  14.    
  15.     view_2d v2d(block, data.begin(), data.end(), {NX, NY});
  16.     view_2d subview(block,&v2d(0,0),&v2d(3,3),{3,3},{NX,NY});
  17.  
  18.     if (block.this_image() == 0) {
  19.  
  20.         /*
  21.         error: no match for ‘operator=’ (operand types are
  22.         ‘hpx::detail::view_element<double, std::vector<double> >’ and ‘double’)
  23.         */
  24.         v2d(0,0) = double(43.0); //this doesnt compile
  25.         //subview(0,0) = double(3.0); //this doesnt compile
  26.        
  27.         //subview(0,0) = std::vector<double>{3.0, 1.0}; //this compiles
  28.  
  29.     }
  30.  
  31.  
  32.     block.sync_all();
  33.    
  34. }
  35. HPX_PLAIN_ACTION(bulk_function, bulk_action);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement