Esempio n. 1
0
  /**
   * \brief On agent division, divides the mass between the old and new agent, at a specified
   * fraction
   *
   * <p>On agent division, divides the mass between the old and new agent, at a specified fraction
   *
   * @param baby The new agent, which is inheriting mass
   * @param babyMassFrac The fraction of this agents mass that should be transferred to the new
   *     agent
   */
  public void divideCompounds(LocatedAgent baby, double babyMassFrac) {
    // Choose the division plan and apply position modifications
    for (int i = 0; i < particleMass.length; i++) {
      baby.particleMass[i] *= babyMassFrac;
      this.particleMass[i] *= 1 - babyMassFrac;
    }

    // Update radius, mass, volumes and growth rates
    updateSize();
    baby.updateSize();

    updateGrowthRates();
    baby.updateGrowthRates();
  }