From fa0d7a9dac0f27f14ebd188a395b80eb09b0dfce Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 17 Feb 1999 09:02:38 +0000 Subject: [PATCH] Make this test case 3d aware. Like the grid test, this program is linked against both the 2d and the 3d library at the same time. git-svn-id: https://svn.dealii.org/trunk@825 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/Attic/examples/dof/Makefile | 6 +- .../deal.II/Attic/examples/dof/dof_test.cc | 55 +++++++++++++------ tests/big-tests/dof/Makefile | 6 +- tests/big-tests/dof/dof_test.cc | 55 +++++++++++++------ 4 files changed, 80 insertions(+), 42 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/dof/Makefile b/deal.II/deal.II/Attic/examples/dof/Makefile index c8b7ad835f..0de18e871a 100644 --- a/deal.II/deal.II/Attic/examples/dof/Makefile +++ b/deal.II/deal.II/Attic/examples/dof/Makefile @@ -19,7 +19,7 @@ user-libs = # To run the program, use "make run"; to give parameters to the program, # give the parameters to the following variable: -run-parameters = $(target).prm +run-parameters = 2 $(target).prm ; $(target) 3 $(target).prm # To execute additional action apart from running the program, fill # in this list: @@ -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 ../../../base/lib/libbase.g.a +libs = ./Obj.a ../../lib/libdeal_II_2d.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 ../../../base/lib/libbase.g.a # check whether we use debug mode or not diff --git a/deal.II/deal.II/Attic/examples/dof/dof_test.cc b/deal.II/deal.II/Attic/examples/dof/dof_test.cc index d111755c67..729dac3c90 100644 --- a/deal.II/deal.II/Attic/examples/dof/dof_test.cc +++ b/deal.II/deal.II/Attic/examples/dof/dof_test.cc @@ -136,11 +136,10 @@ void TestCases::declare_parameters (ParameterHandler &prm) { template void TestCases::run (ParameterHandler &prm) { - cout << "Test case = " << prm.get ("Test run") << endl + cout << "Dimension = " << dim + << ", Test case = " << prm.get ("Test run") << endl << endl; - cout << " Making grid..." << endl; - string test = prm.get ("Test run"); unsigned int test_case = 1; if (test=="zoom in") test_case = 1; @@ -154,6 +153,7 @@ void TestCases::run (ParameterHandler &prm) { cerr << "This test seems not to be implemented!" << endl; + cout << " Making grid..." << endl; Boundary *boundary = 0; switch (test_case) @@ -180,8 +180,6 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); }; -// tria->refine_global (5); - break; } @@ -268,7 +266,7 @@ void TestCases::run (ParameterHandler &prm) { dof->make_sparsity_pattern (sparsity); int unconstrained_bandwidth = sparsity.bandwidth(); - cout << " Writing sparsity pattern... (This may take a while)" << endl; + cout << " Writing sparsity pattern..." << endl; ofstream sparsity_out (prm.get("Sparsity file").c_str()); sparsity.print_gnuplot (sparsity_out); @@ -285,11 +283,6 @@ void TestCases::run (ParameterHandler &prm) { sparsity.print_gnuplot (c_sparsity_out); -// DataOut dataout; -// dataout.attach_dof_handler (*dof); -// ofstream o("o.inp"); -// dataout.write_ucd (o); - cout << endl << " Total number of cells = " << tria->n_cells() << endl << " Total number of active cells = " << tria->n_active_cells() << endl @@ -310,18 +303,44 @@ void TestCases::run (ParameterHandler &prm) { int main (int argc, char **argv) { - if (argc!=2) + if (argc!=3) { - cout << "Usage: grid_test parameterfile" << endl << endl; + cout << "Usage: grid_test dimension parameterfile" << endl << endl; return 1; }; - TestCases<2> tests; - MultipleParameterLoop input_data; + unsigned int dim; + if (argv[1][0] == '2') + dim = 2; + else + dim = 3; + + switch (dim) + { + case 2: + { + TestCases<2> tests; + MultipleParameterLoop input_data; + + tests.declare_parameters(input_data); + input_data.read_input (argv[2]); + input_data.loop (tests); + + break; + }; + + case 3: + { + TestCases<3> tests; + MultipleParameterLoop input_data; + + tests.declare_parameters(input_data); + input_data.read_input (argv[2]); + input_data.loop (tests); - tests.declare_parameters(input_data); - input_data.read_input (argv[1]); - input_data.loop (tests); + break; + }; + }; return 0; }; diff --git a/tests/big-tests/dof/Makefile b/tests/big-tests/dof/Makefile index c8b7ad835f..0de18e871a 100644 --- a/tests/big-tests/dof/Makefile +++ b/tests/big-tests/dof/Makefile @@ -19,7 +19,7 @@ user-libs = # To run the program, use "make run"; to give parameters to the program, # give the parameters to the following variable: -run-parameters = $(target).prm +run-parameters = 2 $(target).prm ; $(target) 3 $(target).prm # To execute additional action apart from running the program, fill # in this list: @@ -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 ../../../base/lib/libbase.g.a +libs = ./Obj.a ../../lib/libdeal_II_2d.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 ../../../base/lib/libbase.g.a # check whether we use debug mode or not diff --git a/tests/big-tests/dof/dof_test.cc b/tests/big-tests/dof/dof_test.cc index d111755c67..729dac3c90 100644 --- a/tests/big-tests/dof/dof_test.cc +++ b/tests/big-tests/dof/dof_test.cc @@ -136,11 +136,10 @@ void TestCases::declare_parameters (ParameterHandler &prm) { template void TestCases::run (ParameterHandler &prm) { - cout << "Test case = " << prm.get ("Test run") << endl + cout << "Dimension = " << dim + << ", Test case = " << prm.get ("Test run") << endl << endl; - cout << " Making grid..." << endl; - string test = prm.get ("Test run"); unsigned int test_case = 1; if (test=="zoom in") test_case = 1; @@ -154,6 +153,7 @@ void TestCases::run (ParameterHandler &prm) { cerr << "This test seems not to be implemented!" << endl; + cout << " Making grid..." << endl; Boundary *boundary = 0; switch (test_case) @@ -180,8 +180,6 @@ void TestCases::run (ParameterHandler &prm) { tria->execute_refinement (); }; -// tria->refine_global (5); - break; } @@ -268,7 +266,7 @@ void TestCases::run (ParameterHandler &prm) { dof->make_sparsity_pattern (sparsity); int unconstrained_bandwidth = sparsity.bandwidth(); - cout << " Writing sparsity pattern... (This may take a while)" << endl; + cout << " Writing sparsity pattern..." << endl; ofstream sparsity_out (prm.get("Sparsity file").c_str()); sparsity.print_gnuplot (sparsity_out); @@ -285,11 +283,6 @@ void TestCases::run (ParameterHandler &prm) { sparsity.print_gnuplot (c_sparsity_out); -// DataOut dataout; -// dataout.attach_dof_handler (*dof); -// ofstream o("o.inp"); -// dataout.write_ucd (o); - cout << endl << " Total number of cells = " << tria->n_cells() << endl << " Total number of active cells = " << tria->n_active_cells() << endl @@ -310,18 +303,44 @@ void TestCases::run (ParameterHandler &prm) { int main (int argc, char **argv) { - if (argc!=2) + if (argc!=3) { - cout << "Usage: grid_test parameterfile" << endl << endl; + cout << "Usage: grid_test dimension parameterfile" << endl << endl; return 1; }; - TestCases<2> tests; - MultipleParameterLoop input_data; + unsigned int dim; + if (argv[1][0] == '2') + dim = 2; + else + dim = 3; + + switch (dim) + { + case 2: + { + TestCases<2> tests; + MultipleParameterLoop input_data; + + tests.declare_parameters(input_data); + input_data.read_input (argv[2]); + input_data.loop (tests); + + break; + }; + + case 3: + { + TestCases<3> tests; + MultipleParameterLoop input_data; + + tests.declare_parameters(input_data); + input_data.read_input (argv[2]); + input_data.loop (tests); - tests.declare_parameters(input_data); - input_data.read_input (argv[1]); - input_data.loop (tests); + break; + }; + }; return 0; }; -- 2.39.5