public DirectProblemState(double radius, int pointsNumber, IDirectProblemTestData directProblemTestData) { Radius = radius; OuterCurve = new StarCurve(OuterRadialFunction); InnerCurve = new ParametrizedCurve(InnerXFuntion, InnerYFunction, InnerXFuntionDerivetive, InnerYFunctionDerivetive); PointsNumber = pointsNumber; DirectProblemCore = new DoubleCore <double>(CoreFunction); RightPartFunction = DirectProblemRightPartFunction; DirectProblemTestData = directProblemTestData; }
public static void SolveDirectProblem() { double radius = 2; int pointsNumber = 32; //IDirectProblemTestData testData = new PlanarTestData(); //IDirectProblemTestData testData = new FundamentalSolutionTestData(); var outerCurve = new StarCurve((t) => radius); IDirectProblemTestData testData = new FundamentalSolutionDevidedTastData(outerCurve); //IDirectProblemTestData testData = new CoordinatesDeviationDoubleTestData(); DirectProblemState state = new DirectProblemState(radius, pointsNumber, testData); DirectProblemSolver solver = new DirectProblemSolver(state); Printer.Append = false; Printer.Mode = WriteMode.Console; double[] density = solver.CalculateDensity(); Printer.WriteLine("Density :"); Printer.Write(density); double[] solution = solver.BuildSolutionOn(density, xFunc: SolutionCurveX, yFunc: SolutionCurveY, paramStart: 0.001, paramEnd: Math.PI - 0.001, solutionPointsNumber: 16); DeviationCalculator calculator = new DeviationCalculator(); double deviation = calculator.MaxDeviation( solution, accurate: (double t) => { Point x = new Point(SolutionCurveX(t), SolutionCurveY(t)); return(testData.OnTestCurveValue(x)); }, paramStart: 0.001, paramEnd: Math.PI - 0.001); Printer.Append = true; Printer.WriteLine("Solution :"); Printer.Write(solution); Printer.WriteLine($"Deviation : {deviation}"); Console.ReadLine(); }