Пример #1
0
        public override int go()
        {
            int k;

            if (fin1 == ny)
            {
                double[] dum;
                dum = Input_buffer.Array = new double[nz];
                Shift_to_west.initiate_recv();//msgid3 = worldcomm.ImmediateReceive<double>(east, from_e, dum);msgid3.Wait();
                Shift_to_west.go();
                for (k = 1; k <= nz; k++)
                {
                    g[k, ny + 1] = dum[k - 1];
                }
            }

            if (beg == 1)
            {
                double[] dum;
                dum = Output_buffer.Array = new double[nz];
                for (k = 1; k <= nz; k++)
                {
                    dum[k - 1] = g[k, 1];
                }
                Shift_to_west.initiate_send();//worldcomm.Send<double>(dum, west, from_e);
                Shift_to_west.go();
            }
            return(0);
        }
Пример #2
0
        public override int go()
        {
            int i, j;

            if (north != -1)
            {
                double[] dum;
                dum = Output_buffer.Array = new double[(5 * (jend - jst + 1))];
                int idx = 0;
                for (j = jst; j <= jend; j++)
                {
                    dum[0 + idx] = g[k - 1, j + 1, 2, 0];
                    dum[1 + idx] = g[k - 1, j + 1, 2, 1];
                    dum[2 + idx] = g[k - 1, j + 1, 2, 2];
                    dum[3 + idx] = g[k - 1, j + 1, 2, 3];
                    dum[4 + idx] = g[k - 1, j + 1, 2, 4];
                    idx          = idx + 5;
                }
                Shift_to_north.initiate_send();//worldcomm.Send<double>(dum, north, from_s);
                Shift_to_north.go();
            }

            if (west != -1)
            {
                double[] dum;
                dum = Output_buffer.Array = new double[(5 * (iend - ist + 1))];
                int idx = 0;
                for (i = ist; i <= iend; i++)
                {
                    dum[0 + idx] = g[k - 1, 2, i + 1, 0];
                    dum[1 + idx] = g[k - 1, 2, i + 1, 1];
                    dum[2 + idx] = g[k - 1, 2, i + 1, 2];
                    dum[3 + idx] = g[k - 1, 2, i + 1, 3];
                    dum[4 + idx] = g[k - 1, 2, i + 1, 4];
                    idx          = idx + 5;
                }
                Shift_to_west.initiate_send();//worldcomm.Send<double>(dum, west, from_e);
                Shift_to_west.go();
            }
            return(0);
        }
        public override int go()
        {
            if (south != -1)
            {
                double[] dum1;
                dum1 = Input_buffer.Array = new double[(5 * (jend - jst + 1))];
                int idx = 0;
                Shift_to_north.initiate_recv();//mid = worldcomm.ImmediateReceive<double>(south, from_s, dum1);mid.Wait();
                Shift_to_north.go();
                for (j = jst; j <= jend; j++)
                {
                    g[k - 1, j + 1, nx + 2, 0] = dum1[0 + idx];
                    g[k - 1, j + 1, nx + 2, 1] = dum1[1 + idx];
                    g[k - 1, j + 1, nx + 2, 2] = dum1[2 + idx];
                    g[k - 1, j + 1, nx + 2, 3] = dum1[3 + idx];
                    g[k - 1, j + 1, nx + 2, 4] = dum1[4 + idx];
                    idx = idx + 5;
                }
            }

            if (east != -1)
            {
                double[] dum1;
                dum1 = Input_buffer.Array = new double[(5 * (iend - ist + 1))];
                int idx = 0;
                Shift_to_west.initiate_recv();//mid = worldcomm.ImmediateReceive<double>(east, from_e, dum1);mid.Wait();
                Shift_to_west.go();
                for (i = ist; i <= iend; i++)
                {
                    g[k - 1, ny + 2, i + 1, 0] = dum1[0 + idx];
                    g[k - 1, ny + 2, i + 1, 1] = dum1[1 + idx];
                    g[k - 1, ny + 2, i + 1, 2] = dum1[2 + idx];
                    g[k - 1, ny + 2, i + 1, 3] = dum1[3 + idx];
                    g[k - 1, ny + 2, i + 1, 4] = dum1[4 + idx];
                    idx = idx + 5;
                }
            }
            return(0);
        }
        public override int go()
        {
            int i, k0;
            int ipos1, ipos2;
            int bsize = 10 * ny * nz;
            int size2 = bsize / 5;

            double[] buf1;
            buf1 = Input_buffer.Array = new double[bsize];
            double[] buf;
            buf = Output_buffer.Array = new double[bsize];

            bsize = 10 * nx * nz;
            size2 = bsize / 5;
            buf1  = Input_buffer.Array = new double[bsize];
            buf   = Output_buffer.Array = new double[bsize];
            if (west != -1)
            {
                Shift_to_east.initiate_recv();//mid = worldcomm.ImmediateReceive<double>(west, from_w, buf1);mid.Wait();
                Shift_to_east.go();
            }
            if (east != -1)
            {
                for (k0 = 1; k0 <= nz; k0++)
                {
                    for (i = 1; i <= nx; i++)
                    {
                        ipos1 = (k0 - 1) * nx + i - 1;
                        ipos2 = ipos1 + nx * nz;
                        buf[0 * size2 + ipos1] = g[k0 - 1, ny, i + 1, 0];
                        buf[1 * size2 + ipos1] = g[k0 - 1, ny, i + 1, 1];
                        buf[2 * size2 + ipos1] = g[k0 - 1, ny, i + 1, 2];
                        buf[3 * size2 + ipos1] = g[k0 - 1, ny, i + 1, 3];
                        buf[4 * size2 + ipos1] = g[k0 - 1, ny, i + 1, 4];

                        buf[0 * size2 + ipos2] = g[k0 - 1, ny + 1, i + 1, 0];
                        buf[1 * size2 + ipos2] = g[k0 - 1, ny + 1, i + 1, 1];
                        buf[2 * size2 + ipos2] = g[k0 - 1, ny + 1, i + 1, 2];
                        buf[3 * size2 + ipos2] = g[k0 - 1, ny + 1, i + 1, 3];
                        buf[4 * size2 + ipos2] = g[k0 - 1, ny + 1, i + 1, 4];
                    }
                }
                Shift_to_east.initiate_send();//worldcomm.Send<double>(buf, east, from_w);
                Shift_to_east.go();
            }
            if (west != -1)
            {
                for (k0 = 1; k0 <= nz; k0++)
                {
                    for (i = 1; i <= nx; i++)
                    {
                        ipos1 = (k0 - 1) * nx + i - 1;
                        ipos2 = ipos1 + nx * nz;
                        g[k0 - 1, 0, i + 1, 0] = buf1[0 * size2 + ipos1];
                        g[k0 - 1, 0, i + 1, 1] = buf1[1 * size2 + ipos1];
                        g[k0 - 1, 0, i + 1, 2] = buf1[2 * size2 + ipos1];
                        g[k0 - 1, 0, i + 1, 3] = buf1[3 * size2 + ipos1];
                        g[k0 - 1, 0, i + 1, 4] = buf1[4 * size2 + ipos1];

                        g[k0 - 1, 1, i + 1, 0] = buf1[0 * size2 + ipos2];
                        g[k0 - 1, 1, i + 1, 1] = buf1[1 * size2 + ipos2];
                        g[k0 - 1, 1, i + 1, 2] = buf1[2 * size2 + ipos2];
                        g[k0 - 1, 1, i + 1, 3] = buf1[3 * size2 + ipos2];
                        g[k0 - 1, 1, i + 1, 4] = buf1[4 * size2 + ipos2];
                    }
                }
            }

            if (east != -1)
            {
                Shift_to_west.initiate_recv();//mid = worldcomm.ImmediateReceive<double>(east, from_e, buf1);mid.Wait();
                Shift_to_west.go();
            }

            if (west != -1)
            {
                for (k0 = 1; k0 <= nz; k0++)
                {
                    for (i = 1; i <= nx; i++)
                    {
                        ipos1 = (k0 - 1) * nx + i - 1;
                        ipos2 = ipos1 + nx * nz;
                        buf[0 * size2 + ipos1] = g[k0 - 1, 3, i + 1, 0];
                        buf[1 * size2 + ipos1] = g[k0 - 1, 3, i + 1, 1];
                        buf[2 * size2 + ipos1] = g[k0 - 1, 3, i + 1, 2];
                        buf[3 * size2 + ipos1] = g[k0 - 1, 3, i + 1, 3];
                        buf[4 * size2 + ipos1] = g[k0 - 1, 3, i + 1, 4];

                        buf[0 * size2 + ipos2] = g[k0 - 1, 2, i + 1, 0];
                        buf[1 * size2 + ipos2] = g[k0 - 1, 2, i + 1, 1];
                        buf[2 * size2 + ipos2] = g[k0 - 1, 2, i + 1, 2];
                        buf[3 * size2 + ipos2] = g[k0 - 1, 2, i + 1, 3];
                        buf[4 * size2 + ipos2] = g[k0 - 1, 2, i + 1, 4];
                    }
                }
                Shift_to_west.initiate_send();//worldcomm.Send<double>(buf, west, from_e);
                Shift_to_west.go();
            }

            if (east != -1)
            {
                for (k0 = 1; k0 <= nz; k0++)
                {
                    for (i = 1; i <= nx; i++)
                    {
                        ipos1 = (k0 - 1) * nx + i - 1;
                        ipos2 = ipos1 + nx * nz;
                        g[k0 - 1, ny + 3, i + 1, 0] = buf1[0 * size2 + ipos1];
                        g[k0 - 1, ny + 3, i + 1, 1] = buf1[1 * size2 + ipos1];
                        g[k0 - 1, ny + 3, i + 1, 2] = buf1[2 * size2 + ipos1];
                        g[k0 - 1, ny + 3, i + 1, 3] = buf1[3 * size2 + ipos1];
                        g[k0 - 1, ny + 3, i + 1, 4] = buf1[4 * size2 + ipos1];

                        g[k0 - 1, ny + 2, i + 1, 0] = buf1[0 * size2 + ipos2];
                        g[k0 - 1, ny + 2, i + 1, 1] = buf1[1 * size2 + ipos2];
                        g[k0 - 1, ny + 2, i + 1, 2] = buf1[2 * size2 + ipos2];
                        g[k0 - 1, ny + 2, i + 1, 3] = buf1[3 * size2 + ipos2];
                        g[k0 - 1, ny + 2, i + 1, 4] = buf1[4 * size2 + ipos2];
                    }
                }
            }
            return(0);
        }