public override void ToSharpLoad(GH_Model model) { ForceVector forceVector = null; switch (model.ModelType) { case SharpFE.ModelType.Truss2D: forceVector = model.Model.ForceFactory.CreateForTruss(Force.X, Force.Z); break; case SharpFE.ModelType.Full3D: forceVector = model.Model.ForceFactory.Create(Force.X, Force.Y, Force.Z, Moment.X, Moment.Y, Moment.Z); break; default: throw new Exception("No such model type implemented: " + model.ModelType); } foreach (GH_Node node in Nodes) { node.ToSharpElement(model); FiniteElementNode FEnode = model.Nodes[node.Index]; model.Model.ApplyForceToNode(forceVector, FEnode); } }
public override void ToSharpLoad(GH_Model model) { ForceVector forceVector = null; switch (model.ModelType) { case SharpFE.ModelType.Truss2D: forceVector = model.Model.ForceFactory.CreateForTruss(Force.X, Force.Z); break; case SharpFE.ModelType.Full3D: forceVector = model.Model.ForceFactory.Create(Force.X, Force.Y, Force.Z,Moment.X,Moment.Y,Moment.Z); break; default: throw new Exception("No such model type implemented: " + model.ModelType); } foreach (GH_Node node in Nodes) { node.ToSharpElement(model); FiniteElementNode FEnode = model.Nodes[node.Index]; model.Model.ApplyForceToNode(forceVector, FEnode); } }
public override void ToSharpLoad(GH_Model model) { ForceVector forceVector = null; switch (model.ModelType) { case ModelType.Truss2D: forceVector = model.Model.ForceFactory.CreateForTruss(Force.X, Force.Z); break; case ModelType.Full3D: forceVector = model.Model.ForceFactory.Create(Force.X, Force.Y, Force.Z, Moment.X, Moment.Y, Moment.Z); break; case ModelType.Membrane3D: forceVector = model.Model.ForceFactory.Create(Force.X, Force.Y, Force.Z, 0, 0, 0); break; default: throw new Exception("No such model type implemented: " + model.ModelType); } foreach (Point3d node in Nodes) { IFiniteElementNode FEnode = model.FindOrCreateNode(node); model.Model.ApplyForceToNode(forceVector, FEnode); } }
public override void ToSharpElement(GH_Model model) { IFiniteElementNode startNode = model.FindOrCreateNode(this.Start); IFiniteElementNode endNode = model.FindOrCreateNode(this.End); model.Model.ElementFactory.CreateLinearConstantSpring(startNode, endNode, this.SpringConstant); }
public override void ToSharpElement(GH_Model model) { IFiniteElementNode startNode = model.FindOrCreateNode(this.Start); IFiniteElementNode endNode = model.FindOrCreateNode(this.End); model.Model.ElementFactory.CreateLinear3DBeam(startNode, endNode, Material.ToSharpMaterial(), CrossSection.ToSharpCrossSection()); }
public override void ToSharpElement(GH_Model model) { IFiniteElementNode n0 = model.FindOrCreateNode(this.Points[0]); IFiniteElementNode n1 = model.FindOrCreateNode(this.Points[1]); IFiniteElementNode n2 = model.FindOrCreateNode(this.Points[2]); model.Model.ElementFactory.CreateLinearConstantStrainTriangle(n0, n1, n2, this.Material.ToSharpMaterial(), this.Thickness); }
public override void ToSharpElement(GH_Model model) { Start.ToSharpElement(model); End.ToSharpElement(model); FiniteElementNode startNode = model.Nodes[Start.Index]; FiniteElementNode endNode = model.Nodes[End.Index]; model.Model.ElementFactory.CreateLinear1DBeam(startNode, endNode, Material.ToSharpMaterial(), CrossSection.ToSharpCrossSection()); }
public override void ToSharpElement(GH_Model model) { FiniteElementNode n0 = null; FiniteElementNode n1 = null; FiniteElementNode n2 = null; int n0Index = model.Points.IndexOf(this.Points[0]); int n1Index = model.Points.IndexOf(this.Points[1]); int n2Index = model.Points.IndexOf(this.Points[2]); switch (model.ModelType) { case ModelType.Full3D: if (n0Index == -1) //Node does not exist { n0 = model.Model.NodeFactory.Create(this.Points[0].X, this.Points[0].Y, this.Points[0].Z); model.Nodes.Add(n0); model.Points.Add(this.Points[0]); } else { n0 = model.Nodes[n0Index]; } if (n1Index == -1) //Node does not exist { n1 = model.Model.NodeFactory.Create(this.Points[1].X, this.Points[1].Y, this.Points[1].Z); model.Nodes.Add(n1); model.Points.Add(this.Points[1]); } else { n1 = model.Nodes[n1Index]; } if (n2Index == -1) //Node does not exist { n2 = model.Model.NodeFactory.Create(this.Points[2].X, this.Points[2].Y, this.Points[2].Z); model.Nodes.Add(n2); model.Points.Add(this.Points[2]); } else { n2 = model.Nodes[n2Index]; } if (n0 != null && n1 != null && n2 != null) { model.Model.ElementFactory.CreateLinearConstantStrainTriangle(n0, n1, n2, this.Material.ToSharpMaterial(), this.Thickness); } break; default: throw new Exception("Model type not valid: " + model.ModelType); } }
public override GeometryBase GetDeformedGeometry(GH_Model model) { IList <Point3d> displacedPoints = new List <Point3d>(this.Points.Count); foreach (Point3d pnt in this.Points) { displacedPoints.Add(model.GetDisplacedPoint(pnt)); } return(this.CreateMesh(displacedPoints)); }
public override void ToSharpElement(GH_Model model) { Start.ToSharpElement(model); End.ToSharpElement(model); FiniteElementNode startNode = model.Nodes[Start.Index]; FiniteElementNode endNode = model.Nodes[End.Index]; model.Model.ElementFactory.CreateLinearConstantSpring(startNode,endNode, this.SpringConstant); }
public override void ToSharpElement(GH_Model model) { Start.ToSharpElement(model); End.ToSharpElement(model); FiniteElementNode startNode = model.Nodes[Start.Index]; FiniteElementNode endNode = model.Nodes[End.Index]; model.Model.ElementFactory.CreateLinearConstantSpring(startNode, endNode, this.SpringConstant); }
public override void ToSharpElement(GH_Model model) { //Check if node already exist at position int index = model.Points.IndexOf(this.Position); FiniteElementNode node = null; switch (model.ModelType) { case ModelType.Full3D: if (index == -1) //Node does not exist { node = model.Model.NodeFactory.Create(this.Position.X, this.Position.Y, this.Position.Z); model.Nodes.Add(node); model.Points.Add(this.Position); this.Index = model.Points.Count - 1; } else { node = model.Nodes[index]; this.Index = index; } break; case ModelType.Truss2D: if (index == -1) //Node does not exist { node = model.Model.NodeFactory.CreateFor2DTruss(this.Position.X, this.Position.Z); model.Nodes.Add(node); model.Points.Add(this.Position); this.Index = model.Points.Count - 1; } else { node = model.Nodes[index]; this.Index = index; } break; default: throw new Exception("Model type not valid: " + model.ModelType); } }
public override void ToSharpElement(GH_Model model) { FiniteElementNode n0 = null; FiniteElementNode n1 = null; FiniteElementNode n2 = null; int n0Index = model.Points.IndexOf(this.Points[0]); int n1Index = model.Points.IndexOf(this.Points[1]); int n2Index = model.Points.IndexOf(this.Points[2]); switch (model.ModelType) { case ModelType.Full3D: if (n0Index == -1) { //Node does not exist n0 = model.Model.NodeFactory.Create(this.Points[0].X, this.Points[0].Y, this.Points[0].Z); model.Nodes.Add(n0); model.Points.Add(this.Points[0]); } else { n0 = model.Nodes[n0Index]; } if (n1Index == -1) { //Node does not exist n1 = model.Model.NodeFactory.Create(this.Points[1].X, this.Points[1].Y, this.Points[1].Z); model.Nodes.Add(n1); model.Points.Add(this.Points[1]); } else { n1 = model.Nodes[n1Index]; } if (n2Index == -1) { //Node does not exist n2 = model.Model.NodeFactory.Create(this.Points[2].X, this.Points[2].Y, this.Points[2].Z); model.Nodes.Add(n2); model.Points.Add(this.Points[2]); } else { n2 = model.Nodes[n2Index]; } if (n0 != null && n1 != null && n2 != null) { model.Model.ElementFactory.CreateLinearConstantStrainTriangle(n0, n1, n2, this.Material.ToSharpMaterial(), this.Thickness); } break; default: throw new Exception("Model type not valid: " + model.ModelType); } }
public override void ToSharpElement(GH_Model model) { //Check if node already exist at position int index = model.Points.IndexOf(this.Position); FiniteElementNode node = null; switch (model.ModelType) { case ModelType.Full3D: if (index == -1) { //Node does not exist node = model.Model.NodeFactory.Create(this.Position.X, this.Position.Y, this.Position.Z); model.Nodes.Add(node); model.Points.Add(this.Position); this.Index = model.Points.Count-1; } else { node = model.Nodes[index]; this.Index = index; } break; case ModelType.Truss2D: if (index == -1) { //Node does not exist node = model.Model.NodeFactory.CreateFor2DTruss(this.Position.X, this.Position.Z); model.Nodes.Add(node); model.Points.Add(this.Position); this.Index = model.Points.Count-1; } else { node = model.Nodes[index]; this.Index = index; } break; default: throw new Exception("Model type not valid: " + model.ModelType); } }
public override void ToSharpSupport(GH_Model model) { foreach (GH_Node node in Nodes) { node.ToSharpElement(model); FiniteElementNode FEnode = model.Nodes[node.Index]; switch (model.ModelType) { case ModelType.Truss2D: if (UX) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X);} // if (UY) {model.Model.ConstrainNode(node, DegreeOfFreedom.Y);} if (UZ) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z);} // if (RX) {model.Model.ConstrainNode(node, DegreeOfFreedom.XX);} // if (RY) {model.Model.ConstrainNode(node, DegreeOfFreedom.YY);} // if (RZ) {model.Model.ConstrainNode(node, DegreeOfFreedom.ZZ);} break; case ModelType.Full3D: if (UX) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X);} if (UY) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Y);} if (UZ) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z);} if (RX) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.XX);} if (RY) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.YY);} if (RZ) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.ZZ);} break; default: throw new Exception("No such model type: " + model.ModelType); } } }
public override GeometryBase GetGeometry(GH_Model model) { throw new NotImplementedException("Triangle element. Geometry"); }
public override GeometryBase GetDeformedGeometry(GH_Model model) { LineCurve line = new LineCurve(model.GetDisplacedPoint(Start.Index), model.GetDisplacedPoint(End.Index)); return line; }
public override GeometryBase GetDeformedGeometry(GH_Model model) { throw new NotImplementedException("Spring element. Deformed geometry"); }
public override GeometryBase GetGeometry(GH_Model model) { LineCurve line = new LineCurve(this.Start, this.End); return(line); }
public override void ToSharpSupport(GH_Model model) { foreach (GH_Node node in Nodes) { node.ToSharpElement(model); FiniteElementNode FEnode = model.Nodes[node.Index]; switch (model.ModelType) { case ModelType.Truss2D: if (UX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X); } // if (UY) {model.Model.ConstrainNode(node, DegreeOfFreedom.Y);} if (UZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z); } // if (RX) {model.Model.ConstrainNode(node, DegreeOfFreedom.XX);} // if (RY) {model.Model.ConstrainNode(node, DegreeOfFreedom.YY);} // if (RZ) {model.Model.ConstrainNode(node, DegreeOfFreedom.ZZ);} break; case ModelType.Full3D: if (UX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X); } if (UY) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Y); } if (UZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z); } if (RX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.XX); } if (RY) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.YY); } if (RZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.ZZ); } break; default: throw new Exception("No such model type: " + model.ModelType); } } }
public override void ToSharpSupport(GH_Model model) { foreach (Point3d node in Nodes) { IFiniteElementNode FEnode = model.FindOrCreateNode(node); switch (model.ModelType) { case ModelType.Truss2D: if (UX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X); } // if (UY) {model.Model.ConstrainNode(node, DegreeOfFreedom.Y);} if (UZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z); } // if (RX) {model.Model.ConstrainNode(node, DegreeOfFreedom.XX);} // if (RY) {model.Model.ConstrainNode(node, DegreeOfFreedom.YY);} // if (RZ) {model.Model.ConstrainNode(node, DegreeOfFreedom.ZZ);} break; case ModelType.Full3D: if (UX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X); } if (UY) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Y); } if (UZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z); } if (RX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.XX); } if (RY) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.YY); } if (RZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.ZZ); } break; case ModelType.Membrane3D: if (UX) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.X); } if (UY) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Y); } if (UZ) { model.Model.ConstrainNode(FEnode, DegreeOfFreedom.Z); } // if (RX) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.XX);} // if (RY) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.YY);} // if (RZ) {model.Model.ConstrainNode(FEnode, DegreeOfFreedom.ZZ);} break; default: throw new Exception("No such model type: " + model.ModelType); } } }
public override GeometryBase GetDeformedGeometry(GH_Model model) { LineCurve line = new LineCurve(model.GetDisplacedPoint(Start.Index), model.GetDisplacedPoint(End.Index)); return(line); }
public abstract void ToSharpSupport(GH_Model model);
public abstract GeometryBase GetDeformedGeometry(GH_Model model);
public void Truss() { model = new GH_Model(ModelType.Full3D); GH_CrossSection crossSection = new GH_RectangularCrossSection(100,100); GH_Material material = new GH_ElasticMaterial(100,100,100,100); Point3d p1 = new Point3d(-10,0,0); Point3d p2 = new Point3d(0,0,0); Point3d p3 = new Point3d(10,0,0); Point3d p4 = new Point3d(-10,0,10); Point3d p5 = new Point3d(0,0,10); Point3d p6 = new Point3d(10,0,10); model.Elements.Add(new GH_Beam(p1,p2, crossSection, material)); model.Elements.Add(new GH_Beam(p2,p3, crossSection, material)); model.Elements.Add(new GH_Beam(p4,p5, crossSection, material)); model.Elements.Add(new GH_Beam(p5,p6, crossSection, material)); model.Elements.Add(new GH_Beam(p1,p4, crossSection, material)); model.Elements.Add(new GH_Beam(p2,p5, crossSection, material)); model.Elements.Add(new GH_Beam(p3,p6, crossSection, material)); model.Elements.Add(new GH_Beam(p4,p2, crossSection, material)); model.Elements.Add(new GH_Beam(p2,p6, crossSection, material)); model.Supports.Add(new GH_NodeSupport(p1, true, true, true, true, true,true)); model.Supports.Add(new GH_NodeSupport(p3, true, true, true, true, true,true)); model.Loads.Add(new GH_NodalLoad(p5, new Vector3d(0,0,-1000), new Vector3d(0,0,0))); model.AssembleSharpModel(); Assert.AreEqual(9, model.Model.ElementCount); model.Solve(); Assert.NotNull(model.Results); Vector3d displacement = model.GetNodeDisplacement(1); //Displacement at point2 (index 1) Assert.NotNull(displacement); Assert.AreEqual(0.0, displacement.X, 0.001); Assert.AreEqual(0.0, displacement.Y, 0.001); Assert.AreNotEqual(0.0, displacement.Z); //TODO Calculate real value }
public void Setup() { model = new GH_Model(ModelType.Full3D); crossSection = new GH_RectangularCrossSection(0.5,0.2); material = new GH_ElasticMaterial(0, 2000,0.1,1000); force = new Vector3d(10,0,0); moment = new Vector3d(0,0,0); point1 = new Point3d(0,0,0); point2 = new Point3d(0,0,1); point3 = new Point3d(1,0,1); point4 = new Point3d(1,0,0); beam1 = new GH_Beam(point1, point2, crossSection, material); beam2 = new GH_Beam(point2, point3, crossSection, material); beam3 = new GH_Beam(point3, point4, crossSection, material); nodalLoad1 = new GH_NodalLoad(point2, force, moment); nodeSupport1 = new GH_NodeSupport(point1, true, true, true, true, true, true); nodeSupport2 = new GH_NodeSupport(point4, true, true, true, true, true, true); }
public abstract void ToSharpLoad(GH_Model model);
public override GeometryBase GetGeometry(GH_Model model) { return(this.CreateMesh(this.Points)); }
public override GeometryBase GetGeometry(GH_Model model) { throw new NotImplementedException("Node element. Geometry"); }
public override GeometryBase GetGeometry(GH_Model model) { LineCurve line = new LineCurve(model.Points[Start.Index], model.Points[End.Index]); return(line); }
public void Setup() { model = new GH_Model(ModelType.Truss2D); springConstant = 10; force = new Vector3d(0,0,10); moment = new Vector3d(0,0,0); point1 = new Point3d(0,0,0); point2 = new Point3d(0,0,10); point3 = new Point3d(0,0,20); spring1 = new GH_Spring(point1, point2, springConstant); spring2 = new GH_Spring(point2, point3, springConstant); nodalLoad1 = new GH_NodalLoad(point2, force, moment); nodalLoad2 = new GH_NodalLoad(point3, force, moment); nodeSupport1 = new GH_NodeSupport(point1, true, true, true, true, true, true); nodeSupport2 = new GH_NodeSupport(point2, true, true, false, true, true, true); }
protected override void SolveInstance(IGH_DataAccess DA) { List<GH_Element> elements = new List<GH_Element>(); List<GH_Support> supports = new List<GH_Support>(); List<GH_Load> loads = new List<GH_Load>(); int modelType = 0; if (!DA.GetDataList<GH_Element>(0, elements)) { return; } if (!DA.GetDataList<GH_Support>(1, supports)) { return; } if (!DA.GetDataList<GH_Load>(2, loads)) { return; } if (!DA.GetData(3, ref modelType)) { return; } //Clear current structure... Perhaps change this for a more parametric approach, or opening existing files GH_Model model = null; switch (modelType) { case 0: model = new GH_Model(ModelType.Truss2D); break; case 1: model = new GH_Model(ModelType.Full3D); break; default: throw new Exception("Model type does not exist or not yet implemented"); } model.Elements = elements; model.Loads = loads; model.Supports = supports; model.AssembleSharpModel(); DA.SetData(0, model); }
public abstract void ToSharpProperty(GH_Model model);
public abstract void ToSharpElement(GH_Model model);
public abstract GeometryBase GetGeometry(GH_Model model);
public override GeometryBase GetDeformedGeometry(GH_Model model) { LineCurve line = new LineCurve(model.GetDisplacedPoint(this.Start), model.GetDisplacedPoint(this.End)); return(line); }
public override GeometryBase GetGeometry(GH_Model model) { LineCurve line = new LineCurve(model.Points[Start.Index], model.Points[End.Index]); return line; }