MCPcopy Create free account
hub / github.com/davidrmiller/biosim4 / queueForMove

Method queueForMove

src/peeps.cpp:59–68  ·  view source on GitHub ↗

Safe to call during multithread mode. Indiv won't move until end of sim step when drainMoveQueue() is called. Should only be called for living agents. It's ok if multiple agents are queued to move to the same location; only the first one will actually get moved.

Source from the content-addressed store, hash-verified

57// for living agents. It's ok if multiple agents are queued to move
58// to the same location; only the first one will actually get moved.
59void Peeps::queueForMove(const Indiv &indiv, Coord newLoc)
60{
61 assert(indiv.alive);
62
63 #pragma omp critical
64 {
65 auto record = std::make_pair<uint16_t, Coord>(uint16_t(indiv.index), Coord(newLoc));
66 moveQueue.push_back(record);
67 }
68}
69
70
71// Called in single-thread mode at end of sim step. This executes all the

Callers 1

executeActionsFunction · 0.80

Calls 1

CoordClass · 0.85

Tested by

no test coverage detected