Ejemplo n.º 1
0
        /// <summary>
        /// 境界上の節点番号の取得(要素アレイ単位)
        /// </summary>
        /// <param name="world">ワールド座標系</param>
        /// <param name="fieldValId">フィールド値ID</param>
        /// <param name="eaId">要素アレイID</param>
        /// <param name="to_no_boundary">全体節点番号→境界上節点番号マップ</param>
        /// <returns></returns>
        private static bool getBoundaryNodeList_EachElementAry(CFieldWorld world, uint fieldValId, uint eaId, Dictionary <uint, uint> to_no_boundary)
        {
            // 要素アレイを取得する
            CElemAry ea = world.GetEA(eaId);

            System.Diagnostics.Debug.Assert(ea.ElemType() == ELEM_TYPE.LINE);
            if (ea.ElemType() != ELEM_TYPE.LINE)
            {
                return(false);
            }

            // フィールドを取得
            CField valField = world.GetField(fieldValId);

            // 座標セグメントを取得
            CElemAry.CElemSeg es_c_co = valField.GetElemSeg(eaId, ELSEG_TYPE.CORNER, false, world);

            //境界節点番号→全体節点番号変換テーブル(no_c_all)作成
            // 全体節点番号→境界節点番号変換テーブル(to_no_boundary)作成
            uint node_cnt = ea.Size() + 1;  // 全節点数

            // 線要素の節点数
            uint nno = 2;

            uint[] no_c = new uint[nno]; // 要素節点の全体節点番号

            for (uint ielem = 0; ielem < ea.Size(); ielem++)
            {
                // 要素配列から要素セグメントの節点番号を取り出す
                es_c_co.GetNodes(ielem, no_c);

                for (uint ino = 0; ino < nno; ino++)
                {
                    if (!to_no_boundary.ContainsKey(no_c[ino]))
                    {
                        uint ino_boundary_tmp = (uint)to_no_boundary.Count;
                        to_no_boundary[no_c[ino]] = ino_boundary_tmp;
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ループ内の節点番号と座標の取得(要素アレイ単位)
        /// </summary>
        /// <param name="world">ワールド座標系</param>
        /// <param name="fieldValId">フィールド値ID</param>
        /// <param name="eaId">要素アレイID</param>
        /// <param name="to_no_boundary">全体節点番号→境界上節点番号マップ</param>
        /// <returns></returns>
        private static bool getLoopCoordList_EachElementAry(
            CFieldWorld world, uint fieldValId, uint eaId,
            double rotAngle, double[] rotOrigin,
            ref Dictionary <uint, uint> to_no_loop, ref IList <double[]> coord_c_list, ref IList <uint[]> elem_no_c_list, ref IList <uint> elem_loopId_list)
        {
            // 要素アレイを取得する
            CElemAry ea = world.GetEA(eaId);

            System.Diagnostics.Debug.Assert(ea.ElemType() == ELEM_TYPE.TRI);
            if (ea.ElemType() != ELEM_TYPE.TRI)
            {
                return(false);
            }

            // フィールドを取得
            CField valField = world.GetField(fieldValId);

            // 座標セグメントを取得
            CElemAry.CElemSeg es_c_co = valField.GetElemSeg(eaId, ELSEG_TYPE.CORNER, false, world);
            // 座標のノードセグメントを取得
            CNodeAry.CNodeSeg ns_c_co = valField.GetNodeSeg(ELSEG_TYPE.CORNER, false, world);

            uint node_cnt = ea.Size() + 1;  // 全節点数

            // 三角形要素の節点数
            uint nno = 3;
            // 座標の次元
            uint ndim = 2;

            // 要素節点の全体節点番号
            uint[] no_c = new uint[nno];
            // 要素節点の座標
            double[][] coord_c = new double[nno][];
            for (int inoes = 0; inoes < nno; inoes++)
            {
                coord_c[inoes] = new double[ndim];
            }

            for (uint ielem = 0; ielem < ea.Size(); ielem++)
            {
                // 要素配列から要素セグメントの節点番号を取り出す
                es_c_co.GetNodes(ielem, no_c);

                // ループID
                elem_loopId_list.Add(eaId);
                // 要素内節点番号
                {
                    uint[] work_no_c = new uint[nno];
                    no_c.CopyTo(work_no_c, 0);
                    elem_no_c_list.Add(work_no_c);
                }

                // 座標を取得
                for (uint inoes = 0; inoes < nno; inoes++)
                {
                    double[] tmpval = null;
                    ns_c_co.GetValue(no_c[inoes], out tmpval);
                    System.Diagnostics.Debug.Assert(tmpval.Length == ndim);
                    for (int i = 0; i < tmpval.Length; i++)
                    {
                        coord_c[inoes][i] = tmpval[i];
                    }
                }
                if (Math.Abs(rotAngle) >= Constants.PrecisionLowerLimit)
                {
                    // 座標を回転移動する
                    for (uint inoes = 0; inoes < nno; inoes++)
                    {
                        double[] srcPt  = coord_c[inoes];
                        double[] destPt = GetRotCoord(srcPt, rotAngle, rotOrigin);
                        for (int i = 0; i < ndim; i++)
                        {
                            coord_c[inoes][i] = destPt[i];
                        }
                    }
                }

                for (uint ino = 0; ino < nno; ino++)
                {
                    if (!to_no_loop.ContainsKey(no_c[ino]))
                    {
                        uint ino_loop_tmp = (uint)to_no_loop.Count;
                        to_no_loop[no_c[ino]] = ino_loop_tmp;
                        coord_c_list.Add(new double[] { coord_c[ino][0], coord_c[ino][1] });
                        System.Diagnostics.Debug.Assert(coord_c_list.Count == (ino_loop_tmp + 1));
                    }
                }
            }
            return(true);
        }