Пример #1
0
        public static void WriteMesh(this SectionDefinition sec, string filename)
        {
            var          poly = sec.BuildPolygon();
            var          mesh = sec.Triangulate(poly);
            TriangleFile fne  = new TriangleFile();

            fne.Write(mesh, filename);
        }
Пример #2
0
        public void Solve(SectionDefinition sec)
        {
            var mesh = sec.Triangulate();

            GeomAnalysis(sec, mesh);

            //# shift contours such that the origin is at the centroid
            sec.ShiftPoints(-sec.Output.SectionProperties.cx, -sec.Output.SectionProperties.cy);

            /*==============need to triangulate as the section may have been shifted.
             * WARNING: Triangulate is not thread-safe
             * */
            var mesh2 = sec.Triangulate();
            //===============
            var t1 = Task.Run(() =>
            {
                if (sec.SolutionSettings.RunPlasticAnalysis)
                {
                    new PlasticAnalysis().Solve(sec, mesh2);
                }
            });

            var t2 = Task.Run(() =>
            {
                if (sec.SolutionSettings.RunWarpingAnalysis)
                {
                    new WarpingAnalysis().Solve(sec, mesh2);
                }
            });

            t1.Wait();
            t2.Wait();

            // restore contours original location
            sec.ShiftPoints(sec.Output.SectionProperties.cx, sec.Output.SectionProperties.cy);
        }
Пример #3
0
 public static Mesh Triangulate(this SectionDefinition sec)
 {
     return(sec.Triangulate(sec.BuildPolygon()));
 }