Пример #1
0
        public static void TestCSR()
        {
            CSRMatrix csr = new CSRMatrix(6, 16);

            csr.Vals = new double[16] {
                10, 20, 20, 30, 35, 40, 35, 50, 60, 40, 70, 80, 90, 60, 90, 100
            };
            csr.Cols = new int[16] {
                0, 1, 0, 1, 2, 3, 1, 2, 5, 1, 3, 4, 5, 2, 4, 5
            };
            csr.Rows = new int[7] {
                0, 2, 6, 9, 11, 13, 16
            };

            csr.DeleteRowAndCol(2);
            FEIO.WriteKG(csr, "E:\\testCSR2.mtx", true);
        }
Пример #2
0
        public static void TestHexahedron()
        {
            List <Node> nodes = new List <Node>()
            {
                new Node(0.0, 0.0, 0.0),
                new Node(0.25, 0.0, 0.0),
                new Node(0.25, 0.25, 0.0),
                new Node(0.0, 0.25, 0.0),

                new Node(0.0, 0.0, 0.25),
                new Node(0.25, 0.0, 0.25),
                new Node(0.25, 0.25, 0.25),
                new Node(0.0, 0.25, 0.25),


                new Node(0.5, 0.0, 0.0),
                new Node(0.5, 0.0, 0.25),
                new Node(0.5, 0.25, 0.25),
                new Node(0.5, 0.25, 0.0)
            };

            var element0 = new Hexahedron(new List <Node>(8)
            {
                nodes[0], nodes[1], nodes[2], nodes[3], nodes[4], nodes[5], nodes[6], nodes[7]
            }, new Material(1, 0.3));
            //var element1 = new Hexahedron(new List<Node>(8) { nodes[4], nodes[5], nodes[6], nodes[7], nodes[8], nodes[9], nodes[10], nodes[11] }, new Material(1, 0.3));

            var elements = new List <Element>(1)
            {
                element0
            };

            //var loads = new List<Load>(4)
            //{
            //    new Load(8, 4.6875, 0.0,0.0),
            //    new Load(9, 4.6875, 0.0,0.0),
            //    new Load(10,4.6875, 0.0,0.0),
            //    new Load(11, 4.6875, 0.0,0.0)
            //};

            //var supports = new List<Support>(4)
            //{
            //    new Support(0, SupportType.Fixed),
            //    new Support(1, SupportType.Fixed),
            //    new Support(2, SupportType.Fixed),
            //    new Support(3, SupportType.Fixed)
            //};

            var model = new Model(3, nodes, elements);

            FESystem sys = new FESystem(model, Solver.SimplicialLLT);

            sys.Initialize();
            Console.WriteLine(model.Elements[0].Ke);
            Console.WriteLine(model.Elements[0].B);
            Console.WriteLine(model.Elements[0].D);
            //sys.Solve();
            Console.Write(sys.Model.ModelInfo());
            Console.Write(sys.MatrixInfo());
            Console.WriteLine("Solver: " + sys._Solver.ToString());
            Console.WriteLine("Solving: " + sys.TimeCost[3].ToString() + " ms");
            Console.WriteLine(sys.DisplacementInfo());
            FEIO.WriteKG(sys.GetKG(), "E:\\ALCoding\\ALFE\\topoptTest", false);
            Console.WriteLine();
        }