Ejemplo n.º 1
0
 private void Format(GeoinformationModelingViewModel geoinformationModel)
 {
     for (int i = 0; i <= geoinformationModel.PiverParams.SplitsNumberByX; i++)
     {
         FF[2 * i]     = F0(i * geoinformationModel.PiverParams.LengthByX / (double)geoinformationModel.PiverParams.SplitsNumberByX, geoinformationModel);
         FF[2 * i + 1] = U0(i * geoinformationModel.PiverParams.LengthByX / (double)geoinformationModel.PiverParams.SplitsNumberByX, geoinformationModel);
     }
 }
 public IActionResult SaveRiverData(GeoinformationModelingViewModel geoinfotmationModelingViewModel)
 {
     if (signInManager.IsSignedIn(User))
     {
         geoinfotmationModelingViewModel.UserId = User.FindFirstValue(ClaimTypes.NameIdentifier);
         saveRiverDataService.SaveRiverData(mapper.Map <DataAccess.Entities.RiverParams>(geoinfotmationModelingViewModel), mapper.Map <List <MapParams> >(geoinfotmationModelingViewModel.MapPoints));
     }
     return(null);
 }
Ejemplo n.º 3
0
        public void getMatrixFF(GeoinformationModelingViewModel geoinformationModel, double[,] matrixF, double[,] matrixU, int numRow)
        {
            int counter = 0;

            for (int i = 0; i <= geoinformationModel.PiverParams.SplitsNumberByX; i++)
            {
                if (i % geoinformationModel.PiverParams.OutputMultiplicityByX == 0)
                {
                    matrixF[numRow, counter] = FF[2 * i];
                    matrixU[numRow, counter] = FF[2 * i + 1];
                    counter++;
                }
            }
        }
        public IActionResult Calculate(GeoinformationModelingViewModel geoinfotmationModelingViewModel)
        {
            MatrixesModel result = new MatrixesModel();

            try
            {
                geoinfotmationModelingViewModel.TaskParams.AngleSine = geoinfotmationModelingViewModel.TaskParams.AngleOfInclinationSine;
                result = matrixGeoinformaionService.GetMatrixes(geoinfotmationModelingViewModel);
            }
            catch (Exception ex)
            {
                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError, "Internal Server Error"));
            }
            return(Json(new { result }));
        }
        public IActionResult GeoinformationModelingCalculator(int?riverId)
        {
            if (!riverId.HasValue)
            {
                return(View(new GeoinformationModelingViewModel
                {
                    PiverParams = new Entities.RiverParams
                    {
                        LengthByX = 1,
                        SplitsNumberByX = 20,
                        LengthByT = 1,
                        SplitsNumberByT = 50,
                        OutputMultiplicityByX = 2,
                        OutputMultiplicityByT = 5
                    },
                    TaskParams = new TaskParams
                    {
                        GravityAcceleration = 9.8,
                        FreeSurfaceWidth = 20,
                        ChannelHydraulicRadius = 1,
                        ShaziCoefficient = 60,
                        AngleOfInclinationSine = 0.1,
                        AngleSine = 0.1,
                        Alpha = 1
                    },
                    MapPoints = new List <MapPointModel>()
                }));
            }
            else
            {
                GeoinformationModelingViewModel model = new GeoinformationModelingViewModel {
                    TaskParams = new TaskParams(), PiverParams = new Entities.RiverParams(), MapPoints = new List <MapPointModel>()
                };

                var res = saveRiverDataService.GetRiverById(riverId.Value);
                model.TaskParams  = mapper.Map <TaskParams>(res);
                model.PiverParams = mapper.Map <Entities.RiverParams>(res);
                model.MapPoints   = mapper.Map <List <MapPointModel> >(res.MapParamsList).OrderBy(t => t.SequenceNumber).ToList();
                model             = mapper.Map <DataAccess.Entities.RiverParams, GeoinformationModelingViewModel>(res, model);
                return(View(model));
            }
        }
Ejemplo n.º 6
0
        private double F0(double x, GeoinformationModelingViewModel geoinformationModel)
        {
            double res = 0;

            switch (geoinformationModel.TestExample)
            {
            case TestExample.First:
            case TestExample.Second:
                res = x;
                break;

            case TestExample.Third:
                res = x * x;
                break;

            default:
                res = Math.Sqrt(x);
                break;
            }
            return(res);
        }
Ejemplo n.º 7
0
        public MatrixesModel GetMatrixes(GeoinformationModelingViewModel geoinformationModel)
        {
            var allLength  = geoinformationModel.PiverParams.LengthByX;
            var mapDetails = new List <MapDetail>();

            matrixLenth = 2 * (geoinformationModel.PiverParams.SplitsNumberByX + 1);
            matrixWidth = 4;
            int j = geoinformationModel.PiverParams.SplitsNumberByX;

            double[,] matrixF = new double[(int)(geoinformationModel.PiverParams.SplitsNumberByT / geoinformationModel.PiverParams.OutputMultiplicityByT),
                                           (geoinformationModel.PiverParams.SplitsNumberByX / geoinformationModel.PiverParams.OutputMultiplicityByX) + 1];
            double[,] matrixU = new double[(int)(geoinformationModel.PiverParams.SplitsNumberByT / geoinformationModel.PiverParams.OutputMultiplicityByT),
                                           (geoinformationModel.PiverParams.SplitsNumberByX / geoinformationModel.PiverParams.OutputMultiplicityByX) + 1];
            var isFirst = true;

            //geoinformationModel.Lengthes = new List<double> { 2 };
            foreach (var pieceLength in geoinformationModel.Lengthes)
            {
                geoinformationModel.PiverParams.LengthByX = GetLengthScale(geoinformationModel.TaskParams.FreeSurfaceWidth, pieceLength, allLength);



                time         = 0;
                timeIncrease = geoinformationModel.PiverParams.LengthByT / geoinformationModel.PiverParams.SplitsNumberByT;
                if (isFirst == true)
                {
                    Format(geoinformationModel);
                }


                int numRow = 0;
                for (int i = 1; i <= geoinformationModel.PiverParams.SplitsNumberByT; i++)
                {
                    time = time + timeIncrease;
                    CopyFF();
                    FormatMatr(time - timeIncrease / 2, geoinformationModel.PiverParams, geoinformationModel.TaskParams);
                    Deco(matrixLenth, matrixWidth, MatrC);
                    Solve(matrixLenth, matrixWidth, MatrC, FF);
                    BuildFF();

                    if (i % geoinformationModel.PiverParams.OutputMultiplicityByT == 0)
                    {
                        getMatrixFF(geoinformationModel, matrixF, matrixU, numRow);
                        numRow++;
                    }
                }
                CopyFF();
                isFirst = false;
                mapDetails.Add(new MapDetail
                {
                    Area    = matrixF[matrixF.GetLength(0) - 1, matrixF.GetLength(1) - 1],
                    Sppeed  = matrixU[matrixU.GetLength(0) - 1, matrixU.GetLength(1) - 1],
                    MatrixH = (double[, ])matrixF.Clone(),
                    MatrixU = (double[, ])matrixU.Clone()
                });
            }


            return(new MatrixesModel {
                MatrixH = matrixF, MatrixU = matrixU, MapDetails = mapDetails
            });
        }