public static double[,] CalculateBoundaryMatrix(Area Area)
        {
            double[,] matrix = new double[Area.NumberOfCollocationPoints, Area.NumberOfCollocationPoints];
            double denominator1 = Function_T.denominator1(Area.configurationData.GetDiffusionCoefficient(), Area.configurationData.iterationProcess.TimeStep);
            double denominator2 = Function_T.denominator2(Area.configurationData.GetThermalConductivity());

            int r = 0, i = 0;


            foreach (var segmentR in Area.Segments)
            // Parallel.ForEach(Area.Segments, (segmentR) =>
            {
                foreach (var collPointR in segmentR.CollocationPoints)
                {
                    foreach (var segmentI in Area.Segments)
                    {
                        foreach (var collPointI in segmentI.CollocationPoints)
                        {
                            r = Area.Segments.Where(x => x.Index < segmentR.Index).Sum(x => x.CollocationPoints.Count) + collPointR.Index;
                            i = Area.Segments.Where(x => x.Index < segmentI.Index).Sum(x => x.CollocationPoints.Count) + collPointI.Index;

                            double value = 0.0;

                            if (Area.configurationData.arePropertiesTimeDependent())
                            {
                                denominator1 = Function_T.denominator1(Area.configurationData.GetDiffusionCoefficient(segmentI.TemperatureValue), Area.configurationData.iterationProcess.TimeStep);
                                denominator2 = Function_T.denominator2(Area.configurationData.GetThermalConductivity(segmentI.TemperatureValue));
                            }

                            if (segmentI.Index != segmentR.Index)
                            {
                                foreach (var integrationPoint in segmentI.BoundaryIntegrationPoints)
                                {
                                    value -= (double)(CalculateCore(collPointR.RealPosition, integrationPoint, denominator1, denominator2, segmentI, collPointI));
                                }
                            }
                            else
                            {
                                value -= SingularSeparate(denominator1, denominator2, collPointR, segmentI, collPointI);

                              //  value -= SigularAnalitycalMajchrzak(denominator1, denominator2, segmentR, collPointR, segmentI, collPointI);
                            }
                            matrix[r, i] = value;
                        }
                    }
                }
            }//);
            return matrix;
        }
         public static double CalculateAreaValue(RealPoint resultPoint, Segment segmentI, CollocationPoint collPointI, ConfigurationData configurationData)
        {
            double result = 0.0;
            double denominator1 = Function_T.denominator1(configurationData.GetDiffusionCoefficient(), configurationData.iterationProcess.TimeStep);
            double denominator2 = Function_T.denominator2(configurationData.GetThermalConductivity());

            if (configurationData.arePropertiesTimeDependent())
            {
                denominator1 = Function_T.denominator1(configurationData.GetDiffusionCoefficient(segmentI.TemperatureValue), configurationData.iterationProcess.TimeStep);
                denominator2 = Function_T.denominator2(configurationData.GetThermalConductivity(segmentI.TemperatureValue));
            }

            foreach (var integrationPoint in segmentI.SingularBoundaryIntegrationPointsForArea)
            {
                result += CalculateCore(resultPoint, integrationPoint, denominator1, denominator2, segmentI, collPointI);
            }
            return result;
        }