Exemplo n.º 1
0
 public SimpleFireballField(
     FireballFieldType type,
     CoordinateSystem system,
     SimpleFireballFieldFunction function
     ) : this(type, system)
 {
     SetValues(function);
 }
Exemplo n.º 2
0
 private void AssertValidFunction(
     SimpleFireballFieldFunction function
     )
 {
     if (function == null)
     {
         throw new InvalidFireballFieldFunctionException();
     }
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 5
0
        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() + ".");
        }