Ejemplo n.º 1
0
  /**
   * \brief With it determined that cell division will occur, create a new agent from the existing
   * one
   *
   * <p>With it determined that cell division will occur, create a new agent from the existing one
   *
   * @throws CloneNotSupportedException Thrown if the agent cannot be cloned
   */
  public void makeKid() throws CloneNotSupportedException {

    // Create the new instance
    LocatedAgent baby = (LocatedAgent) sendNewAgent();
    // Note that mutateAgent() does nothing yet
    baby.mutateAgent();

    this._myDivRadius = getDivRadius();
    baby._myDivRadius = getDivRadius();
    baby._myDeathRadius = getDeathRadius();

    // Update the lineage
    recordGenealogy(baby);

    // Share mass of all compounds between two daughter cells and compute
    // new size
    divideCompounds(baby, getBabyMassFrac());
    // sonia:chemostat
    if (Simulator.isChemostat) {
      // upon division the daughter cells remain with the coordinates of their progenitor

    } else {
      // Compute movement to apply to both cells
      setDivisionDirection(getInteractDistance(baby) / 2);

      // move both daughter cells
      baby._movement.subtract(_divisionDirection);
      _movement.add(_divisionDirection);
    }
    // Now register the agent inside the guilds and the agent grid
    baby.registerBirth();
    baby._netVolumeRate = 0;
  }
Ejemplo n.º 2
0
  /**
   * \brief For self-attachment scenarios, calculates the new position of the agent based on XY and
   * XZ angles and a distance to move
   *
   * <p>For self-attachment scenarios, calculates the new position of the agent based on XY and XZ
   * angles and a distance to move. No return value as the global swimmingAgentPosition is altered.
   * The angles XY and XZ are also global parameters as these can also be altered by other methods
   * in the swimming agent position checks
   *
   * @param distanceAgentMoves Distance that the agent is to move
   */
  public void calculateNewAgentPosition(Double distanceAgentMoves) {
    // Now calculate where this angle would place the agent.
    swimMovement.set(
        Math.cos(angleOfMovingAgentXY) * Math.cos(angleOfMovingAgentXZ),
        Math.sin(angleOfMovingAgentXY),
        Math.sin(angleOfMovingAgentXZ));

    swimMovement.times(distanceAgentMoves);

    swimmingAgentPosition.add(swimMovement);
  }
Ejemplo n.º 3
0
  /**
   * \brief Used by the move method to determine if an agents move crosses any of the domain's
   * boundaries
   *
   * <p>Used by the move method to determine if an agents move crosses any of the domain's
   * boundaries
   */
  public void checkBoundaries() {
    // Search a boundary which will be crossed
    _newLoc.set(_location);
    _newLoc.add(_movement);
    AllBC aBoundary = getDomain().testCrossedBoundary(_newLoc);
    int nDim = (_agentGrid.is3D ? 3 : 2);
    boolean test = (aBoundary != null);
    int counter = 0;

    // Test all boundaries and apply corrections according to crossed
    // boundaries
    while (test) {
      counter++;
      aBoundary.applyBoundary(this, _newLoc);
      aBoundary = getDomain().testCrossedBoundary(_newLoc);

      test = (aBoundary != null) | (counter > nDim);
      if (counter > nDim) System.out.println("LocatedAgent.move() : problem!");
    }
  }