From: wolf Date: Wed, 17 Feb 1999 08:41:03 +0000 (+0000) Subject: Make this testcase 3d aware. In fact, it is compiled with both libraries at the same... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62d653b53ff8845fae7a4d50426fa916a54753cd;p=dealii-svn.git Make this testcase 3d aware. In fact, it is compiled with both libraries at the same time. git-svn-id: https://svn.dealii.org/trunk@824 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/Attic/examples/grid/Makefile b/deal.II/deal.II/Attic/examples/grid/Makefile index d73b1f495b..eb554b6ff2 100644 --- a/deal.II/deal.II/Attic/examples/grid/Makefile +++ b/deal.II/deal.II/Attic/examples/grid/Makefile @@ -19,16 +19,16 @@ user-libs = # To run the program, use "make run"; to give parameters to the program, # give the parameters to the following variable: -run-parameters = 1 +run-parameters = 2 1 # To execute additional action apart from running the program, fill # in this list: -additional-run-action = grid_test 2 ; grid_test 3 ; grid_test 4 ; gnuplot make_ps +additional-run-action = grid_test 2 2 ; grid_test 2 3 ; grid_test 2 4 ; grid_test 3 1 ; grid_test 3 2 ; grid_test 3 3 ; grid_test 3 4 ; gnuplot make_ps # To specify which files are to be deleted by "make clean" (apart from # the usual ones: object files, executables, backups, etc), fill in the # following list -delete-files = grid.? *.eps +delete-files = results/[123]d* @@ -49,8 +49,8 @@ h-files = $(wildcard *.h) lib-h-files = $(wildcard ../../include/*/*.h) # list of libraries needed to link with -libs = ./Obj.a ../../lib/libdeal_II_2d.a ../../../lac/lib/liblac.a ../../../base/lib/libbase.a -libs.g = ./Obj.g.a ../../lib/libdeal_II_2d.g.a ../../../lac/lib/liblac.g.a ../../../base/lib/libbase.g.a +libs = ./Obj.a ../../lib/libdeal_II_2d.g.a ../../lib/libdeal_II_3d.a ../../../lac/lib/liblac.a ../../../base/lib/libbase.a +libs.g = ./Obj.g.a ../../lib/libdeal_II_2d.g.a ../../lib/libdeal_II_3d.g.a ../../../lac/lib/liblac.g.a ../../../base/lib/libbase.g.a # check whether we use debug mode or not diff --git a/deal.II/deal.II/Attic/examples/grid/grid_test.cc b/deal.II/deal.II/Attic/examples/grid/grid_test.cc index 5246d88094..f2afefd0c3 100644 --- a/deal.II/deal.II/Attic/examples/grid/grid_test.cc +++ b/deal.II/deal.II/Attic/examples/grid/grid_test.cc @@ -31,7 +31,7 @@ class Ball : for (int i=0; i class CurvedLine : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - double x=middle(0), - y=middle(1); - - if (y in_between (const PointArray &neighbors) const; +}; - return middle; - }; + + +template +Point CurvedLine::in_between (const PointArray &neighbors) const { + Point middle = StraightBoundary::in_between(neighbors); + double x=middle(0), + y=middle(1); + + if (y()", do template parameter -// passing this way... template -void test (const int test_case, const Point &) { +void test (const int test_case) { + cout << "Running testcase " << test_case + << " in " << dim << " dimensions." << endl; Triangulation tria; tria.create_hypercube(); @@ -133,21 +138,23 @@ void test (const int test_case, const Point &) { tria.begin_active()->set_refine_flag(); tria.execute_refinement (); - Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<7; ++i) - { - cell = tria.begin_active(); - endc = tria.end(); + Triangulation::active_cell_iterator cell, endc; + const unsigned int steps[4] = { 0, 10, 7, 2 }; + for (unsigned int i=0; iat_boundary()) - cell->set_refine_flag(); + // refine all + // boundary cells + for (; cell!=endc; ++cell) + if (cell->at_boundary()) + cell->set_refine_flag(); - tria.execute_refinement(); - }; - + tria.execute_refinement(); + }; + + tria.set_boundary (0); break; } @@ -158,7 +165,7 @@ void test (const int test_case, const Point &) { tria.execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<(dim==2 ? 13 : 30); ++i) + for (int i=0; i<(dim==2 ? 13 : (dim==3 ? 7 : 30)); ++i) { int n_levels = tria.n_levels(); cell = tria.begin_active(); @@ -184,7 +191,9 @@ void test (const int test_case, const Point &) { // output the grid - string filename("grid."); + string filename("results/"); + filename += ('0'+dim); + filename += "d."; filename += ('0'+test_case); ofstream out(filename.c_str()); @@ -197,18 +206,22 @@ void test (const int test_case, const Point &) { int main (int argc, char **argv) { - if (argc!=2) + if (argc!=3) { - cout << "Usage: grid_test testcase" << endl << endl + cout << "Usage: grid_test dimension testcase" << endl << endl + << "Dimension: 2 or 3" << endl << endl << "Testcases:" << endl - << " 1: continuous refinement of the unit square always in the middle" << endl - << " 2: refinement of the circle at the boundary" << endl + << " 1: continuous refinement of the unit square/cube always in the middle" << endl + << " 2: refinement of the circle/sphere at the boundary" << endl << " 3: refinement of a wiggled area at the boundary" << endl << " 4: random refinement" << endl << endl; return 1; }; - test (argv[1][0]-'0', Point<2>()); + if (argv[1][0] == '2') + test<2> (argv[2][0]-'0'); + else + test<3> (argv[2][0]-'0'); return 0; }; diff --git a/deal.II/deal.II/Attic/examples/grid/make_ps b/deal.II/deal.II/Attic/examples/grid/make_ps index eb6e01f1e9..21782a3337 100644 --- a/deal.II/deal.II/Attic/examples/grid/make_ps +++ b/deal.II/deal.II/Attic/examples/grid/make_ps @@ -2,23 +2,42 @@ set size 0.721,1 set data style lines set noxtics set noytics +set noztics set noxzeroaxis set noyzeroaxis +#set nozzeroaxis set nokey set term postscript eps -!echo " Making " -set output "grid.1.eps" -plot "grid.1" +!echo " Making " +set output "results/2d.1.eps" +plot "results/2d.1" -!echo " Making " -set output "grid.2.eps" -plot "grid.2" +!echo " Making " +set output "results/2d.2.eps" +plot "results/2d.2" -!echo " Making " -set output "grid.3.eps" -plot "grid.3" +!echo " Making " +set output "results/2d.3.eps" +plot "results/2d.3" -!echo " Making " -set output "grid.4.eps" -plot "grid.4" +!echo " Making " +set output "results/2d.4.eps" +plot "results/2d.4" + + +!echo " Making " +set output "results/3d.1.eps" +splot "results/3d.1" + +!echo " Making " +set output "results/3d.2.eps" +splot "results/3d.2" + +!echo " Making " +set output "results/3d.3.eps" +splot "results/3d.3" + +!echo " Making " +set output "results/3d.4.eps" +splot "results/3d.4" diff --git a/deal.II/deal.II/Attic/examples/grid/results/.cvsignore b/deal.II/deal.II/Attic/examples/grid/results/.cvsignore new file mode 100644 index 0000000000..480cb8565d --- /dev/null +++ b/deal.II/deal.II/Attic/examples/grid/results/.cvsignore @@ -0,0 +1 @@ +?d.* diff --git a/tests/big-tests/grid/Makefile b/tests/big-tests/grid/Makefile index d73b1f495b..eb554b6ff2 100644 --- a/tests/big-tests/grid/Makefile +++ b/tests/big-tests/grid/Makefile @@ -19,16 +19,16 @@ user-libs = # To run the program, use "make run"; to give parameters to the program, # give the parameters to the following variable: -run-parameters = 1 +run-parameters = 2 1 # To execute additional action apart from running the program, fill # in this list: -additional-run-action = grid_test 2 ; grid_test 3 ; grid_test 4 ; gnuplot make_ps +additional-run-action = grid_test 2 2 ; grid_test 2 3 ; grid_test 2 4 ; grid_test 3 1 ; grid_test 3 2 ; grid_test 3 3 ; grid_test 3 4 ; gnuplot make_ps # To specify which files are to be deleted by "make clean" (apart from # the usual ones: object files, executables, backups, etc), fill in the # following list -delete-files = grid.? *.eps +delete-files = results/[123]d* @@ -49,8 +49,8 @@ h-files = $(wildcard *.h) lib-h-files = $(wildcard ../../include/*/*.h) # list of libraries needed to link with -libs = ./Obj.a ../../lib/libdeal_II_2d.a ../../../lac/lib/liblac.a ../../../base/lib/libbase.a -libs.g = ./Obj.g.a ../../lib/libdeal_II_2d.g.a ../../../lac/lib/liblac.g.a ../../../base/lib/libbase.g.a +libs = ./Obj.a ../../lib/libdeal_II_2d.g.a ../../lib/libdeal_II_3d.a ../../../lac/lib/liblac.a ../../../base/lib/libbase.a +libs.g = ./Obj.g.a ../../lib/libdeal_II_2d.g.a ../../lib/libdeal_II_3d.g.a ../../../lac/lib/liblac.g.a ../../../base/lib/libbase.g.a # check whether we use debug mode or not diff --git a/tests/big-tests/grid/grid_test.cc b/tests/big-tests/grid/grid_test.cc index 5246d88094..f2afefd0c3 100644 --- a/tests/big-tests/grid/grid_test.cc +++ b/tests/big-tests/grid/grid_test.cc @@ -31,7 +31,7 @@ class Ball : for (int i=0; i class CurvedLine : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - double x=middle(0), - y=middle(1); - - if (y in_between (const PointArray &neighbors) const; +}; - return middle; - }; + + +template +Point CurvedLine::in_between (const PointArray &neighbors) const { + Point middle = StraightBoundary::in_between(neighbors); + double x=middle(0), + y=middle(1); + + if (y()", do template parameter -// passing this way... template -void test (const int test_case, const Point &) { +void test (const int test_case) { + cout << "Running testcase " << test_case + << " in " << dim << " dimensions." << endl; Triangulation tria; tria.create_hypercube(); @@ -133,21 +138,23 @@ void test (const int test_case, const Point &) { tria.begin_active()->set_refine_flag(); tria.execute_refinement (); - Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<7; ++i) - { - cell = tria.begin_active(); - endc = tria.end(); + Triangulation::active_cell_iterator cell, endc; + const unsigned int steps[4] = { 0, 10, 7, 2 }; + for (unsigned int i=0; iat_boundary()) - cell->set_refine_flag(); + // refine all + // boundary cells + for (; cell!=endc; ++cell) + if (cell->at_boundary()) + cell->set_refine_flag(); - tria.execute_refinement(); - }; - + tria.execute_refinement(); + }; + + tria.set_boundary (0); break; } @@ -158,7 +165,7 @@ void test (const int test_case, const Point &) { tria.execute_refinement (); Triangulation::active_cell_iterator cell, endc; - for (int i=0; i<(dim==2 ? 13 : 30); ++i) + for (int i=0; i<(dim==2 ? 13 : (dim==3 ? 7 : 30)); ++i) { int n_levels = tria.n_levels(); cell = tria.begin_active(); @@ -184,7 +191,9 @@ void test (const int test_case, const Point &) { // output the grid - string filename("grid."); + string filename("results/"); + filename += ('0'+dim); + filename += "d."; filename += ('0'+test_case); ofstream out(filename.c_str()); @@ -197,18 +206,22 @@ void test (const int test_case, const Point &) { int main (int argc, char **argv) { - if (argc!=2) + if (argc!=3) { - cout << "Usage: grid_test testcase" << endl << endl + cout << "Usage: grid_test dimension testcase" << endl << endl + << "Dimension: 2 or 3" << endl << endl << "Testcases:" << endl - << " 1: continuous refinement of the unit square always in the middle" << endl - << " 2: refinement of the circle at the boundary" << endl + << " 1: continuous refinement of the unit square/cube always in the middle" << endl + << " 2: refinement of the circle/sphere at the boundary" << endl << " 3: refinement of a wiggled area at the boundary" << endl << " 4: random refinement" << endl << endl; return 1; }; - test (argv[1][0]-'0', Point<2>()); + if (argv[1][0] == '2') + test<2> (argv[2][0]-'0'); + else + test<3> (argv[2][0]-'0'); return 0; }; diff --git a/tests/big-tests/grid/make_ps b/tests/big-tests/grid/make_ps index eb6e01f1e9..21782a3337 100644 --- a/tests/big-tests/grid/make_ps +++ b/tests/big-tests/grid/make_ps @@ -2,23 +2,42 @@ set size 0.721,1 set data style lines set noxtics set noytics +set noztics set noxzeroaxis set noyzeroaxis +#set nozzeroaxis set nokey set term postscript eps -!echo " Making " -set output "grid.1.eps" -plot "grid.1" +!echo " Making " +set output "results/2d.1.eps" +plot "results/2d.1" -!echo " Making " -set output "grid.2.eps" -plot "grid.2" +!echo " Making " +set output "results/2d.2.eps" +plot "results/2d.2" -!echo " Making " -set output "grid.3.eps" -plot "grid.3" +!echo " Making " +set output "results/2d.3.eps" +plot "results/2d.3" -!echo " Making " -set output "grid.4.eps" -plot "grid.4" +!echo " Making " +set output "results/2d.4.eps" +plot "results/2d.4" + + +!echo " Making " +set output "results/3d.1.eps" +splot "results/3d.1" + +!echo " Making " +set output "results/3d.2.eps" +splot "results/3d.2" + +!echo " Making " +set output "results/3d.3.eps" +splot "results/3d.3" + +!echo " Making " +set output "results/3d.4.eps" +splot "results/3d.4" diff --git a/tests/big-tests/grid/results/.cvsignore b/tests/big-tests/grid/results/.cvsignore new file mode 100644 index 0000000000..480cb8565d --- /dev/null +++ b/tests/big-tests/grid/results/.cvsignore @@ -0,0 +1 @@ +?d.*