public Geometrical(FileGws gws, double threshold, double iXmin, double iXmax, double iYmin, double iYmax, int iXcells, int iYcells, double totalH, int numOfL) { slabs= numOfL; firstCellHeightMap = MyMath.interpolatedMap(iXmin, iXmax, iYmin, iYmax, iXcells, iYcells, MyMath.SmoothedMap(HFirstCell(gws.Map(FileGws.MapType.Rough)), threshold)); GroundHeightMap = MyMath.interpolatedMap(iXmin, iXmax, iYmin, iYmax, iXcells, iYcells, gws.Map(FileGws.MapType.Height)); xmin = iXmin; xmax = iXmax; ymin = iYmin; ymax = iYmax; int x,y; x = firstCellHeightMap.data.GetLength(0); y = firstCellHeightMap.data.GetLength(1); data = new GeometricalColumn[x, y]; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { GeometricalColumn column = new GeometricalColumn(firstCellHeightMap.data[i, j][2], totalH, numOfL, firstCellHeightMap.data[i, j][0], firstCellHeightMap.data[i, j][1], GroundHeightMap.data[i,j][2]); data[i, j] = column; } } }
public static MyMath.DoubleMap HFirstCell(MyMath.DoubleMap roughnessMap, double a = 3.1175, double b = -0.396) { int x = roughnessMap.Npx; int y = roughnessMap.Npy; double[,] dataset = new double[x, y]; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { dataset[i, j] = roughnessMap.data[i, j][2] * a * Math.Pow(roughnessMap.data[i, j][2], b); } } MyMath.DoubleMap result = new MyMath.DoubleMap(roughnessMap.xmin, roughnessMap.xmax, roughnessMap.ymin, roughnessMap.ymax, dataset); return result; }
public MyMath.DoubleMap Map(MapType type) { int xNodes = Npx; int yNodes = Npy; double[,] dataset = new double[xNodes, yNodes]; for (int i = 0; i < xNodes; i++) { for (int j = 0; j < yNodes; j++) { double value; switch (type) { case MapType.Height: value = data[i, j].height; break; case MapType.Rough: value = data[i, j].rough; break; default: value = data[i, j].rough; break; } dataset[i, j] = value; } } MyMath.DoubleMap result = new MyMath.DoubleMap(xmin, xmax, ymin, ymax, dataset); return result; }