public FieldVariable1Dimensional(ModelOutput parent) { _parent = parent; var d1 = _parent.Dimensions.GetDimension <D1>(); _values = new JaggedArrayWrapper <T>(d1.Count); ControlledConstructor(d1.Count, false); }
public FieldVariable1DimensionalTime(ModelOutput parent) { _parent = parent; _currentYear = Timestep.FromSimulationYear(-1); // TODO Change this to properly find out how many years the model run will have _values = new JaggedArrayWrapper <T>(_parent.Clock.Timestepcount); ControlledConstructor(_parent.Clock.Timestepcount, false); }
public void CopyTo(JaggedArrayWrapper <T> array) { if (_count != array._count) { throw new ArgumentOutOfRangeException("Arrays need to have same length"); } int requiredBuckets = (array._count / _limitValue) + 1; for (int i = 0; i < requiredBuckets - 1; i++) { Array.Copy(_values[i], array._values[i], _limitValue); } int countOfFinalBucket = _count % _limitValue; Array.Copy(_values[requiredBuckets - 1], array._values[requiredBuckets - 1], countOfFinalBucket); }
public JaggedArrayWrapper(JaggedArrayWrapper <T> values) { int requiredBuckets = (values._count / _limitValue) + 1; _values = new T[requiredBuckets][]; for (int i = 0; i < requiredBuckets - 1; i++) { _values[i] = new T[_limitValue]; Array.Copy(values._values[i], _values[i], _limitValue); } int countOfFinalBucket = values._count % _limitValue; _values[requiredBuckets - 1] = new T[countOfFinalBucket]; Array.Copy(values._values[requiredBuckets - 1], _values[requiredBuckets - 1], countOfFinalBucket); _count = values._count; }
public JaggedArrayWrapper <T> GetRandomValues(Random rand) { if (_cachedConstantValues == null) { JaggedArrayWrapper <T> values = new JaggedArrayWrapper <T>(_value.Length); for (int i = 0; i < _value.Length; i++) { values[i] = _value[i].GetRandomValue(rand); } return(values); } else { return(_cachedConstantValues); } }
public ParameterOneDimensional(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(); } }
public FieldParameter1DimensionalTime(ModelOutput parent, ParameterValue1Dimensional <T> values) { _parent = parent; _values = values.GetPointerToData(); }
public void CopyTo(JaggedArrayWrapper <T> array) { _values.CopyTo(array); }
public ParameterValue1Dimensional(string name, int id, JaggedArrayWrapper <T> values) : base(name, id) { _values = new JaggedArrayWrapper <T>(values); }