コード例 #1
0
ファイル: LocatedAgent.java プロジェクト: kalden/eGUT
  /**
   * \brief Mutual shoving : The movement by shoving of an agent is calculated based on the cell
   * overlap and added to the agents movement vector.
   *
   * <p>Mutual shoving : The movement by shoving of an agent is calculated based on the cell overlap
   * and added to the agents movement vector. Both agents are moved of half the overlapping distance
   * in opposite directions.
   *
   * @param aNeighbour Reference to the potentially shoving neighbour
   * @param isMutual Whether movement is shared between two agents or applied only to this one
   * @param gain Double noting change in position
   * @return Boolean stating whether shoving is detected (true) or not (false)
   */
  public boolean addPushMovement(LocatedAgent aNeighbour, boolean isMutual, double gain) {
    double d, distance;

    if (aNeighbour == this) return false;

    // Build the escape vector and find the distance between you and your
    // neighbourhood
    d = computeDifferenceVector(_location, aNeighbour._location);

    _diff.normalizeVector();

    // Compute effective cell-cell distance
    distance = getShoveRadius() + aNeighbour.getShoveRadius();
    distance += getSpeciesParam().shoveLimit;
    distance = d - distance;

    /* Apply shoving _________________________________________________ */

    // Compute shoving distance for the current agent
    if (distance <= 0) {
      if (isMutual) {
        _diff.times(gain * 0.5 * Math.abs(distance));
        this._movement.add(_diff);
        aNeighbour._movement.subtract(_diff);
      } else {
        _diff.times(Math.abs(gain * distance));
        this._movement.add(_diff);
      }
      return true;
    } else {
      return false;
    }
  }
コード例 #2
0
ファイル: LocatedAgent.java プロジェクト: kalden/eGUT
  /**
   * \brief Pulling : The movement of agents by a shrinking biofilm. Move calculated and added to
   * the agents movement vector.
   *
   * <p>The movement of agents by a shrinking biofilm. Move calculated and added to the agents
   * movement vector.
   *
   * @param aNeighbor Reference to the potentially shoving neighbour
   * @param isMutual Whether movement is shared between two agents or applied only to this one
   * @param gain Double noting change in position
   * @return Boolean stating whether pulling is detected (true) or not (false)
   */
  public boolean addSpringMovement(LocatedAgent aNeighbor, boolean isMutual, double gain) {
    double d, distance, delta;

    if (aNeighbor == this) return false;

    // Build the escape vector and find the distance between you and your
    // neighbourhood
    d = computeDifferenceVector(_location, aNeighbor._location);

    _diff.normalizeVector();

    distance = getShoveRadius() + aNeighbor.getShoveRadius();
    distance += getSpeciesParam().shoveLimit;

    delta = d - distance;
    double lMax = _totalRadius;

    if (delta > 0) gain *= Math.exp(-delta * 5 / (lMax));
    if (delta > lMax) gain = 0;

    /* Apply shoving _________________________________________________ */

    if (isMutual) {
      _diff.times(-0.5 * delta * gain);
      this._movement.add(_diff);
      aNeighbor._movement.subtract(_diff);
    } else {
      _diff.times(-delta * gain);
      this._movement.add(_diff);
    }

    return (_movement.norm() > _radius * gain);
  }
コード例 #3
0
ファイル: LocatedAgent.java プロジェクト: kalden/eGUT
  /**
   * \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);
    }
  }
コード例 #4
0
ファイル: LocatedAgent.java プロジェクト: kalden/eGUT
 /**
  * \brief Return the shoving interaction distance to be used in shoving against a specified agent
  *
  * <p>Return the shoving interaction distance to be used in shoving against a specified agent
  *
  * @return Double specifying the shoving interaction distance that will be applied
  */
 public double getInteractDistance(LocatedAgent baby) {
   return getShoveRadius() + baby.getShoveRadius() + ((LocatedParam) _speciesParam).shoveLimit;
 }