public SimpleFireballField( FireballFieldType type, CoordinateSystem system, SimpleFireballFieldFunction function ) : this(type, system) { SetValues(function); }
private void AssertValidFunction( SimpleFireballFieldFunction function ) { if (function == null) { throw new InvalidFireballFieldFunctionException(); } }
public void SetValues( SimpleFireballFieldFunction function ) { AssertValidFunction(function); for (int i = 0; i < XDimension; i++) { for (int j = 0; j < YDimension; j++) { Values[i, j] = function(i, j); } } }
/******************************************************************************************** * Public members, functions and properties ********************************************************************************************/ public void Advance( double newTime, double qgpConductivity ) { if (Math.Abs(newTime - CurrentTime) >= UpdateInterval) { SimpleFireballFieldFunction function = (x, y) => FieldFunction( newTime, System.XAxis[x], System.YAxis[y], qgpConductivity); SetValues(function); CurrentTime = newTime; } }
private void AssertThrowsWhenGivenParams( Type exceptionType, FireballFieldType fireballFieldType, SimpleFireballFieldFunction function ) { bool threwException = false; try { new SimpleFireballField(fireballFieldType, CoordinateSystem, function); } catch (Exception ex) { Assert.IsInstanceOfType(ex, exceptionType); threwException = true; } Assert.IsTrue(threwException, "No Exception was thrown, expected: " + exceptionType.ToString() + "."); }