/** * \brief Examines all the agents within a voxel of the agent-grid, to determine if a swimming * agent is in contact with an agent in the biofilm * * <p>To determine if a swimming cell is near contact with the biofilm surface, the agent checks * the status of the agent grid voxel it resides within. If this is 1, this is noted as having * agents within it that are within the biofilm structure. The agent now examines how close it is * to each of these agents. If within a certain distance (radius + stickiness constant), then the * agent is deemed to have adhered to the structure. Any overlap will be addressed during shoving * analysis. If not, the agent will perform another move. * * @author Kieran Alden * @param gridIndex The index of the agent grid to be checked * @param distanceSeekingAgent The distance within which two cells are deemed to be in contact * @return Boolean noting whether the agent is in contact with an agent in the biofilm */ public Boolean isAgentInContactWithAgentInBiofilm(int gridIndex, double distanceSeekingAgent) { LocatedGroup agentsInGrid = currentSimulator.agentGrid.returnGroupInVoxel(gridIndex); Double dist = 0.0; // Now iterate through each one. If we're close enough, move done. // Shoving can then sort out distance between the two cells. for (LocatedAgent aLoc : agentsInGrid.group) dist = aLoc.getLocation().distance(swimmingAgentPosition); if (dist <= distanceSeekingAgent) return true; // If not, we'll do another move. return false; }
/** * \brief Find a sibling of this agent * * <p>Find a sibling of this agent * * @param indexSpecies The index used to reference this species in the simulation dictionary */ public void findCloseSiblings(int indexSpecies) { int nNb; boolean test; double shoveDist; LocatedAgent aNb; getPotentialShovers(getInteractDistance()); nNb = _myNeighbors.size(); for (int iNb = 0; iNb < nNb; iNb++) { aNb = _myNeighbors.removeFirst(); // test EPS-species test = (indexSpecies == aNb.speciesIndex); // Test distance shoveDist = 2 * (getShoveRadius() + aNb.getShoveRadius()); test = test && computeDifferenceVector(_location, aNb.getLocation()) <= shoveDist; if (test & aNb != this) _myNeighbors.addLast(aNb); } }