예제 #1
0
        /// <summary>
        /// ctor.
        /// </summary>
        internal XDGSpaceMetrics(LevelSetTracker lsTrk, XQuadFactoryHelper qfHelper, int __quadorder, SpeciesId[] speciesIds, int HistoyIndex)
        {
            using (new FuncTrace("XDGSpaceMetrics.ctor")) {
                // ----
                // init
                // ----

                if (!speciesIds.IsSubsetOf(lsTrk.SpeciesIdS))
                {
                    throw new ArgumentException();
                }
                CutCellQuadOrder   = __quadorder;
                m_qfHelper         = qfHelper;
                this.Tracker       = lsTrk;
                this.m_SpeciesList = speciesIds.ToArray();

                m_LevelSetRegions = lsTrk.RegionsHistory[HistoyIndex];
                m_LevelSetData    = lsTrk.DataHistories.Select(his => his[HistoyIndex]).ToList().AsReadOnly();
                foreach (var lsData in m_LevelSetData)
                {
                    Debug.Assert(lsData.HistoryIndex == HistoyIndex);
                }

                // ---------------------
                // compute all the stuff
                // ---------------------

                m_CutCellMetrics    = new CutCellMetrics(this);
                m_MassMatrixFactory = new MassMatrixFactory(this);
                m_XQuadSchemeHelper = new XQuadSchemeHelper(this);
            }
        }
예제 #2
0
        /// <summary>
        /// Central 'factory' for creating Level Set - related quadrature.
        /// </summary>
        /// <remarks>
        /// The centralized approach should avoid multiple creation of the same quadrature rule.
        /// </remarks>
        XQuadFactoryHelper GetXQuadFactoryHelper(XQuadFactoryHelper.MomentFittingVariants variant, int HistoryIndex = 1)
        {
            var dict = m_QuadFactoryHelpersHistory[HistoryIndex];

            if (!dict.ContainsKey(variant))
            {
                dict[variant] = new XQuadFactoryHelper(
                    this.DataHistories.Select(hist => hist[HistoryIndex]).ToArray(),
                    variant);
            }

            return(dict[variant]);
        }