예제 #1
0
파일: random_smv.cs 프로젝트: Sciumo/gaigen
        protected Dictionary<string, string> m_randomScalarFunc = new Dictionary<string, string>(); ///< = mangled name of random scalar func 

        #endregion Fields

        #region Methods

        /// <summary>
        /// Return true if  <c>smv</c> can be initialized with random values for each coordinate:
        ///   - scalar types
        ///   - vector types
        ///   - dual vector types
        ///   - pseudoscalar types
        ///   - G25.SMV.MULTIVECTOR_TYPE.MULTIVECTOR types
        /// </summary>
        /// <param name="S"></param>
        /// <param name="smv"></param>
        /// <returns>true if  <c>smv</c> can be initialized with random values for each coordinate.</returns>
        public static bool InitWithRandomCoordinates(Specification S, G25.SMV smv)
        {
            if (smv.MvType == G25.SMV.MULTIVECTOR_TYPE.MULTIVECTOR) return true;
            int lg = smv.LowestGrade();
            int hg = smv.HighestGrade();
            if (lg != hg) return false;
            return ((lg == 0) || (lg == 1) || (lg == (S.m_dimension - 1)) || (lg == S.m_dimension));
        }