示例#1
0
        /// <summary>
        /// Overwrites the memory of a DG field with the reference data
        /// </summary>
        /// <param name="f"></param>
        public void OverwriteDGField(ConventionalDGField f)
        {
            if (!object.ReferenceEquals(GridDat, f.GridDat))
            {
                throw new ArgumentException("DG field is defined on different mesh");
            }

            int N  = f.Basis.Length;
            int N1 = ReferenceData.Keys.Where(colName => colName.StartsWith(f.Identification)).Count();

            if (N != N1)
            {
                throw new ArgumentException("DG degree seems different");
            }

            int J = this.GridDat.CellPartitioning.LocalLength;

            for (int n = 0; n < N; n++)
            {
                var col = ReferenceData[ColName_DGfield(f, n)];
                //for(int j = 0; j < J; j++)
                //    f.Coordinates[j, n] = col[j];
                f.Coordinates.SetColumn(n, col);
            }
        }
示例#2
0
        /// <summary>
        /// Absolute L2 for DG fields
        /// </summary>
        public double AbsError(ConventionalDGField f)
        {
            if (GridDat.MpiSize == ReferenceMPISize)
            {
                return(0.0);
            }

            var err = f.CloneAs();

            OverwriteDGField(err);
            err.Acc(-1.0, f);

            return(err.L2Norm());
        }
示例#3
0
        /// <summary>
        /// Adds a DG field
        /// </summary>
        public void AddDGField(ConventionalDGField f)
        {
            if (!object.ReferenceEquals(GridDat, f.GridDat))
            {
                throw new ArgumentException("DG field is defined on different mesh");
            }

            int N = f.Basis.Length;
            int J = GridDat.CellPartitioning.LocalLength;

            for (int n = 0; n < N; n++)
            {
                var col = f.Coordinates.GetColumn(n).GetSubVector(0, J);
                m_CurrentData.Add(ColName_DGfield(f, n), col);
            }
        }
示例#4
0
        /// <summary>
        /// Adds a DG field
        /// </summary>
        public ConventionalDGField LocalError(ConventionalDGField f)
        {
            if (!object.ReferenceEquals(GridDat, f.GridDat))
            {
                throw new ArgumentException("DG field is defined on different mesh");
            }

            var Error = f.CloneAs();

            Error.Clear();
            OverwriteDGField(Error);
            Error.Scale(-1);
            Error.Acc(1.0, f);

            Error.Identification = "Error-" + f.Identification;
            return(Error);
        }