public void SetIsShow(bool isShow, CadElementType cadPartType, IList <uint> partIds) { for (int i = 0; i < partIds.Count; i++) { uint id = partIds[i]; SetIsShow(isShow, cadPartType, id); } }
public int GetShowMode(CadElementType type, uint id) { for (int idp = 0; idp < DrawParts.Count; idp++) { if (DrawParts[idp].Type == type && DrawParts[idp].CadId == id) { return(DrawParts[idp].ShowMode); } } return(0); }
public void SetIsShow(bool isShow, CadElementType cadPartType, uint cadPartId) { int mode = (isShow) ? 0 : -1; for (int idp = 0; idp < DrawParts.Count; idp++) { if (DrawParts[idp].CadId == cadPartId && DrawParts[idp].Type == cadPartType) { DrawParts[idp].ShowMode = mode; } } }
public ConstFieldFixedCad(uint cadId, CadElementType cadElemType, FieldValueType valueType, IList <uint> fixedDofIndexs, IList <System.Numerics.Complex> fixedValues) : base(cadId, cadElemType, valueType, fixedDofIndexs) { System.Diagnostics.Debug.Assert(fixedDofIndexs.Count == fixedValues.Count); DoubleValues = null; ComplexValues = new System.Numerics.Complex[Dof]; for (int i = 0; i < FixedDofIndexs.Count; i++) { uint iDof = FixedDofIndexs[i]; System.Numerics.Complex value = fixedValues[i]; ComplexValues[iDof] = value; } }
public void SetShowMode(CadElementType type, uint id, int showMode) { bool flag = false; for (int idp = 0; idp < DrawParts.Count; idp++) { if (DrawParts[idp].Type == type && DrawParts[idp].CadId == id) { DrawParts[idp].ShowMode = showMode; System.Diagnostics.Debug.Assert(flag == false); flag = true; } } }
public MultipointConstraint( IList <KeyValuePair <uint, CadElementType> > cadIdTypes, Constraint constraint) { Constraint = constraint; foreach (var pair in cadIdTypes) { uint cadId = pair.Key; CadElementType cadElemType = pair.Value; // Lagrangeの未定乗数は常に1自由度 var fixedCad = new FieldFixedCad(cadId, cadElemType, FieldValueType.Scalar); FixedCads.Add(fixedCad); } }
public bool IsElementId(CadElementType type, uint id) { if (type == CadElementType.Vertex) { return(BRep.IsUseVertexId(id)); } else if (type == CadElementType.Edge) { return(Edge2HalfEdge.ContainsKey(id)); } else if (type == CadElementType.Loop) { return(Loop2UseLoop.ContainsKey(id)); } return(false); }
public void GetPartCadId(int[] selectFlag, out CadElementType partType, out uint partId, out int ctrlIndex) { uint idp = (uint)selectFlag[1]; if (idp < DrawParts.Count) { CadObject2DDrawPart dp = DrawParts[(int)idp]; partType = dp.Type; partId = dp.CadId; ctrlIndex = selectFlag[2]; return; } partType = CadElementType.NotSet; partId = 0; ctrlIndex = 0; }
public IList <uint> GetElementIds(CadElementType type) { if (type == CadElementType.Vertex) { return(BRep.GetUseVertexIds()); } IList <uint> res = new List <uint>(); if (type == CadElementType.Edge) { foreach (var key in Edge2HalfEdge.Keys) { res.Add(key); } } else if (type == CadElementType.Loop) { foreach (var key in Loop2UseLoop.Keys) { res.Add(key); } } return(res); }
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); }
public void UpdateCadGeometry(CadObject2D cad2D) { Mesher2D mesh = new Mesher2D(cad2D); for (int idp = 0; idp < DrawParts.Count; idp++) { CadObject2DDrawPart dp = DrawParts[idp]; dp.Clear(); uint cadId = dp.CadId; CadElementType cadType = dp.Type; if (!cad2D.IsElementId(cadType, cadId)) { continue; } uint meshId = mesh.GetIdFromCadId(cadId, cadType); if (meshId == 0) { continue; } MeshType meshType; uint elemCnt; int loc; uint cadId0; mesh.GetMeshInfo(meshId, out elemCnt, out meshType, out loc, out cadId0); System.Diagnostics.Debug.Assert(cadId0 == cadId); if (meshType == MeshType.Tri) { dp.SetTriArray(mesh.GetTriArrays()[loc]); double[] color = cad2D.GetLoopColor(cadId0); for (int iTmp = 0; iTmp < 3; iTmp++) { dp.Color[iTmp] = (float)color[iTmp]; } } else if (meshType == MeshType.Bar) { dp.SetBarArray(mesh.GetBarArrays()[loc]); System.Diagnostics.Debug.Assert(cadType == CadElementType.Edge); Edge2D edge = cad2D.GetEdge(cadId); dp.CurveType = edge.CurveType; dp.CtrlPoints.Clear(); // 2019-03-11 エッジの色 FIX double[] color = edge.Color; for (int iTmp = 0; iTmp < 3; iTmp++) { dp.Color[iTmp] = (float)color[iTmp]; } if (edge.CurveType == CurveType.CurveArc) { OpenTK.Vector2d cPt; double radius; edge.GetCenterRadius(out cPt, out radius); dp.CtrlPoints.Add(cPt); } else if (edge.CurveType == CurveType.CurveBezier) { IList <OpenTK.Vector2d> cos = edge.GetCurvePoint(); dp.CtrlPoints.Add(cos[0]); dp.CtrlPoints.Add(cos[1]); } } else if (meshType == MeshType.Vertex) { dp.SetVertex(mesh.GetVertexs()[loc]); } } { // 座標をセット IList <OpenTK.Vector2d> vec2Ds = mesh.GetVectors(); uint ptCnt = (uint)vec2Ds.Count; uint ndim = 2; VertexArray.SetSize(ptCnt, ndim); for (int iPt = 0; iPt < ptCnt; iPt++) { VertexArray.VertexCoordArray[iPt * ndim] = vec2Ds[iPt].X; VertexArray.VertexCoordArray[iPt * ndim + 1] = vec2Ds[iPt].Y; } if (VertexArray.UVCoordArray != null) { for (int iPt = 0; iPt < ptCnt; iPt++) { VertexArray.UVCoordArray[iPt * ndim] = vec2Ds[iPt].X * TexScale; VertexArray.UVCoordArray[iPt * ndim + 1] = vec2Ds[iPt].Y * TexScale; } } } }
public IList <int> GetCoordIdsFromCadId(uint quantityId, uint cadId, CadElementType cadElemType) { return(Quantitys[(int)quantityId].GetCoordIdsFromCadId(this, cadId, cadElemType)); }
public DistributedFieldFixedCad(uint cadId, CadElementType cadElemType, FieldValueType valueType, IList <uint> fixedDofIndexs) : base(cadId, cadElemType, valueType, fixedDofIndexs) { }