From 029fad20b24731fbd8311805b5888f56a80be1c8 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 27 Jun 2011 16:33:32 +0000 Subject: [PATCH] Omit unused variables. git-svn-id: https://svn.dealii.org/trunk@23869 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/chunk_sparse_matrix_01a.cc | 3 +- tests/deal.II/refinement_listener_02.cc | 12 ++-- tests/deal.II/refinement_listener_03.cc | 13 ++-- tests/fe/rt_9.cc | 1 - tests/hp/hp_hanging_nodes_01.cc | 30 ++++---- tests/mpi/constraint_matrix_trilinos_bug.cc | 5 +- tests/mpi/interpolate_01.cc | 8 +-- tests/mpi/p4est_2d_constraintmatrix_02.cc | 1 - tests/mpi/p4est_2d_constraintmatrix_03.cc | 29 ++++---- tests/mpi/p4est_2d_constraintmatrix_04.cc | 80 ++++++++------------- tests/mpi/p4est_2d_constraintmatrix_05.cc | 3 - tests/mpi/p4est_3d_constraintmatrix_03.cc | 18 ----- 12 files changed, 79 insertions(+), 124 deletions(-) diff --git a/tests/bits/chunk_sparse_matrix_01a.cc b/tests/bits/chunk_sparse_matrix_01a.cc index c2f2fbca3c..b5e51e0f07 100644 --- a/tests/bits/chunk_sparse_matrix_01a.cc +++ b/tests/bits/chunk_sparse_matrix_01a.cc @@ -62,10 +62,9 @@ void test (const unsigned int chunk_size) // chunk_size>1, then this isn't // necessarily true bool exc_thrown = false; - double d; try { - d = m(i,j); + m(i,j); } catch (const std::exception &) { diff --git a/tests/deal.II/refinement_listener_02.cc b/tests/deal.II/refinement_listener_02.cc index 7da2a2e29d..ef529bff69 100644 --- a/tests/deal.II/refinement_listener_02.cc +++ b/tests/deal.II/refinement_listener_02.cc @@ -37,7 +37,7 @@ pre_refinement_notification (const std::string &prefix, deallog << prefix << ' ' << "Pre-refinement: " << tria.n_active_cells() << std::endl; } - + template void post_refinement_notification (const std::string &prefix, @@ -46,7 +46,7 @@ post_refinement_notification (const std::string &prefix, deallog << prefix << ' ' << "Post-refinement: " << tria.n_active_cells() << std::endl; } - + template void copy_notification (const std::string &prefix, @@ -58,7 +58,7 @@ copy_notification (const std::string &prefix, << new_tria.n_active_cells() << std::endl; } - + template void create_notification (const std::string &prefix, @@ -115,8 +115,8 @@ void test () std_cxx1x::_1, std_cxx1x::cref(tria_2))) }; - - + + // this should print the create note GridGenerator::hyper_cube(tria_1); @@ -134,6 +134,8 @@ void test () connections_1[i].disconnect (); tria_1.refine_global (2); + + (void)connections_2; } diff --git a/tests/deal.II/refinement_listener_03.cc b/tests/deal.II/refinement_listener_03.cc index 45f020c53c..99bf8ec5bc 100644 --- a/tests/deal.II/refinement_listener_03.cc +++ b/tests/deal.II/refinement_listener_03.cc @@ -36,7 +36,7 @@ pre_refinement_notification (const std::string &prefix, deallog << prefix << ' ' << "Pre-refinement: " << tria.n_active_cells() << std::endl; } - + template void post_refinement_notification (const std::string &prefix, @@ -45,7 +45,7 @@ post_refinement_notification (const std::string &prefix, deallog << prefix << ' ' << "Post-refinement: " << tria.n_active_cells() << std::endl; } - + template void copy_notification (const std::string &prefix, @@ -57,7 +57,7 @@ copy_notification (const std::string &prefix, << new_tria.n_active_cells() << std::endl; } - + template void create_notification (const std::string &prefix, @@ -132,8 +132,8 @@ void test () "tria_2", std_cxx1x::cref(tria_2))) }; - - + + // this should print the create note GridGenerator::hyper_cube(tria_1); @@ -157,6 +157,9 @@ void test () // and now really nothing connections_1[4].disconnect (); tria_1.refine_global (1); + + // avoid compiler warning + (void)connections_2; } diff --git a/tests/fe/rt_9.cc b/tests/fe/rt_9.cc index 7e4fe27e17..44125cbda6 100644 --- a/tests/fe/rt_9.cc +++ b/tests/fe/rt_9.cc @@ -49,7 +49,6 @@ test (const unsigned int degree) GridGenerator::hyper_cube(tr, 0., 1.); DoFHandler dof(tr); - typename DoFHandler::cell_iterator c = dof.begin(); dof.distribute_dofs(fe_rt); QTrapez<1> q_trapez; diff --git a/tests/hp/hp_hanging_nodes_01.cc b/tests/hp/hp_hanging_nodes_01.cc index 52bea53c1e..a2a82edbca 100644 --- a/tests/hp/hp_hanging_nodes_01.cc +++ b/tests/hp/hp_hanging_nodes_01.cc @@ -61,13 +61,13 @@ int generate_grid (Triangulation &tria) p1(d) = 0; p2(d) = (d == 0) ? 2.0 : 1.0; sub_div.push_back ( (d == 0) ? 2 : 1); - } + } GridGenerator::subdivided_hyper_rectangle (tria, sub_div, p1, p2, true); // Refine the first cell. tria.begin_active ()->set_refine_flag (); tria.execute_coarsening_and_refinement (); - + return (0); } @@ -99,19 +99,19 @@ void test_constraints (hp::FECollection &fe_coll) cell->set_active_fe_index (fe_indx); ++fe_indx; } - + // Distribute DoFs; dof_handler.distribute_dofs (fe_coll); deallog << "DoFs: " << dof_handler.n_dofs () << std::endl; - + // Create the constraints. ConstraintMatrix constraint_matrix; - + DoFTools::make_hanging_node_constraints (dof_handler, constraint_matrix); // Output the constraints - constraint_matrix.print (deallog.get_file_stream ()); + constraint_matrix.print (deallog.get_file_stream ()); } @@ -133,16 +133,14 @@ void test_constraints_old (FiniteElement &fe) // active_fe_indices to // the different cells. DoFHandler dof_handler (tria); - typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active (), - endc = dof_handler.end (); - + // Distribute DoFs; dof_handler.distribute_dofs (fe); deallog << "DoFs: " << dof_handler.n_dofs () << std::endl; - + // Create the constraints. ConstraintMatrix constraint_matrix; - + DoFTools::make_hanging_node_constraints (dof_handler, constraint_matrix); @@ -150,15 +148,15 @@ void test_constraints_old (FiniteElement &fe) constraint_matrix.print (deallog.get_file_stream ()); } -int main () +int main () { std::ofstream logfile("hp_hanging_nodes_01/output"); logfile.precision(2); - + deallog.attach(logfile); deallog.depth_console(0); deallog.threshold_double(1.e-10); - + FE_Q<2> fe_1 (1); FE_Q<2> fe_2 (2); FE_Q<2> fe_3 (3); @@ -169,8 +167,8 @@ int main () fe_coll2.push_back (fe_2); fe_coll2.push_back (fe_2); - fe_coll2.push_back (fe_3); - + fe_coll2.push_back (fe_3); + test_constraints<2> (fe_coll2); test_constraints_old<2> (fe_1); diff --git a/tests/mpi/constraint_matrix_trilinos_bug.cc b/tests/mpi/constraint_matrix_trilinos_bug.cc index 7116fc1135..e398dbbad0 100644 --- a/tests/mpi/constraint_matrix_trilinos_bug.cc +++ b/tests/mpi/constraint_matrix_trilinos_bug.cc @@ -95,7 +95,6 @@ template void test() { unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); parallel::distributed::Triangulation tr(MPI_COMM_WORLD); @@ -175,8 +174,8 @@ void test() x_rel = x; //l2_norm() not possible for ghosted vectors... - double a=0;//x_test.l2_norm(); - double b=0;//x_rel.l2_norm(); + //double a=0;//x_test.l2_norm(); + //double b=0;//x_rel.l2_norm(); /* if (myid==0) deallog << a << " vs " << b << std::endl; diff --git a/tests/mpi/interpolate_01.cc b/tests/mpi/interpolate_01.cc index 9080641c45..31f5e35e16 100644 --- a/tests/mpi/interpolate_01.cc +++ b/tests/mpi/interpolate_01.cc @@ -50,7 +50,6 @@ template void test() { unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); // create a mesh so that all but one // processor are empty @@ -80,10 +79,11 @@ void test() int main(int argc, char *argv[]) { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - MPI_Init (&argc,&argv); + Utilities::System::MPI_InitFinalize mpi (argc, argv); #else (void)argc; (void)argv; + compile_time_error; #endif unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); @@ -110,8 +110,4 @@ int main(int argc, char *argv[]) test<2>(); test<3>(); } - -#ifdef DEAL_II_COMPILER_SUPPORTS_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/p4est_2d_constraintmatrix_02.cc b/tests/mpi/p4est_2d_constraintmatrix_02.cc index 6d2631582f..e583349230 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_02.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_02.cc @@ -40,7 +40,6 @@ template void test() { unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); parallel::distributed::Triangulation tr(MPI_COMM_WORLD); diff --git a/tests/mpi/p4est_2d_constraintmatrix_03.cc b/tests/mpi/p4est_2d_constraintmatrix_03.cc index 4e0d9c9de3..95e6597a42 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_03.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_03.cc @@ -94,14 +94,13 @@ template void test() { unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); parallel::distributed::Triangulation tr(MPI_COMM_WORLD); const double R0 = 6371000.-2890000.; const double R1 = 6371000.- 35000.; - + GridGenerator::hyper_shell (tr, Point(), R0, @@ -111,7 +110,7 @@ void test() static HyperShellBoundary boundary; tr.set_boundary (0, boundary); tr.set_boundary (1, boundary); - + tr.refine_global (1); for (unsigned int step=0; step<20;++step) { @@ -125,7 +124,7 @@ void test() tr.execute_coarsening_and_refinement (); } - + DoFHandler dofh(tr); static FESystem fe (FE_Q(1+1), dim, @@ -134,7 +133,7 @@ void test() dofh.distribute_dofs (fe); IndexSet owned_set = dofh.locally_owned_dofs(); - + IndexSet dof_set; DoFTools::extract_locally_active_dofs (dofh, dof_set); @@ -150,27 +149,27 @@ void test() x_rel.reinit(relevant_set, MPI_COMM_WORLD); x_rel = 0; x_rel.compress(); - + ConstraintMatrix cm(relevant_set); DoFTools::make_hanging_node_constraints (dofh, cm); std::vector velocity_mask (dim+1, true); - + velocity_mask[dim] = false; - + VectorTools::interpolate_boundary_values (dofh, 0, ZeroFunction(dim+1), cm, - velocity_mask); + velocity_mask); std::set no_normal_flux_boundaries; no_normal_flux_boundaries.insert (1); - + VectorTools::compute_no_normal_flux_constraints (dofh, 0, no_normal_flux_boundaries, cm); - + cm.close (); cm.distribute(x); @@ -188,7 +187,7 @@ void test() for (unsigned int i=0; i::type_dof_data, data_component_interpretation); @@ -203,16 +202,16 @@ void test() TrilinosWrappers::Vector x_dub; x_dub.reinit(dof_set.size()); x_dub = x_rel; - + if (myid==0) { std::ofstream file((std::string("p4est_2d_constraintmatrix_03/dat.") + Utilities::int_to_string(myid)).c_str()); file << "**** proc " << myid << std::endl; x_dub.print(file); } - + MPI_Barrier(MPI_COMM_WORLD); - + if (myid==0) { cat_file((std::string("p4est_2d_constraintmatrix_03/dat.") + Utilities::int_to_string(0)).c_str()); diff --git a/tests/mpi/p4est_2d_constraintmatrix_04.cc b/tests/mpi/p4est_2d_constraintmatrix_04.cc index b0388ea578..b2d022d761 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_04.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_04.cc @@ -114,21 +114,6 @@ double TemperatureInitialValues::value (const Point &p, const unsigned int) const { - const double r = p.norm(); - const double h = R1-R0; - - const double s = (r-R0)/h; -// see http://www.wolframalpha.com/input/?i=plot+(sqrt(x^2%2By^2)*0.95%2B0.05*sin(6*atan2(x,y))),+x%3D-1+to+1,+y%3D-1+to+1 - - double s_mod = s*0.95 + 0.05*sin(6.0*atan2(p(0),p(1))); -//alternative: http://www.wolframalpha.com/input/?i=plot+atan((sqrt(x^2%2By^2)*0.95%2B0.05*sin(6*atan2(x,y))-0.5)*10)/pi%2B0.5,+x%3D-1+to+1,+y%3D-1+to+1 -// s_mod = atan((s_mod-0.5)*10.0)/dealii::numbers::PI+0.5; - -// return T1+(T0-T1)*(1.0-s_mod); - - //old: -// return T1+(T0-T1)*((1-s)*(1-s)); //old -// return T1+(T0-T1)*((1-s)); //linear return p(0)*T1+p(1)*(T0-T1); //simple } @@ -146,15 +131,12 @@ TemperatureInitialValues::vector_value (const Point &p, template void test() { - unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); - parallel::distributed::Triangulation tr(MPI_COMM_WORLD); // GridGenerator::hyper_cube(tr); - - + + GridGenerator::hyper_shell (tr, Point(), R0, @@ -164,7 +146,7 @@ void test() static HyperShellBoundary boundary; // tr.set_boundary (0, boundary); // tr.set_boundary (1, boundary); - + tr.refine_global (3); if (1) for (unsigned int step=0; step<5;++step) @@ -172,22 +154,22 @@ void test() typename Triangulation::active_cell_iterator cell = tr.begin_active(), endc = tr.end(); - + for (; cell!=endc; ++cell) if (std::rand()%42==1) cell->set_refine_flag (); - + tr.execute_coarsening_and_refinement (); } - + DoFHandler dofh(tr); static FE_Q fe(2); - + dofh.distribute_dofs (fe); IndexSet owned_set = dofh.locally_owned_dofs(); - + IndexSet dof_set; DoFTools::extract_locally_active_dofs (dofh, dof_set); @@ -204,14 +186,14 @@ void test() TrilinosWrappers::MPI::Vector x_rel; x_rel.reinit(relevant_set, MPI_COMM_WORLD); x_rel = x; - + for (unsigned int steps=0;steps<3;++steps) - { + { { typename Triangulation::active_cell_iterator cell = tr.begin_active(), endc = tr.end(); - + for (; cell!=endc; ++cell) if (!cell->is_artificial() && !cell->is_ghost()) { @@ -219,7 +201,7 @@ void test() cell->set_refine_flag (); else if (std::rand()%7==1) cell->set_coarsen_flag (); - } + } } for (typename Triangulation::cell_iterator cell = tr.begin(); @@ -227,7 +209,7 @@ void test() { if (!cell->has_children()) continue; - + bool coarsen_me = false; for (unsigned int i=0;in_children();++i) if (cell->child(i)->coarsen_flag_set()) @@ -257,22 +239,22 @@ void test() - + parallel::distributed::SolutionTransfer trans(dofh); tr.prepare_coarsening_and_refinement(); - + trans.prepare_for_coarsening_and_refinement(x_rel); - - tr.execute_coarsening_and_refinement (); + + tr.execute_coarsening_and_refinement (); static FE_Q fe(1); - + dofh.distribute_dofs (fe); owned_set = dofh.locally_owned_dofs(); - + DoFTools::extract_locally_active_dofs (dofh, dof_set); DoFTools::extract_locally_relevant_dofs (dofh, relevant_set); @@ -280,17 +262,17 @@ void test() x.reinit(owned_set, MPI_COMM_WORLD); trans.interpolate(x); - + x_rel.reinit(relevant_set, MPI_COMM_WORLD); x_rel = 0; x_rel.compress(); - + ConstraintMatrix cm(relevant_set); DoFTools::make_hanging_node_constraints (dofh, cm); /* std::vector velocity_mask (dim+1, true); - + velocity_mask[dim] = false; - + VectorTools::interpolate_boundary_values (dofh, 0, ZeroFunction(1), @@ -306,27 +288,27 @@ void test() TrilinosWrappers::MPI::Vector x_ref; x_ref.reinit(owned_set, MPI_COMM_WORLD); - + VectorTools::interpolate(dofh, TemperatureInitialValues(), x_ref); x_ref.compress(); - + x_ref -= x; double err = x_ref.linfty_norm(); if (err>1.0e-12) if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0) deallog << "err:" << err << std::endl; - + // x_rel=x_ref; //uncomment to output error - + std::vector solution_names(1,"T"); - + FilteredDataOut data_out (tr.locally_owned_subdomain()); data_out.attach_dof_handler (dofh); - + data_out.add_data_vector(x_rel, solution_names); - + data_out.build_patches (1); const std::string filename = ("p4est_2d_constraintmatrix_04/solution." + Utilities::int_to_string @@ -334,7 +316,7 @@ void test() ".d2"); std::ofstream output (filename.c_str()); data_out.write_deal_II_intermediate (output); - + tr.set_boundary (0); tr.set_boundary (1); if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0) diff --git a/tests/mpi/p4est_2d_constraintmatrix_05.cc b/tests/mpi/p4est_2d_constraintmatrix_05.cc index 1a2c3a443d..6bab43c5f5 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_05.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_05.cc @@ -33,9 +33,6 @@ template void test() { - unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); - parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::hyper_cube(tr); diff --git a/tests/mpi/p4est_3d_constraintmatrix_03.cc b/tests/mpi/p4est_3d_constraintmatrix_03.cc index 1255376e6f..9628e548f0 100644 --- a/tests/mpi/p4est_3d_constraintmatrix_03.cc +++ b/tests/mpi/p4est_3d_constraintmatrix_03.cc @@ -113,21 +113,6 @@ double TemperatureInitialValues::value (const Point &p, const unsigned int) const { - const double r = p.norm(); - const double h = R1-R0; - - const double s = (r-R0)/h; -// see http://www.wolframalpha.com/input/?i=plot+(sqrt(x^2%2By^2)*0.95%2B0.05*sin(6*atan2(x,y))),+x%3D-1+to+1,+y%3D-1+to+1 - - double s_mod = s*0.95 + 0.05*sin(6.0*atan2(p(0),p(1))); -//alternative: http://www.wolframalpha.com/input/?i=plot+atan((sqrt(x^2%2By^2)*0.95%2B0.05*sin(6*atan2(x,y))-0.5)*10)/pi%2B0.5,+x%3D-1+to+1,+y%3D-1+to+1 -// s_mod = atan((s_mod-0.5)*10.0)/dealii::numbers::PI+0.5; - -// return T1+(T0-T1)*(1.0-s_mod); - - //old: -// return T1+(T0-T1)*((1-s)*(1-s)); //old -// return T1+(T0-T1)*((1-s)); //linear return p(0)*T1+p(1)*(T0-T1); //simple } @@ -145,9 +130,6 @@ TemperatureInitialValues::vector_value (const Point &p, template void test() { - unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); - unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD); - parallel::distributed::Triangulation tr(MPI_COMM_WORLD); -- 2.39.5