Example #1
0
 static void Main(string[] args)
 {
     BoSSS.Solution.Application._Main(args, true, delegate() {
         var p = new XDGTestMain();
         //p.passiveIo = true;
         return(p);
     });
 }
Example #2
0
 static void Main(string[] args)
 {
     BoSSS.Solution.Application._Main(args, true, "", delegate() {
         var p = new XDGTestMain();
         //p.passiveIo = true;
         p.m_GridPartitioningType = GridPartType.METIS;
         return(p);
     });
 }
Example #3
0
        public static void AllUp()
        {
            XDGTestMain p = null;

            BoSSS.Solution.Application._Main(new string[] { /*"--delplt", "--implt", "1", "-u4"*/ }, true, delegate() {
                p = new XDGTestMain();
                return(p);
            });


            double err   = p.AutoExtrapolationErr;
            double thres = 1.0e-10;

            Console.WriteLine("L2 Error of solution: " + err + " (threshold is " + thres + ")");
            Assert.LessOrEqual(err, thres);
        }
Example #4
0
        public static void RestartTest()
        {
            string TestDbDir      = "testdb_" + DateTime.Now.ToString("MMMdd_HHmm");
            string TestDbFullPath = Path.Combine(Directory.GetCurrentDirectory(), TestDbDir);

            {
                var TestDb = DatabaseInfo.CreateOrOpen(TestDbFullPath);
                DatabaseInfo.Close(TestDb);
            }

            /*
             * Guid gridGuid;
             * {
             *  var xNodes = GenericBlas.Linspace(-1.0/3.0, 10.0/3.0, 11*3 + 1);
             *  var yNodes = GenericBlas.Linspace(-1, 1, 6 * 2 + 1);
             *  var grd = Grid2D.Cartesian2DGrid(xNodes, yNodes);
             *
             *  Guid GridGuid = TestDb.Controller.DBDriver.SaveGrid(grd, TestDb);
             * };
             */

            var ctrl1 = RestartTest_FirstControl(TestDbFullPath, out var ExpectedTs1stRun);

            using (var FirstRun = new XDGTestMain()) {
                FirstRun.Init(ctrl1);
                FirstRun.RunSolverMode();
            }


            Guid RestartSession;
            {
                var TestDb2 = DatabaseInfo.CreateOrOpen(TestDbFullPath);
                Assert.IsTrue(TestDb2.Grids.Count() == 1, "Number of grids seems to be wrong.");
                Assert.IsTrue(TestDb2.Sessions.Count() == 1, "Number of sessions seems to be wrong.");


                var   si         = TestDb2.Sessions.Single();
                int[] tsiNumbers = si.Timesteps.Select(tsi => tsi.TimeStepNumber.MajorNumber).ToArray();
                Assert.IsTrue(ExpectedTs1stRun.ListEquals(tsiNumbers), "mismatch between saved time-steps in test database and expected saves.");

                //var tend = si.Timesteps.Last();
                RestartSession = si.ID;

                DatabaseInfo.Close(TestDb2);
            }


            var ctrl2 = RestartTest_SecondControl(TestDbFullPath, RestartSession, out var ExpectedTs2ndRun);

            using (var SecondRun = new XDGTestMain()) {
                SecondRun.Init(ctrl2);
                SecondRun.RunSolverMode();
            }


            {
                var TestDb3 = DatabaseInfo.CreateOrOpen(TestDbFullPath);
                Assert.IsTrue(TestDb3.Grids.Count() == 1, "Number of grids seems to be wrong.");
                Assert.IsTrue(TestDb3.Sessions.Count() == 2, "Number of sessions seems to be wrong.");


                var   si         = TestDb3.Sessions.First();
                int[] tsiNumbers = si.Timesteps.Select(tsi => tsi.TimeStepNumber.MajorNumber).ToArray();
                Assert.IsTrue(ExpectedTs2ndRun.ListEquals(tsiNumbers), "mismatch between saved time-steps in test database and expected saves.");


                DatabaseInfo.Close(TestDb3);
            }

            csMPI.Raw.Comm_Rank(csMPI.Raw._COMM.WORLD, out int rank);
            if (rank == 0)
            {
                Console.WriteLine($"Deleting test database at {TestDbFullPath} ...");
                Directory.Delete(TestDbFullPath, true);
                Console.WriteLine("done.");
            }
            csMPI.Raw.Barrier(csMPI.Raw._COMM.WORLD);
        }