Esempio n. 1
0
        /// <summary>
        /// initializes this to be a non-shallow copy of <paramref name="other"/>;
        /// </summary>
        internal void CopyFrom(FieldStorage other)
        {
            if (other.m_NMin != this.m_NMin || other.m_NoOfCells != this.m_NoOfCells)
            {
                throw new ArgumentException();
            }

            int J    = m_NoOfCells;
            int NMin = m_NMin;

            Array.Copy(other.m_BaseStorage, this.m_BaseStorage, other.m_BaseStorage.Length);

            this.BeginResize(other.m_NMax);
            for (int j = 0; j < J; j++)
            {
                double[] exto = other.m_ExtendedStorage[j];

                this.Resize(j, (exto != null) ? (exto.Length + NMin) : 0);
            }
            this.FinishResize();
            this.m_NMax = other.m_NMax;


            for (int j = 0; j < J; j++)
            {
                double[] exto = other.m_ExtendedStorage[j];
                double[] extt = this.m_ExtendedStorage[j];


                if (exto != null)
                {
                    Array.Copy(exto, extt, exto.Length);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// creates a non-shallow copy of this object;
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FieldStorage r = new FieldStorage(this.NoOfCells, m_NMin, m_NMax);

            Array.Copy(this.m_BaseStorage, r.m_BaseStorage, this.m_BaseStorage.Length);
            for (int j = 0; j < m_NoOfCells; j++)
            {
                double[] st = m_ExtendedStorage[j];
                if (st != null)
                {
                    r.m_ExtendedStorage[j] = (double[])m_ExtendedStorage[j].Clone();
                }
            }

            return(r);
        }