SHARE
TWEET

Untitled

a guest Jul 17th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    Path * paths = new Path[shortRequests.size()];
  2.    entity_id_t * notifies = new entity_id_t[shortRequests.size()];
  3.    u32 * tickets = new u32[shortRequests.size()];
  4.    
  5.    #pragma omp parallel default(none) shared(shortRequests, paths, notifies, tickets) private(j) num_threads(2)
  6.    {
  7.       #pragma omp for
  8.          for (j = 0; j < (unsigned int) shortRequests.size(); ++j)
  9.          {
  10.             const AsyncShortPathRequest& req = shortRequests[j];
  11.             Path path;
  12.             ControlGroupObstructionFilter filter(req.avoidMovingUnits, req.group);
  13.             ComputeShortPath(filter, req.x0, req.z0, req.r, req.range, req.goal, req.passClass, path);
  14.            
  15.             paths[j] = path; //saving the results to an array for later
  16.             notifies[j] = req.notify;
  17.             tickets[j] = req.ticket;
  18.          }
  19.    }
  20.    
  21.    for (size_t i = 0; i < shortRequests.size(); i++) {
  22.       CMessagePathResult msg(tickets[i], paths[i]);
  23.       GetSimContext().GetComponentManager().PostMessage(notifies[i], msg);
  24.    }
  25.  
  26.    delete [] paths;
  27.    delete [] notifies;
  28.    delete [] tickets;
RAW Paste Data
Top