Exemple #1
0
 public void LoadData()
 {
     BinaryHelpers.ExecuteReader(this, (reader) =>
     {
         var matrix = new EmmeMatrix(reader);
         if (matrix.Dimensions != 2)
         {
             throw new XTMFRuntimeException(this, "In '" + Name + "' the matrix loaded in from '" + MatrixFile + "' was not an OD binary matrix!");
         }
         Data   = SparseTwinIndex <float> .CreateSquareTwinIndex(matrix.Indexes[0], matrix.Indexes[1], matrix.FloatData);
         Loaded = true;
     }, MatrixFile);
 }
 private static void CopyMatrix(IZone[] zones, string origin, string destination)
 {
     try
     {
         BinaryHelpers.ExecuteReader((reader =>
         {
             var matrix = new EmmeMatrix(reader);
             SaveData.SaveMatrix(zones, matrix.FloatData, destination);
         }), origin);
     }
     catch (IOException)
     {
     }
 }
            internal void Execute(int iteration)
            {
                BinaryHelpers.ExecuteReader(this, (reader) =>
                {
                    EmmeMatrix matrix = new EmmeMatrix(reader);
                    switch (matrix.Type)
                    {
                    case EmmeMatrix.DataType.Float:
                        ProcessData(matrix.FloatData, iteration);
                        break;

                    default:
                        throw new XTMFRuntimeException(this, "In '" + Name + "' the data type for the file '" + DemandMatrix + "' was not float!");
                    }
                }, DemandMatrix);
            }
 private void LoadFriction(float[] ret)
 {
     try
     {
         BinaryHelpers.ExecuteReader(this, reader =>
         {
             for (int i = 0; i < ret.Length; i++)
             {
                 ret[i] = reader.ReadSingle();
             }
         }, GetFrictionFileName(LoadFrictionFileName));
     }
     catch (IOException e)
     {
         throw new XTMFRuntimeException(this, "Unable to load distribution cache file!\r\n" + e.Message);
     }
 }
Exemple #5
0
        private List <TreeData <float[][]> > LoadData()
        {
            var tree = TMG.Functions.MirrorModeTree.CreateMirroredTree <float[][]>(this.Root.Modes);

            try
            {
                BinaryHelpers.ExecuteReader((reader) =>
                {
                    foreach (var t in tree)
                    {
                        LoadData(t, reader);
                    }
                }, this.ResultCacheFile);
            }
            catch (IOException e)
            {
                throw new XTMFRuntimeException(e.Message);
            }
            return(tree);
        }
        private static void CopySummedMatrix(IZone[] zones, string[] origins, string destination)
        {
            var array = new float[zones.Length * zones.Length];

            try
            {
                for (int i = 0; i < origins.Length; i++)
                {
                    BinaryHelpers.ExecuteReader((reader =>
                    {
                        var matrix = new EmmeMatrix(reader);
                        AddToArray(array, matrix.FloatData);
                    }), origins[i]);
                }
                SaveData.SaveMatrix(zones, array, destination);
            }
            catch (IOException)
            {
            }
        }
Exemple #7
0
 private void LoadFriction(float[][] ret, int setNumber)
 {
     try
     {
         BinaryHelpers.ExecuteReader((reader) =>
         {
             for (int i = 0; i < ret.Length; i++)
             {
                 var row = ret[i];
                 for (int j = 0; j < row.Length; j++)
                 {
                     row[j] = reader.ReadSingle();
                 }
             }
         }, GetFrictionFileName(this.LoadFrictionFileName, setNumber));
     }
     catch (IOException e)
     {
         throw new XTMFRuntimeException("Unable to load distribution cache file!\r\n" + e.Message);
     }
 }
Exemple #8
0
        private List <TreeData <float[][]> > LoadData()
        {
            var tree = MirrorModeTree.CreateMirroredTree <float[][]>(Root.Modes);

            try
            {
                BinaryHelpers.ExecuteReader(this, reader =>
                {
                    // ReSharper disable once UnusedVariable
                    foreach (var t in tree)
                    {
                        LoadData(reader);
                    }
                }, ResultCacheFile);
            }
            catch (IOException e)
            {
                throw new XTMFRuntimeException(this, e.Message);
            }
            return(tree);
        }