コード例 #1
0
        private static unsafe CartesianModel DistributedLoadModelSlave(Mpi mpi, string path)
        {
            var model      = LoadModelWithoutExternFiles(path);
            var anomaly    = model.Anomaly;
            var nxLength   = mpi.CalcLocalHalfNxLength(model.LateralDimensions.Nx);
            var recvLength = nxLength * anomaly.LocalSize.Ny;
            var sigma      = new double[nxLength, model.Anomaly.LocalSize.Ny, 1];

            UpdateAnomalyLocalSize(mpi, anomaly);

            if (nxLength != 0)
                fixed(double *data = &sigma[0, 0, 0])
                {
                    for (int k = 0; k < anomaly.Layers.Count; k++)
                    {
                        var actualSource = 0;
                        mpi.Recv(data, recvLength, Mpi.Double, 0, 0, out actualSource);
                        for (int i = 0; i < nxLength; i++)
                        {
                            for (int j = 0; j < model.Anomaly.LocalSize.Ny; j++)
                            {
                                model.Anomaly.Sigma[i, j, k] = sigma[i, j, 0];
                            }
                        }
                    }
                }


            return(model);
        }