Example #1
0
        private void OnStartOfSimulation(object sender, EventArgs e)
        {
            // Create a new nutrient patch.
            var newPatch = new NutrientPatch(soilPhysical.Thickness, this);

            newPatch.CreationDate = clock.Today;
            newPatch.Name         = "base";
            patches.Add(newPatch);
            Structure.Add(newPatch.Nutrient, this);
        }
Example #2
0
        /// <summary>
        /// Clone an existing patch. That is, creates a new patch (k) based on an existing one (j)
        /// </summary>
        /// <param name="j">id of patch to be cloned</param>
        private void ClonePatch(int j)
        {
            // create new patch
            var newPatch = new NutrientPatch(patches[j]);

            patches.Add(newPatch);
            //int k = patches.Count - 1;

            //// copy the state variables from original patch in to the new one
            //patches[k].SetSolutes(patches[j]);
        }
Example #3
0
        /// <summary>Copy constructor.</summary>
        public NutrientPatch(NutrientPatch from)
        {
            soilThickness = from.soilThickness;
            patchManager  = from.patchManager;
            Nutrient      = Apsim.Clone(from.Nutrient) as Nutrient;
            Structure.Add(Nutrient, from.Nutrient.Parent);

            // Find all solutes.
            foreach (ISolute solute in Nutrient.FindAllChildren <ISolute>())
            {
                solutes.Add(solute.Name, solute);
            }
            lignin       = from.lignin;
            cellulose    = from.cellulose;
            carbohydrate = from.carbohydrate;
        }