Esempio n. 1
0
        private void Set(uint valueId, FieldDerivativeType valueDt,
                         bool isntDisplacementValue,
                         bool isDrawInnerEdge,
                         FEWorld world)
        {
            var mesh = world.Mesh;

            if (!world.IsFieldValueId(valueId))
            {
                throw new ArgumentException();
                //return;
            }

            ValueId = valueId;
            ValueDt = valueDt;
            IsntDisplacementValue = isntDisplacementValue;

            var fv = world.GetFieldValue(ValueId);

            // 線要素を生成
            uint quantityId = fv.QuantityId;

            if (isDrawInnerEdge)
            {
                // 内部の全ての辺を描画
                LineFEs = world.MakeBoundOfElements(quantityId);
            }
            else
            {
                // 境界の辺だけ描画
                LineFEs = new List <LineFE>();
                IList <MeshBarArray> barArrays = mesh.GetBarArrays();
                foreach (MeshBarArray barArray in barArrays)
                {
                    uint        eCadId   = barArray.ECadId;
                    IList <int> allCoIds = world.GetCoordIdsFromCadId(quantityId, eCadId, CadElementType.Edge);

                    for (int i = 0; i < (allCoIds.Count - 1); i++)
                    {
                        int    workFEOrder = 1;
                        LineFE lineFE      = new LineFE(workFEOrder);
                        {
                            int[] coIds = { allCoIds[i], allCoIds[i + 1] };
                            lineFE.SetVertexCoordIds(coIds);
                            lineFE.SetNodeCoordIds(coIds);
                        }
                        LineFEs.Add(lineFE);
                    }
                }
            }

            int feOrder;
            {
                LineFE lineFE = LineFEs[0]; // 先頭の要素
                feOrder     = lineFE.Order;
                LinePtCount = lineFE.NodeCount;
            }

            uint ptCnt = LineCount * LinePtCount;
            uint dim   = world.Dimension;

            uint drawDim;

            if (!IsntDisplacementValue &&
                dim == 2 &&
                (fv.Type == FieldValueType.Scalar || fv.Type == FieldValueType.ZScalar))
            {
                drawDim = 3;
            }
            else
            {
                drawDim = dim;
            }
            VertexArray.SetSize(ptCnt, drawDim);

            if (drawDim == 2)
            {
                SutableRotMode = RotMode.RotMode2D;
            }
            else if (dim == 3)
            {
                SutableRotMode = RotMode.RotMode3D;
            }
            else
            {
                SutableRotMode = RotMode.RotMode2DH;
            }


            Update(world);
        }