コード例 #1
0
        public static matrixINT operator *(int p, matrixINT m)
        {
            matrixINT res = new matrixINT(m.nRow, m.nCol);

            Mult(m, p, res);
            return(res);
        }
コード例 #2
0
        public static matrixINT operator +(matrixINT m, int p)
        {
            matrixINT res = new matrixINT(m.nRow, m.nCol);

            Add(m, p, res);
            return(res);
        }
コード例 #3
0
        ///Operators
        public static matrixINT operator +(matrixINT m1, matrixINT m2)
        {
            matrixINT res = new matrixINT(m1.nRow, m1.nCol);

            Add(m1, m2, res);
            return(res);
        }
コード例 #4
0
 public static void Mult(matrixINT m1, int p, matrixINT m2)
 {
     if (!isCompatible(m1, m2))
     {
         throw new mikity.Exceptions.SizeOfMatricesNotCompatibleException("v8idkd");
     }
     for (int i = 0; i < m2.nRow; i++)
     {
         for (int j = 0; j < m2.nCol; j++)
         {
             m2[i, j] = m1[i, j] * p;
         }
     }
 }
コード例 #5
0
 ///Alternatives of Operators
 public static void Add(matrixINT m1, matrixINT m2, matrixINT m3)
 {
     if (!isCompatible(m1, m2, m3))
     {
         throw new mikity.Exceptions.SizeOfMatricesNotCompatibleException("udufu");
     }
     for (int i = 0; i < m3.nRow; i++)
     {
         for (int j = 0; j < m3.nCol; j++)
         {
             m3[i, j] = m1[i, j] + m2[i, j];
         }
     }
 }
コード例 #6
0
        unsafe public void Subtract(matrixINT m)
        {
            fixed(int *_ptr1 = &this.rawData[0, 0], _ptr2 = &m.rawData[0, 0])
            {
                int *ptr1 = _ptr1;
                int *ptr2 = _ptr2;

                for (int i = 0; i < this.nRow * this.nCol; i++)
                {
                    *ptr1 -= *ptr2;
                    ptr1++;
                    ptr2++;
                }
            }
        }
コード例 #7
0
 public static void eye(matrixINT m)
 {
     for (int i = 0; i < m.nRow; i++)
     {
         for (int j = 0; j < m.nCol; j++)
         {
             if (i == j)
             {
                 m.rawData[i, j] = 1;
             }
             else
             {
                 m.rawData[i, j] = 0;
             }
         }
     }
 }
コード例 #8
0
        unsafe public matrixINT MinusTo(matrixINT res)
        {
            int S = this.nRow * this.nCol;

            fixed(int *_ptr1 = &this.rawData[0, 0], _ptr2 = &res.rawData[0, 0])
            {
                int *ptr1 = _ptr1;
                int *ptr2 = _ptr2;

                for (int i = 0; i < S; i++)
                {
                    *ptr2 = -*ptr1;
                    ptr1++;
                    ptr2++;
                }
            }

            return(this);
        }
コード例 #9
0
        public static matrixINT zeros(int nRow, int nCol)
        {
            matrixINT res = new matrixINT(nRow, nCol, 0);

            return(res);
        }
コード例 #10
0
        public isoparametricElement(params int[] _el)
            : base(_el)
        {
            if (this.nNodes == 2)
            {
                __N = 1;
            }
            else if (this.nNodes == 4)
            {
                __N = 2;
            }
            else if (this.nNodes == 8)
            {
                __N = 3;
            }
            else
            {
                throw new mikity.Exceptions.NumberOfNodesIncompatibleException("Isoparametric element only accept 2,4,8 nodes.");
            }

            nNodes     = this.nNodes;
            nIntPoints = mikity.MathUtil.__pow_INT_INT(nIntMed, __N);
            nVisPoints = mikity.MathUtil.__pow_INT_INT(nVisMed, __N);
            intPoints  = new integralPoint[nIntPoints];
            this.nodes = new matrix(this.nNodes, this.__dim);

            for (int i = 0; i < intPoints.Length; i++)
            {
                intPoints[i] = new integralPoint(__N, this.nodes, this.__dim);
            }
            //形状関数生成用数列
            psi  = mikity.MathUtil.generate(__N, 2);
            phi  = -2 * psi + 1;
            psi2 = mikity.MathUtil.generate(__N, nIntMed);
            psi3 = mikity.MathUtil.generate(__N, nVisMed);
            //積分点要素内座標生成
            for (int i = 0; i < nIntPoints; i++)
            {
                double[] t = new double[__N];
                for (int j = 0; j < __N; j++)
                {
                    t[j] = __u[psi2[i, j]];
                }
                intPoints[i].setLocalCoordinates(t);
            }
            //積分点積分用重み生成
            for (int i = 0; i < nIntPoints; i++)
            {
                double w = 1.0d;
                for (int j = 0; j < __N; j++)
                {
                    w *= __w[psi2[i, j]];
                }
                intPoints[i].setIntegralWeights(w);
            }
            //重み算出用補助数列生成
            for (int i = 0; i < nIntPoints; i++)
            {
                mikity.LinearAlgebra.matrix T = new mikity.LinearAlgebra.matrix(nNodes, __N);
                for (int j = 0; j < nNodes; j++)
                {
                    for (int k = 0; k < __N; k++)
                    {
                        T[j, k] = intPoints[i].localCoordinates(k) * phi[j, k] + psi[j, k];
                    }
                }
                intPoints[i].setHelperNumber(T);
            }
            //積分点位置ベクトル算出用重み生成
            for (int i = 0; i < nIntPoints; i++)
            {
                mikity.LinearAlgebra.vector tt = new mikity.LinearAlgebra.vector(nNodes);
                for (int j = 0; j < nNodes; j++)
                {
                    tt[j] = 1.0d;
                    for (int k = 0; k < __N; k++)
                    {
                        tt[j] *= (intPoints[i].Tij[j, k]);
                    }
                }
                intPoints[i].setNodeWeights(tt);
            }
            //積分点基底ベクトル算出用重み生成
            for (int i = 0; i < nIntPoints; i++)
            {
                mikity.LinearAlgebra.matrix ttt = new mikity.LinearAlgebra.matrix(nNodes, __N);
                for (int j = 0; j < nNodes; j++)
                {
                    for (int k = 0; k < __N; k++)
                    {
                        ttt[j, k] = intPoints[i].wp[j] / (intPoints[i].Tij[j, k]) * phi[j, k];
                    }
                }
                intPoints[i].setBaseWeights(ttt);
            }
            this.makeBoundary();
        }