// 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual Mesh CreateMesh()
        {
            // TODO: Instantiate an appropriate concrete class.
            Rectangle body = new Rectangle(1, 2, 4, 6);
            Mesh mesh = new RectangularMesh(body, 3, 3); 
            return mesh;
        }
 public void SolveTest()
 {
     double error = 0.001;
     Rectangle rectangle = new Rectangle(0.1, 1);
     Model model = new Model(Material.Aluminium(), rectangle); // TODO: Initialize to an appropriate value
     model.PointConditions[rectangle.Points[2]].Type = BoundaryConditionsType.Static;
     model.PointConditions[rectangle.Points[3]].Type = BoundaryConditionsType.Static;
     Mesh mesh = new RectangularMesh(rectangle, 10, 4); // TODO: Initialize to an appropriate value
     FreeVibrationsLinearSolver solver = new FreeVibrationsLinearSolver(model, mesh, error); // TODO: Initialize to an appropriate value
     IResult expected = null; // TODO: Initialize to an appropriate value
     IResult actual = null;
     actual = solver.Solve(1).FirstOrDefault();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void Solve()
        {
            Rectangle rectangle = solidMechanicsModel.Model.Shape as Rectangle;
            if (rectangle != null)
            {
                SolidMechanicsModel2D smm = solidMechanicsModel as SolidMechanicsModel2D;
                if (smm != null)
                {
                    RectangularMesh mesh = new RectangularMesh(rectangle, smm.VerticalElements, smm.HorizontalElements);
                    pointsForGrid = mesh.GetPointsForResult();
                    IEnumerable<INumericalResult> results = null;
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    Task taskSolver = Task.Factory.StartNew(() =>
                    {
                        //Solver solver = new FreeVibrationsLinearSolver(solidMechanicsModel.Model, mesh, error, solidMechanicsModel.MaxAmplitude);

                        Solver solver = new FreeVibrationsLinearSolver(smm.Model, mesh, error, smm.MaxAmplitude);

                        /*Solver initSolver = new FreeVibrationsLinearSolver(_solidMechanicsModel.Model, mesh, _error);
                        IEnumerable<INumericalResult> initResults = initSolver.Solve(1);
                        EigenValuesNumericalResult res = initResults.First() as EigenValuesNumericalResult;*/

                        //Solver solver = new FreeVibrationsNonLinearSolver2(_solidMechanicsModel.Model, mesh, _error, res.U, 2, 50);

                        //Solver solver = new NewmarkVibrationNonLinearSolver(_solidMechanicsModel.Model, mesh, _error, res.U, 5, 50);

                        //Solver solver = new StationaryNonlinear2DSolver(_solidMechanicsModel.Model, mesh, _error, 20);

                        //IResult analiticalResult = new AnaliticalResultRectangleWithOneSideFixed(_solidMechanicsModel.Model);

                        results = solver.Solve(maxResults);
                    });
                    sw.Stop();
                    TimeElapsed = sw.Elapsed;
                    Task.WaitAll(taskSolver);
                    Application.Current.Dispatcher.BeginInvoke(new Action(() => 
                    {
                        Results.Clear();
                        foreach (INumericalResult result in results)
                        {
                            Results.Add(result);
                        }
                    }));
                }
            }
        }
        public void SolveSimpleTest()
        {
            double error = 0.001;
            Rectangle rectangle = new Rectangle(1, 1);
            Model model = new Model(Material.Aluminium(), rectangle);
            model.PointConditions[rectangle.Points[2]].Type = BoundaryConditionsType.Static;
            model.PointConditions[rectangle.Points[3]].Type = BoundaryConditionsType.Static;
            //model.BoundaryConditions[rectangle.Edges[0]].Type = BoundaryConditionsType.Static;
            //model.BoundaryConditions[rectangle.Edges[2]].Type = BoundaryConditionsType.Static;
            Mesh mesh = new RectangularMesh(rectangle, 2, 2); 
            FreeVibrationsLinearSolver solver = new FreeVibrationsLinearSolver(model, mesh, error);
            IResult expected = null; // TODO: Initialize to an appropriate value
            IResult actual = solver.Solve(1).FirstOrDefault();

            IEnumerable<Point> points = mesh.GetPointsForResult();

            ResultHelper.IsResultsEqual(points, expected, actual, 0, error);

            Assert.AreEqual(true, false);
        }
 private void FillResultPicture()
 {
     Rectangle rectangle = solidMechanicsModel.Model.Shape as Rectangle;
     if (rectangle != null)
     {
         RectangularMesh mesh = new RectangularMesh(rectangle, VerticalElements, HorizontalElements);
         List<Shape> shapes = new List<Shape>();
         foreach (FiniteElementRectangle fe in mesh.Elements)
         {
             shapes.Add(ConvertFiniteElementToShape(fe));
         }
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             Figures.Clear();
             foreach (Shape shape in shapes)
             {
                 Figures.Add(shape);
             }
         }));
     }
 }