public static void CreateODC(string fileName, string xmlTemplate, string dataDirectory) { XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo)); TextReader textReader = new StreamReader(xmlTemplate); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader); textReader.Close(); ODCCreator odcCreator = new ODCCreator(info.HighestZone, info.Types, info.Times, info.Gap); foreach (var dimensionInfo in info.CacheInfo) { string fname = Path.Combine(dataDirectory, dimensionInfo.FileName); if (dimensionInfo.Is311) { odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { if (dimensionInfo.SaveInTimes) { odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } } } odcCreator.Save(fileName, false); }
/// <summary>Create a new ODC</summary> /// <param name="times">How many time periods to account for</param> /// <param name="highestZone"></param> /// <param name="types">How many different types of data to store per OD</param> /// <param name="gap"></param> public OdcCreator(int highestZone, int types, int times, int gap) { FilesLoaded = new CacheGenerationInfo(times, types, highestZone, gap); AmmountOfData = types * times; Data = new float[highestZone][][]; HasData = new bool[highestZone][]; Types = types; Times = times; HighestZone = highestZone; }
/// <summary>Create a new ODC</summary> /// <param name="times">How many time periods to account for</param> /// <param name="types">How many different types of data to store per OD</param> public ODCCreator(int highestZone, int types, int times, int gap) { this.FilesLoaded = new CacheGenerationInfo(times, types, highestZone, gap); this.AmmountOfData = types * times; this.Data = new float[highestZone][][]; this.HasData = new bool[highestZone][]; this.Types = types; this.Times = times; this.HighestZone = highestZone; this.Gap = gap; }
public void ReGenerate(string dataDirectory, string outputDirectory) { string fileName = Path.GetFileNameWithoutExtension(FileName); string path = Path.GetDirectoryName(FileName); if (path == null) { throw new IOException($"Unable to find the Directory name of {FileName}!"); } string xmlFile = Path.Combine(path, fileName + ".xml"); XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo)); TextReader textReader = new StreamReader(xmlFile); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader); textReader.Close(); OdcCreator odcCreator = new OdcCreator(HighestZone, Types, Times, Indexes.Length); foreach (var dimensionInfo in info.CacheInfo) { string fname = Path.Combine(dataDirectory, dimensionInfo.FileName); if (dimensionInfo.Is311) { odcCreator.LoadEmme2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { if (dimensionInfo.SaveInTimes) { odcCreator.LoadCsvTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { odcCreator.LoadCsvTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } } } var localFileName = Path.GetFileName(FileName); if (localFileName == null) { throw new IOException($"Unable to get the file name of {FileName}!"); } odcCreator.Save(Path.Combine(outputDirectory, localFileName), true); }
public void LoadFile(string odcFile) { OdCache cache = new OdCache(odcFile); FilesLoaded = new CacheGenerationInfo(cache.Times, cache.Types, cache.HighestZone, 5); Times = cache.Times; Types = cache.Types; AmmountOfData = Types * Times; HighestZone = cache.HighestZone; Data = new float[HighestZone][][]; HasData = new bool[HighestZone][]; cache.DumpToCreator(this); cache.Release(); }
public void LoadFile(string odcFile) { ODCache cache = new ODCache(odcFile); this.FilesLoaded = new CacheGenerationInfo(cache.Times, cache.Types, cache.HighestZone, 5); this.Times = cache.Times; this.Types = cache.Types; this.AmmountOfData = this.Types * this.Times; this.HighestZone = cache.HighestZone; this.Data = new float[this.HighestZone][][]; this.HasData = new bool[this.HighestZone][]; this.Gap = 5; cache.DumpToCreator(this); cache.Release(); cache = null; }
public void ReGenerate(string dataDirectory, string outputDirectory) { string fileName = Path.GetFileNameWithoutExtension(this.FileName); string path = Path.GetDirectoryName(this.FileName); string xmlFile = Path.Combine(path, fileName + ".xml"); XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo)); TextReader textReader = new StreamReader(xmlFile); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader); textReader.Close(); ODCCreator odcCreator = new ODCCreator(this.HighestZone, this.Types, this.Times, this.Indexes.Length); foreach (var dimensionInfo in info.CacheInfo) { string fname = Path.Combine(dataDirectory, dimensionInfo.FileName); if (dimensionInfo.Is311) { odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { if (dimensionInfo.SaveInTimes) { odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } } } odcCreator.Save(Path.Combine(outputDirectory, Path.GetFileName(this.FileName)), true); }
public void LoadFile(string odcFile) { ODCache cache = new ODCache( odcFile ); this.FilesLoaded = new CacheGenerationInfo( cache.Times, cache.Types, cache.HighestZone, 5 ); this.Times = cache.Times; this.Types = cache.Types; this.AmmountOfData = this.Types * this.Times; this.HighestZone = cache.HighestZone; this.Data = new float[this.HighestZone][][]; this.HasData = new bool[this.HighestZone][]; this.Gap = 5; cache.DumpToCreator( this ); cache.Release(); cache = null; }
/// <summary>Create a new ODC</summary> /// <param name="times">How many time periods to account for</param> /// <param name="types">How many different types of data to store per OD</param> public ODCCreator(int highestZone, int types, int times, int gap) { this.FilesLoaded = new CacheGenerationInfo( times, types, highestZone, gap ); this.AmmountOfData = types * times; this.Data = new float[highestZone][][]; this.HasData = new bool[highestZone][]; this.Types = types; this.Times = times; this.HighestZone = highestZone; this.Gap = gap; }