예제 #1
0
        private static void TestCuda()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);


            //model.Nodes[4].Constraints = model.Nodes[5].Constraints = model.Nodes[6].Constraints = Constraints.Fixed;

            //model.Nodes[7].Constraints = Constraint.FromString("011101");

            var t = model.Nodes.Select(i => i.Constraints).ToArray();

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            var config = new SolverConfiguration();

            //config.SolverFactory = new CudaSolver.CuSparseDirectSpdSolverFactory();
            config.LoadCases.AddRange(new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            });

            model.Solve_MPC(config);
            //model.Solve(config);

            //model.Solve();

            var tmp = model.LastResult.Displacements.First().Value;
        }
예제 #2
0
        private static void Test_P_Delta_matrix()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(10, 10, 10);


            var zs = model.Nodes.Where(i => i.Constraints != Constraint.Fixed)
                     .Select(i => i.Location.Z).Distinct().ToList();

            foreach (var z in zs)
            {
                var relm = new RigidElement_MPC();

                relm.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));

                model.MpcElements.Add(relm);

                relm.UseForAllLoads = true;
            }

            StructureGenerator.AddRandomDisplacements(model, 0.1);


            model.Clone();

            #region

            #endregion

            CalcUtil.GenerateP_Delta_Mpc(model, LoadCase.DefaultLoadCase, new DenseIrrefFinder());
        }
예제 #3
0
        private static void TestVisualize()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            ModelVisualizerControl.VisualizeInNewWindow(model);
        }
예제 #4
0
        private static void Test2()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(5, 5, 5);
            //StructureGenerator.AddRandomiseLoading(model, LoadCase.DefaultLoadCase);

            //var wrapped = SerializationObsolete.ObjectWrapper.Wrap(model);

            var data = DataContractSerializerHelper.SerializeXml(model);
        }
예제 #5
0
        private void Test1()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(5, 5, 5);

            //StructureGenerator.AddRandomiseLoading(model, LoadCase.DefaultLoadCase);

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);


            new Frame3DDValidator(model).Validate();
        }
예제 #6
0
        private static void Test_P_Delta_matrix()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);


            var zs = model.Nodes
                     .Where(i => i.Constraints != Constraints.Fixed)
                     .Select(i => i.Location.Z).Distinct().ToList();


            foreach (var z in zs)
            {
                var relm  = new RigidElement_MPC();
                var relm2 = new RigidElement();

                relm.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));
                relm2.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));

                model.MpcElements.Add(relm);
                model.RigidElements.Add(relm2);

                relm.UseForAllLoads  = true;
                relm2.UseForAllLoads = true;
            }

            //StructureGenerator.AddRandomDisplacements(model, 0.1);

            /**/
            foreach (var node in model.Nodes)
            {
                if (node.Constraints == Constraints.Fixed)
                {
                    node.Settlements.Add(new Settlement(new Displacement(1, 0, 0, 0, 0, 0)));
                    node.Loads.Clear();
                }
            }
            /**/


            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            //model.Clone();

            #region

            #endregion

            model.Solve();
            //CalcUtil.GenerateP_Delta_Mpc(model, LoadCase.DefaultLoadCase,new GaussRrefFinder());
            model.LastResult.AddAnalysisResult(LoadCase.DefaultLoadCase);
            model.LastResult.AddAnalysisResult_MPC(LoadCase.DefaultLoadCase);
        }
예제 #7
0
        private void CreateGrid_Click(object sender, RoutedEventArgs e)
        {
            var wnd = new Window2();

            var res = wnd.ShowDialog();

            if (!res.HasValue || !res.Value)
            {
                return;
            }

            var grd = StructureGenerator.Generate3DFrameElementGrid(wnd.Context.XSpans + 1, wnd.Context.YSpans + 1,
                                                                    wnd.Context.ZSpans + 1);

            if (wnd.Context.RandomLoads)
            {
                StructureGenerator.AddRandomiseLoading(grd, true, false);
            }

            Context.Model = grd;
        }
예제 #8
0
        public static void Test()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);

            model.ReIndexNodes();

            var toolsFactory = new SimpleSerializationToolsFactory();

            toolsFactory.Configurations.Add(new NodeConfig());
            toolsFactory.Configurations.Add(new FrameElementSerializationConfig());

            ExtendedXmlSerializer serializer = new ExtendedXmlSerializer(toolsFactory);
            var modelSt = serializer.Serialize(model);

            toolsFactory.Configurations.RemoveAt(1);


            var t = serializer.Deserialize <Model>(modelSt);


            t.Nodes.ToList().ForEach(o => o.Label = Guid.NewGuid().ToString());
        }
예제 #9
0
        public Model GetCaseModel()
        {
            var st = StructureGenerator.Generate3DFrameElementGrid(Dimension, Dimension, Dimension);

            return(st);
        }
        public static void Test1()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);

            //BriefFiniteElementNet.XamlSerialization.XamlSerializer.Serialize(model);
        }