Example #1
0
 public FieldValue GetFieldValue(uint valueId)
 {
     System.Diagnostics.Debug.Assert(FieldValueArray.IsObjectId(valueId));
     return(FieldValueArray.GetObject(valueId));
 }
Example #2
0
        public IList <int> GetCoordIdsFromCadId(FEWorld world, uint cadId, CadElementType cadElemType)
        {
            Mesher2D    mesh  = world.Mesh;
            IList <int> coIds = null;

            if (cadElemType == CadElementType.Vertex)
            {
                uint     meshId = mesh.GetIdFromCadId(cadId, cadElemType);
                uint     elemCnt;
                MeshType meshType;
                int      loc;
                uint     cadIdTmp;
                mesh.GetMeshInfo(meshId, out elemCnt, out meshType, out loc, out cadIdTmp);
                MeshType dummyMeshType;
                int[]    vertexs;
                mesh.GetConnectivity(meshId, out dummyMeshType, out vertexs);
                System.Diagnostics.Debug.Assert(meshType == dummyMeshType);

                coIds = vertexs.ToList();
            }
            else if (cadElemType == CadElementType.Edge)
            {
                coIds = new List <int>();
                IList <uint> feIds = LineFEArray.GetObjectIds();
                foreach (uint feId in feIds)
                {
                    LineFE lineFE = LineFEArray.GetObject(feId);
                    uint   cadIdTmp;
                    {
                        uint     meshId = lineFE.MeshId;
                        uint     elemCnt;
                        MeshType meshType;
                        int      loc;
                        mesh.GetMeshInfo(meshId, out elemCnt, out meshType, out loc, out cadIdTmp);
                        System.Diagnostics.Debug.Assert(meshType == MeshType.Bar);
                    }
                    if (cadIdTmp == cadId)
                    {
                        foreach (int coId in lineFE.NodeCoordIds)
                        {
                            if (coIds.IndexOf(coId) == -1)
                            {
                                coIds.Add(coId);
                            }
                        }
                    }
                }
            }
            else if (cadElemType == CadElementType.Loop)
            {
                coIds = new List <int>();
                IList <uint> feIds = TriangleFEArray.GetObjectIds();
                foreach (uint feId in feIds)
                {
                    TriangleFE triFE = TriangleFEArray.GetObject(feId);
                    uint       cadIdTmp;
                    {
                        uint     meshId = triFE.MeshId;
                        uint     elemCnt;
                        MeshType meshType;
                        int      loc;
                        mesh.GetMeshInfo(meshId, out elemCnt, out meshType, out loc, out cadIdTmp);
                        System.Diagnostics.Debug.Assert(meshType == MeshType.Tri);
                    }
                    if (cadIdTmp == cadId)
                    {
                        foreach (int coId in triFE.NodeCoordIds)
                        {
                            if (coIds.IndexOf(coId) == -1)
                            {
                                coIds.Add(coId);
                            }
                        }
                    }
                }
            }
            else
            {
                throw new InvalidOperationException();
            }

            return(coIds);
        }
Example #3
0
 public Material GetMaterial(uint maId)
 {
     System.Diagnostics.Debug.Assert(MaterialArray.IsObjectId(maId));
     return(MaterialArray.GetObject(maId));
 }