public static CatesianGrid DumpCatesianGrid(this SimulationInputData inputData, float minColorCode, float maxColorCode) { GridDimens dimens = inputData.RootDataFile.GetDIMENS(); if (dimens == null) { throw new ArgumentException("Missing DIMENS or SPECGRID"); } float[] dx = inputData.RootDataFile.GetDX(); if (dx == null) { throw new ArgumentException("Missing DX or related description"); } float[] dy = inputData.RootDataFile.GetDY(); if (dy == null) { throw new ArgumentException("Missing DY or related description"); } float[] dz = inputData.RootDataFile.GetDZ(); if (dy == null) { throw new ArgumentException("Missing DZ or related description"); } var dataSource = new CatesianGridderSource(); dataSource.NX = dimens.NI; dataSource.NY = dimens.NJ; dataSource.NZ = dimens.NK; dataSource.DX = dx; dataSource.DY = dy; dataSource.DZ = dz; dataSource.TOPS = inputData.RootDataFile.GetTOPS(); dataSource.ActiveBlocks = inputData.RootDataFile.GetACTNUM(); dataSource.IBlocks = SimLab.ArrayHelper.CreateAllSlices(dimens.NI); dataSource.JBlocks = SimLab.ArrayHelper.CreateAllSlices(dimens.NJ); dataSource.KBlocks = SimLab.ArrayHelper.CreateAllSlices(dimens.NK); dataSource.Init(); List <GridBlockProperty> gridProps = inputData.RootDataFile.GetGridProperties(); var grid = new CatesianGrid(dataSource, gridProps, minColorCode, maxColorCode); return(grid); }
public GridBlockProperty Load(string fileName,GridDimens dimens) { StreamReader reader = new StreamReader(fileName); try{ String data = reader.ReadToEnd(); String[] strValues = data.Split(delemeters,StringSplitOptions.RemoveEmptyEntries); float[] values = new float[strValues.Length]; int[] gridIndexes = new int[strValues.Length]; for(int i=0; i<values.Length; i++){ gridIndexes[i]=i; values[i]= Convert.ToSingle(strValues[i],CultureInfo.InvariantCulture); } String name = System.IO.Path.GetFileName(fileName); GridBlockProperty gbp = new GridBlockProperty(name,dimens,gridIndexes,values); return gbp; }finally{ reader.Close(); } }
public GridBlockProperty Load(string fileName, GridDimens dimens) { StreamReader reader = new StreamReader(fileName); try{ String data = reader.ReadToEnd(); String[] strValues = data.Split(delemeters, StringSplitOptions.RemoveEmptyEntries); float[] values = new float[strValues.Length]; int[] gridIndexes = new int[strValues.Length]; for (int i = 0; i < values.Length; i++) { gridIndexes[i] = i; values[i] = Convert.ToSingle(strValues[i], CultureInfo.InvariantCulture); } String name = System.IO.Path.GetFileName(fileName); GridBlockProperty gbp = new GridBlockProperty(name, dimens, gridIndexes, values); return(gbp); }finally{ reader.Close(); } }