Exemplo n.º 1
0
        /// <summary>
        /// Alternative constructor which uses G25.rsbbp.BasisBlade to carry both BasisBlade and constant info
        /// in one list of variables.
        /// </summary>
        /// <param name="name">The name of the multivector, for example "mv" or "rotor".</param>
        /// <param name="basisBlades">The basis blades and possibly constant values.</param>
        /// <param name="mvType">Type of multivector (</param>
        /// <param name="comment">A comment on the multivector type that may appear in the generated documentation. May be null.</param>
        public SMV(string name, G25.rsbbp.BasisBlade[] basisBlades, MULTIVECTOR_TYPE mvType, string comment)
            :
            base(true, name, ToDoubleArray(basisBlades))  // true means 'specialized'
        {
            if (comment == null)
            {
                comment = "";
            }

            m_mvType         = mvType;
            m_isConstant     = new bool[basisBlades.Length];
            m_constantValues = new double[basisBlades.Length];
            for (int i = 0; i < basisBlades.Length; i++)
            {
                m_isConstant[i]     = basisBlades[i].IsConstant;
                m_constantValues[i] = (m_isConstant[i]) ? basisBlades[i].ConstantValue : 0.0;
            }
            m_comment = comment;

            // count number of constant coordinates
            int nbConstant = GetNbConstantCoordinates();

            /*// sanity check number of constant coordinates
             * if ((m_constantName != null) &&
             *  (nbConstant != basisBlades.Length) &&
             *  (nbConstant != m_constantValues.Length))
             *  throw new Exception("G25.SMV(): not all coordinates of the constant '" + m_constantName + "' are constant");*/

            InitConstBasisBladeIdx(nbConstant);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="name">The name of the multivector, for example "mv" or "rotor".</param>
        /// <param name="basisBlades">The basis blades.</param>
        /// <param name="isConstant">Some coordinates may have constant values. If a coordinate is constant, its respective entry in isConstant is true (May be null).</param>
        /// <param name="constantValues">Some coordinates may have constant values. This array lists the values for each basis blade (May be null).</param>
        /// <param name="mvType">Type of multivector (</param>
        /// <param name="comment">A comment on the multivector type that may appear in the generated documentation. May be null.</param>
        public SMV(string name, RefGA.BasisBlade[] basisBlades, MULTIVECTOR_TYPE mvType,
                   bool[] isConstant, double[] constantValues, string comment)
            :
            base(true, name, ToDoubleArray(basisBlades))  // true means 'specialized'
        {
            // sanity check
            if (comment == null)
            {
                comment = "";
            }
            if (((isConstant != null) && (basisBlades.Length != isConstant.Length)) ||
                ((constantValues != null) && (basisBlades.Length != constantValues.Length)))
            {
                throw new Exception("G25.SMV(): the 'isConstant' array or the 'constantValues' array do not match the length of the 'basisBlades' array");
            }

            m_mvType         = mvType;
            m_isConstant     = (isConstant == null) ? new bool[basisBlades.Length]: (bool[])isConstant.Clone();
            m_constantValues = (constantValues == null) ? new double[basisBlades.Length] : (double[])constantValues.Clone();
            m_comment        = comment;

            // count number of constant coordinates
            int nbConstant = GetNbConstantCoordinates();

            // sanity check number of constant coordinates

            /*if ((m_constantName != null) &&
             *  (nbConstant != basisBlades.Length) &&
             *  (nbConstant != m_constantValues.Length))
             *  throw new Exception("G25.SMV(): not all coordinates of the constant '" + m_constantName + "' are constant");*/

            InitConstBasisBladeIdx(nbConstant);
        }
Exemplo n.º 3
0
Arquivo: mv.cs Projeto: Sciumo/gaigen
        // true means 'specialized'
        /// <summary>
        /// Alternative constructor which uses G25.rsbbp.BasisBlade to carry both BasisBlade and constant info
        /// in one list of variables.
        /// </summary>
        /// <param name="name">The name of the multivector, for example "mv" or "rotor".</param>
        /// <param name="basisBlades">The basis blades and possibly constant values.</param>
        /// <param name="mvType">Type of multivector (</param>
        /// <param name="comment">A comment on the multivector type that may appear in the generated documentation. May be null.</param>
        public SMV(string name, G25.rsbbp.BasisBlade[] basisBlades, MULTIVECTOR_TYPE mvType, string comment)
            : base(true, name, ToDoubleArray(basisBlades))
        {
            if (comment == null) comment = "";

            m_mvType = mvType;
            m_isConstant = new bool[basisBlades.Length];
            m_constantValues = new double[basisBlades.Length];
            for (int i = 0; i < basisBlades.Length; i++)
            {
                m_isConstant[i] = basisBlades[i].IsConstant;
                m_constantValues[i] = (m_isConstant[i]) ? basisBlades[i].ConstantValue : 0.0;
            }
            m_comment = comment;

            // count number of constant coordinates
            int nbConstant = GetNbConstantCoordinates();

            /*// sanity check number of constant coordinates
            if ((m_constantName != null) &&
                (nbConstant != basisBlades.Length) &&
                (nbConstant != m_constantValues.Length))
                throw new Exception("G25.SMV(): not all coordinates of the constant '" + m_constantName + "' are constant");*/

            InitConstBasisBladeIdx(nbConstant);
        }
Exemplo n.º 4
0
Arquivo: mv.cs Projeto: Sciumo/gaigen
        // true means 'specialized'
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="name">The name of the multivector, for example "mv" or "rotor".</param>
        /// <param name="basisBlades">The basis blades.</param>
        /// <param name="isConstant">Some coordinates may have constant values. If a coordinate is constant, its respective entry in isConstant is true (May be null).</param>
        /// <param name="constantValues">Some coordinates may have constant values. This array lists the values for each basis blade (May be null).</param>
        /// <param name="mvType">Type of multivector (</param>
        /// <param name="comment">A comment on the multivector type that may appear in the generated documentation. May be null.</param>
        public SMV(string name, RefGA.BasisBlade[] basisBlades, MULTIVECTOR_TYPE mvType, 
            bool[] isConstant, double[] constantValues, string comment)
            : base(true, name, ToDoubleArray(basisBlades))
        {
            // sanity check
            if (comment == null) comment = "";
            if (((isConstant != null) && (basisBlades.Length != isConstant.Length)) ||
                ((constantValues != null) && (basisBlades.Length != constantValues.Length)))
                throw new Exception("G25.SMV(): the 'isConstant' array or the 'constantValues' array do not match the length of the 'basisBlades' array");

            m_mvType = mvType;
            m_isConstant = (isConstant == null) ? new bool[basisBlades.Length]: (bool[])isConstant.Clone();
            m_constantValues = (constantValues == null) ? new double[basisBlades.Length] : (double[])constantValues.Clone();
            m_comment = comment;

            // count number of constant coordinates
            int nbConstant = GetNbConstantCoordinates();

            // sanity check number of constant coordinates
            /*if ((m_constantName != null) &&
                (nbConstant != basisBlades.Length) &&
                (nbConstant != m_constantValues.Length))
                throw new Exception("G25.SMV(): not all coordinates of the constant '" + m_constantName + "' are constant");*/

            InitConstBasisBladeIdx(nbConstant);
        }