Пример #1
0
        /// <summary>
        /// Constructor for an XDG operator
        /// </summary>
        public XdgTimestepping(
            XSpatialOperatorMk2 op,
            IEnumerable <DGField> Fields,
            IEnumerable <DGField> IterationResiduals,
            TimeSteppingScheme __Scheme,
            DelUpdateLevelset _UpdateLevelset  = null,
            LevelSetHandling _LevelSetHandling = LevelSetHandling.None,
            MultigridOperator.ChangeOfBasisConfig[][] _MultigridOperatorConfig = null,
            AggregationGridData[] _MultigridSequence = null,
            double _AgglomerationThreshold           = 0.1,
            LinearSolverConfig LinearSolver          = null, NonLinearSolverConfig NonLinearSolver = null) //
        {
            this.Scheme      = __Scheme;
            this.XdgOperator = op;

            this.Parameters = op.InvokeParameterFactory(Fields);


            foreach (var f in Fields.Cat(IterationResiduals).Cat(Parameters))
            {
                if (f != null && f is XDGField xf)
                {
                    if (LsTrk == null)
                    {
                        LsTrk = xf.Basis.Tracker;
                    }
                    else
                    {
                        if (!object.ReferenceEquals(LsTrk, xf.Basis.Tracker))
                        {
                            throw new ArgumentException();
                        }
                    }
                }
            }
            if (LsTrk == null)
            {
                throw new ArgumentException("unable to get Level Set Tracker reference");
            }

            bool UseX = Fields.Any(f => f is XDGField) || IterationResiduals.Any(f => f is XDGField);

            SpeciesId[] spcToCompute = op.Species.Select(spcName => LsTrk.GetSpeciesId(spcName)).ToArray();

            ConstructorCommon(op, UseX,
                              Fields, this.Parameters, IterationResiduals,
                              spcToCompute,
                              _UpdateLevelset,
                              _LevelSetHandling,
                              _MultigridOperatorConfig,
                              _MultigridSequence,
                              _AgglomerationThreshold,
                              LinearSolver, NonLinearSolver);
        }