public void MeshLoadProfiling() { var k3d = new Toolkit(); int nBeams = 20; int nFaces = 1500; double lengthBeams = 10.0; double xIncBeam = lengthBeams / nBeams; double xIncMesh = lengthBeams / nFaces; double limit_dist = xIncBeam / 100.0; // create beams var lines = new List <Line3>(); var nodeI = new Point3(0, 0, 0); for (int beamInd = 0; beamInd < nBeams; ++beamInd) { var nodeK = new Point3(nodeI.X + xIncBeam, 0, 0); lines.Add(new Line3(nodeI, nodeK)); nodeI = nodeK; } LineToBeam.solve(new List <Point3>(), lines, true, true, limit_dist, new List <Vector3>(), new List <string>(), new List <Color>(), new List <CroSec>(), true, out List <Point3> outPoints, out List <BuilderBeam> builderElements, out string info); // create a MeshLoad var meshUnitLoadsBuffer = new Dictionary <MeshUnitLoad, MeshUnitLoad>(); var mesh = new Mesh(); mesh.Vertices.Add(new Point3d(0, -0.5, 0)); mesh.Vertices.Add(new Point3d(0, 0.5, 0)); for (var faceInd = 0; faceInd < nFaces; ++faceInd) { mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, -0.5, 0)); mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, 0.5, 0)); var nV = mesh.Vertices.Count; mesh.Faces.AddFace(new MeshFace(nV - 4, nV - 3, nV - 1, nV - 2)); } UnitsConversionFactory ucf = UnitsConversionFactories.Conv(); UnitConversion m = ucf.m(); var baseMesh = m.toBaseMesh(new RhinoMesh(mesh)); var load = new MeshLoad(new List <Vector3>() { new Vector3(0, 0, -1) }); load.InitUnitLoads(meshUnitLoadsBuffer, baseMesh, LoadOrientation.global, new List <bool>() { true, true }, new List <Point3>(), new List <string>()); // create a Support var support = k3d.Support.Support(new Point3(0, 0, 0), k3d.Support.SupportFixedConditions); // assemble the model var model = k3d.Model.AssembleModel(builderElements, new List <Support>() { support }, new List <Load>() { load }, out info, out var mass, out var cog, out var msg, out var runtimeWarning); ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); Assert.AreEqual(outMaxDisp[0], 2.8232103119331837, 1E-5); // Assert.AreEqual(1, 1, 1E-8); }
public void MeshLoadProfiling() { var k3d = new Toolkit(); var logger = new MessageLogger(); int nBeams = 20; int nFaces = 1500; double lengthBeams = 10.0; double xIncBeam = lengthBeams / nBeams; double xIncMesh = lengthBeams / nFaces; double limit_dist = xIncBeam / 100.0; // create beams var lines = new List <Line3>(); var nodeI = new Point3(0, 0, 0); for (int beamInd = 0; beamInd < nBeams; ++beamInd) { var nodeK = new Point3(nodeI.X + xIncBeam, 0, 0); lines.Add(new Line3(nodeI, nodeK)); nodeI = nodeK; } var builderElements = k3d.Part.LineToBeam(lines, new List <string>(), new List <CroSec>(), logger, out List <Point3> outPoints); // create a MeshLoad var mesh = new Mesh3((nFaces + 1) * 2, nFaces); mesh.AddVertex(new Point3(0, -0.5, 0)); mesh.AddVertex(new Point3(0, 0.5, 0)); for (var faceInd = 0; faceInd < nFaces; ++faceInd) { mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, -0.5, 0)); mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, 0.5, 0)); var nV = mesh.Vertices.Count; mesh.AddFace(nV - 4, nV - 3, nV - 1, nV - 2); } UnitsConversionFactory ucf = UnitsConversionFactory.Conv(); UnitConversion m = ucf.m(); var baseMesh = m.toBaseMesh(mesh); // create a mesh load var load = k3d.Load.MeshLoad(new List <Vector3>() { new Vector3(0, 0, -1) }, baseMesh); // create a support var support = k3d.Support.Support(new Point3(0, 0, 0), k3d.Support.SupportFixedConditions); // assemble the model var model = k3d.Model.AssembleModel(builderElements, new List <Support>() { support }, new List <Load>() { load }, out var info, out var mass, out var cog, out var message, out var runtimeWarning); // calculate the model model = k3d.Algorithms.AnalyzeThI(model, out var outMaxDisp, out var outG, out var outComp, out var warning); Assert.AreEqual(outMaxDisp[0], 2.8232103119228276, 1E-5); }