Exemplo n.º 1
0
        public static Vector3d GetVectorPlaneFromEdx(string edx, FaceDirection dir, int location)
        {
            Dictionary <string, string> outputKeys = GetOutputKeys(edx);

            List <double> sequenceX = outputKeys["spacing_x"].Split(',')
                                      .ToList().ConvertAll(v => Convert.ToDouble(v));
            List <double> sequenceY = outputKeys["spacing_y"].Split(',')
                                      .ToList().ConvertAll(v => Convert.ToDouble(v));
            List <double> sequenceZ = outputKeys["spacing_z"].Split(',')
                                      .ToList().ConvertAll(v => Convert.ToDouble(v));

            List <double> accumulateX = Util.Accumulate(sequenceX).ToList();
            List <double> accumulateY = Util.Accumulate(sequenceY).ToList();
            List <double> positionZ   = Util.Accumulate(sequenceZ).ToList().Zip(sequenceZ, (a, b) => a - (b / 2)).ToList();

            if (dir == FaceDirection.X)
            {
                return(new Vector3d(accumulateX[location], 0, 0));
            }
            else if (dir == FaceDirection.Y)
            {
                return(new Vector3d(0, accumulateY[location], 0));
            }
            else
            {
                return(new Vector3d(0, 0, positionZ[location]));
            }
        }
Exemplo n.º 2
0
        public void CalculateHeight()
        {
            if (CombineGridType && Telescope > 0.0)
            {
                Sequence = GetTelescopeEqSeqZ(Telescope, StartTelescopeHeight);
            }
            else if (CombineGridType == false && Telescope > 0.0)
            {
                Sequence = GetTelescopeSeqZ(Telescope, StartTelescopeHeight);
            }
            else
            {
                Sequence = GetEquidistantSeqZ();
            }

            Accumulated = Util.Accumulate(Sequence)
                          .ToArray();
            Height = Accumulated.Zip(Sequence, (a, b) => a - (b / 2))
                     .ToArray();
        }
Exemplo n.º 3
0
        private void SetSequenceAndExtension()
        {
            if (CombineGridType && Telescope > 0.0)
            {
                SequenceZ = GetCombinedSequence(Telescope, StartTelescopeHeight);
            }
            else if (CombineGridType == false && Telescope > 0.0)
            {
                SequenceZ = GetTelescopeSequence(Telescope, StartTelescopeHeight);
            }
            else
            {
                SequenceZ = GetEquidistantSequence();
            }

            var accumulated = Util.Accumulate(SequenceZ)
                              .ToArray();

            Zaxis = accumulated.Zip(SequenceZ, (a, b) => a - (b / 2))
                    .ToArray();
        }
Exemplo n.º 4
0
    // update
    public override void Update()
    {
        double TotalDltNSenescedRetrans = 0;

        foreach (Organ1 Organ in Plant.Organ1s)
        {
            TotalDltNSenescedRetrans += Organ.DltNSenescedRetrans;
        }

        Growth.StructuralN -= dlt_n_senesced_trans;
        Growth.StructuralN -= TotalDltNSenescedRetrans;

        Live = Live + Growth - Senescing;

        Dead             = Dead - Detaching + Senescing;
        Live             = Live + Retranslocation;
        Live.StructuralN = Live.N + dlt_n_senesced_retrans;

        Biomass dying = Live * Population.DyingFractionPlants;

        Live      = Live - dying;
        Dead      = Dead + dying;
        Senescing = Senescing + dying;

        Util.Debug("Leaf.Green.Wt=%f", Live.Wt);
        Util.Debug("Leaf.Green.N=%f", Live.N);
        Util.Debug("Leaf.Senesced.Wt=%f", Dead.Wt);
        Util.Debug("Leaf.Senesced.N=%f", Dead.N);
        Util.Debug("Leaf.Senescing.Wt=%f", Senescing.Wt);
        Util.Debug("Leaf.Senescing.N=%f", Senescing.N);

        double node_no = 1.0 + NodeNo;

        double dlt_leaf_area = dltLAI * Conversions.sm2smm;

        Util.Accumulate(dlt_leaf_area, LeafArea, node_no - 1.0, dltNodeNo);

        // Area senescence is calculated apart from plant number death
        // so any decrease in plant number will mean an increase in average
        // plant size as far as the leaf size record is concerned.

        // NIH - Don't think this is needed anymore because death goes into SLAI not TLAI_dead now
        //if ((plant->population().Density() /*+ g_dlt_plants*/)<=0.0)   //XXXX FIXME!!
        //    {
        //    fill_real_array(gLeafArea, 0.0, max_node);
        //    }

        Util.Accumulate(dltLeafNo, LeafNo, node_no - 1.0f, dltNodeNo);

        double leaf_no_sen_tot = MathUtility.Sum(LeafNoSen) + dltLeafNoSen;

        for (int node = 0; node < max_node; node++)
        {
            if (leaf_no_sen_tot > LeafNo[node])
            {
                leaf_no_sen_tot -= LeafNo[node];
                LeafNoSen[node]  = LeafNo[node];
            }
            else
            {
                LeafNoSen[node] = leaf_no_sen_tot;
                leaf_no_sen_tot = 0.0;
            }
        }
        NodeNo += dltNodeNo;

        // transfer plant leaf area
        _LAI  += dltLAI - dltSLAI;
        _SLAI += dltSLAI - dltSLAI_detached;

        // Transfer dead leaf areas
        double dying_fract_plants = Population.DyingFractionPlants;

        double dlt_lai_dead = LAI * dying_fract_plants;

        _LAI  -= dlt_lai_dead;
        _SLAI += dlt_lai_dead;

        Util.Debug("leaf.LeafNo=%f", MathUtility.Sum(LeafNo));
        Util.Debug("leaf.LeafNoSen=%f", MathUtility.Sum(LeafNoSen));
        Util.Debug("leaf.NodeNo=%f", NodeNo);
        Util.Debug("leaf.LAI=%f", _LAI);
        Util.Debug("leaf.SLAI=%f", _SLAI);
    }
Exemplo n.º 5
0
 protected void Setsequence(Dictionary <string, string> outputKeys)
 {
     _sequenceX = Util.Accumulate(_spacingX).ToList();
     _sequenceY = Util.Accumulate(_spacingY).ToList();
     _sequenceZ = Util.Accumulate(_spacingZ).ToList();
 }