Ejemplo n.º 1
0
        public FieldVariable2DimensionalTime(ModelOutput parent)
        {
            _parent      = parent;
            _currentYear = Timestep.FromSimulationYear(-1);

            var d2 = _parent.Dimensions.GetDimension <D2>();

            _values = new JaggedArrayWrapper2 <T>(_parent.Clock.Timestepcount, d2.Count);

            ControlledConstructor(_parent.Clock.Timestepcount, d2.Count, false);
        }
Ejemplo n.º 2
0
        public FieldVariable2Dimensional(ModelOutput parent)
        {
            _parent = parent;

            var d1 = _parent.Dimensions.GetDimension <D1>();
            var d2 = _parent.Dimensions.GetDimension <D2>();

            _values = new JaggedArrayWrapper2 <T>(d1.Count, d2.Count);

            ControlledConstructor(d1.Count, d2.Count, false);
        }
Ejemplo n.º 3
0
        public JaggedArrayWrapper2(JaggedArrayWrapper2 <T> values)
        {
            int count0 = values.Length0;
            int count1 = values.Length1;

            _values = new T[count0][];

            for (int i = 0; i < count0; i++)
            {
                _values[i] = new T[count1];
                Array.Copy(values._values[i], _values[i], count1);
            }
        }
Ejemplo n.º 4
0
        public void CopyTo(JaggedArrayWrapper2 <T> array)
        {
            if (Length0 != array.Length0 || Length1 != array.Length1)
            {
                throw new ArgumentOutOfRangeException("Arrays need to have same length");
            }

            int count0 = Length0;
            int count1 = Length1;


            for (int i = 0; i < count0; i++)
            {
                Array.Copy(_values[i], array._values[i], count1);
            }
        }
Ejemplo n.º 5
0
        public Parameter2Dimensional(string name, int id, ParameterElement <T>[,] value)
            : base(name, id)
        {
            _value = value;

            bool uncertain = false;

            foreach (var e in GetAllElements())
            {
                if (!(e is ParameterElementConstant <T>))
                {
                    uncertain = true;
                }
            }

            if (!uncertain)
            {
                _cachedConstantValues = GetBestGuessValues();
            }
        }
Ejemplo n.º 6
0
        public JaggedArrayWrapper2 <T> GetRandomValues(Random rand)
        {
            if (_cachedConstantValues == null)
            {
                int l0 = _value.GetLength(0);
                int l1 = _value.GetLength(1);

                JaggedArrayWrapper2 <T> values = new JaggedArrayWrapper2 <T>(l0, l1);

                for (int i = 0; i < l0; i++)
                {
                    for (int l = 0; l < l1; l++)
                    {
                        values[i, l] = _value[i, l].GetRandomValue(rand);
                    }
                }

                return(values);
            }
            else
            {
                return(_cachedConstantValues);
            }
        }
 public FieldParameter2DimensionalTime(ModelOutput parent, ParameterValue2Dimensional <T> values)
 {
     _parent = parent;
     _values = values.GetPointerToData();
 }
Ejemplo n.º 8
0
 public void CopyTo(JaggedArrayWrapper2 <T> array)
 {
     _values.CopyTo(array);
 }
Ejemplo n.º 9
0
 public ParameterValue2Dimensional(string name, int id, JaggedArrayWrapper2 <T> values)
     : base(name, id)
 {
     _values = new JaggedArrayWrapper2 <T>(values);
 }