示例#1
0
        public ConvolutionOperator(ForwardSolver solver)
            : base(solver)
        {
            _solver = solver;

            _rFunction       = Alloc(Model.Anomaly.LocalSize.Nx * Model.Anomaly.LocalSize.Ny * Model.Nz);
            _forwardFactors  = Alloc(Model.Nz);
            _backwardFactors = Alloc(Model.Nz);

            _rx = AnomalyCurrent.AllocateNewLocalSize(solver.MemoryProvider, solver.Model);
        }
        public AtoAGreenTensorCalculatorComponent(ForwardSolver solver) : base(solver)
        {
            if (Solver.Engine == ForwardSolverEngine.Giem2g)
            {
                if (!Solver.IsParallel)
                {
                    throw new NotImplementedException("GIEM2G works only in parallel mode!");
                }
                _plan            = null;
                _scalarCalc      = null;
                _tensorCalc      = null;
                _mirroringX      = false;
                _realCalcNxStart = -1;
                _totalNxLength   = -1;
                _calcNxLength    = -1;
                return;
            }

            _plan = new ScalarPlansCreater(Model.LateralDimensions, HankelCoefficients.LoadN40(), Solver.Settings.NumberOfHankels)
                    .CreateForAnomalyToAnomaly();

            _scalarCalc = GreenScalarCalculator.NewAtoACalculator(Logger, Model);
            _tensorCalc = new AtoAGreenTensorCalculator(Logger, Model, MemoryProvider);

            if (Solver.IsParallel)
            {
                var localNxStart = Mpi.CalcLocalNxStart(Model.LateralDimensions);
                _totalNxLength = Mpi.CalcLocalNxLength(Model.LateralDimensions);

                _mirroringX      = localNxStart >= Model.Nx;
                _realCalcNxStart = _mirroringX ? 2 * Model.Nx - localNxStart - _totalNxLength + 1 : localNxStart;

                _calcNxLength = _totalNxLength;
                if (_realCalcNxStart + _totalNxLength == Model.Nx + 1)
                {
                    _calcNxLength--;
                }
            }
            else
            {
                _mirroringX      = false;
                _realCalcNxStart = 0;
                _totalNxLength   = 2 * Model.Nx;
                _calcNxLength    = Model.Nx;
            }
        }
示例#3
0
        public static unsafe AnomalyCurrent GatherFromAllProcesses(ForwardSolver solver, AnomalyCurrent field)
        {
            if (!solver.IsParallel)
            {
                return(field);
            }

            int size = 3 * field.Nx * field.Ny;

            if (solver.Mpi.IsMaster)
            {
                var result = AnomalyCurrent.AllocateNew(solver.MemoryProvider, solver.Model.Nx, solver.Model.Ny, 1);

                solver.MpiRealPart.Gather(result.Ptr, field.Ptr, size, size);

                return(result);
            }
            else
            {
                solver.MpiRealPart.Gather(null, field.Ptr, 0, size);

                return(null);
            }
        }
示例#4
0
 protected ToOCalculator(ForwardSolver solver) : base(solver)
 {
 }
示例#5
0
 public StoOCalculator(ForwardSolver solver) : base(solver)
 {
     _templateTensorPlan = DistibutedUtils.CreateTensorPlanAtoO(Mpi, Model, 1, 1);
     _gtc          = new AtoOLevelGreenTensorCalculator(Logger, Model, MemoryProvider);
     _plansCreater = new ScalarPlansCreater(Model.LateralDimensions, HankelCoefficients.LoadN40(), Solver.Settings.NumberOfHankels);
 }
示例#6
0
 protected ForwardSolverComponent(ForwardSolver solver)
 {
     Solver = solver;
 }