Example #1
0
        private void CheckCurrentValues(int totalSampleCount, MapSectionWorkResult currentValues)
        {
            if (currentValues.Counts.Length != totalSampleCount)
            {
                throw new ArgumentException("The current values must have a Counts array of length matching the size of the work request.");
            }

            if (currentValues.ZValues.Length != totalSampleCount)
            {
                throw new ArgumentException("The current values must have a ZValues array of length matching the size of the work request.");
            }
        }
Example #2
0
        public MapSectionWorkResult GetWorkingValues(double[] XValues, double[] YValues, int maxIterations, MapSectionWorkResult currentValues)
        {
            int width  = XValues.Length;
            int height = YValues.Length;

            CheckCurrentValues(width * height, currentValues);

            MPointWork mPointWork = new MPointWork(maxIterations);
            DPoint     c          = new DPoint(0, 0);
            int        ptr        = 0;

            for (int yPtr = 0; yPtr < height; yPtr++)
            {
                c.Y = YValues[yPtr];

                for (int xPtr = 0; xPtr < width; xPtr++)
                {
                    //if(ptr == 7382)
                    //{
                    //	int a = 0;
                    //}

                    if (currentValues.DoneFlags[ptr])
                    {
                        ptr++;
                        continue;
                    }

                    c.X = XValues[xPtr];
                    DPoint z   = currentValues.ZValues[ptr];                 //DPoint z = new DPoint(0, 0);
                    int    cnt = currentValues.Counts[ptr];                  //int cnt = 0; //
                    cnt /= CNT_MULTIPLIER;

                    double escapeVelocity = mPointWork.Iterate(c, z, ref cnt, out bool done);

                    //if(!done)
                    //{
                    //	int b = 0;
                    //}

                    double cAndE = cnt + escapeVelocity;
                    cAndE *= CNT_MULTIPLIER;
                    cAndE  = Math.Truncate(cAndE);

                    currentValues.Counts[ptr]    = (int)(cAndE);
                    currentValues.ZValues[ptr]   = z;
                    currentValues.DoneFlags[ptr] = done;
                    ptr++;
                }
            }

            currentValues.IterationCount = maxIterations;
            return(currentValues);
        }