示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is Robin))
            {
                throw new RrdException("Cannot copy Robin object to " + other.ToString());
            }
            Robin robin    = (Robin)other;
            int   rowsDiff = rows - robin.rows;

            if (rowsDiff == 0)
            {
                // Identical dimensions. Do copy in BULK to speed things up
                robin.pointer.Set(pointer.Get());
                robin.values.WriteBytes(values.ReadBytes());
            }
            else
            {
                // different sizes
                for (int i = 0; i < robin.rows; i++)
                {
                    int j = i + rowsDiff;
                    robin.Store(j >= 0? GetValue(j): Double.NaN);
                }
            }
        }
示例#2
0
        private void FinalizeStep(ArcState state, Robin robin)
        {
            // should store
            long   arcSteps = steps.Get();
            double arcXff   = xff.Get();
            long   nanSteps = state.NanSteps;
            //double nanPct = (double) nanSteps / (double) arcSteps;
            double accumValue = state.AccumValue;

            if (nanSteps <= arcXff * arcSteps && !Double.IsNaN(accumValue))
            {
                if (consolFun.Get().Equals("AVERAGE"))
                {
                    accumValue /= (arcSteps - nanSteps);
                }
                robin.Store(accumValue);
            }
            else
            {
                robin.Store(Double.NaN);
            }
            state.AccumValue = Double.NaN;
            state.NanSteps   = 0;
        }