/** * \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; }
/** * \brief Create a new agent in a specified position * * <p>Create a new agent in a specified position * * @param position Vector stating where this agent should be located */ public void createNewAgent(ContinuousVector position) { try { // Get a clone of the progenitor LocatedAgent baby = (LocatedAgent) sendNewAgent(); baby.giveName(); // randomize its mass baby.mutatePop(); baby.updateSize(); this._myDivRadius = getDivRadius(); baby._myDivRadius = getDivRadius(); baby._myDeathRadius = getDeathRadius(); // Just to avoid to be in the carrier position.x += this._totalRadius; baby.setLocation(position); baby.registerBirth(); } catch (CloneNotSupportedException e) { utils.LogFile.writeLog("Error met in LocAgent:createNewAgent()"); } }