public HttpResponseMessage Post(Params p) { var client = new ServiceReference1.NumericalServiceClient(); client.initNumericalMethod(p.Time, p.Xlen, p.Ylen, TimeStep, p.StepX, p.StepY, 1, 1); result = StreamToArray(client.computeFinalResult(TimeStep), p); return Request.CreateResponse(HttpStatusCode.NoContent); }
private double[][][] StreamToArray(Stream stream, Params p) { var result = new double[TimeStep][][]; for (int i = 0; i < TimeStep; i++) { result[i] = new double[p.StepY + 1][]; for (int j = 0; j <= p.StepY; j++) result[i][j] = new double[p.StepX + 1]; } using (var br = new BinaryReader(stream)) { for (int i = 0; i < TimeStep; i++) for (int y = 0; y <= p.StepY; y++) for (int x = 0; x <= p.StepX; x++) result[i][y][x] = br.ReadDouble(); } return result; }