From 44e6c18d7927c7531a4c17b10c25fd4aae67f383 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 5 Jul 2015 13:33:34 -0400 Subject: [PATCH] clean up tests and use to_string() --- tests/mpi/attach_data_01.cc | 15 ++++----------- tests/mpi/mesh_worker_01.cc | 7 ------- tests/mpi/mesh_worker_02.cc | 7 ------- tests/mpi/mesh_worker_03.cc | 7 ------- tests/mpi/mesh_worker_04.cc | 7 ------- tests/mpi/mesh_worker_05.cc | 7 ------- tests/mpi/mesh_worker_matrix_01.cc | 11 ++--------- 7 files changed, 6 insertions(+), 55 deletions(-) diff --git a/tests/mpi/attach_data_01.cc b/tests/mpi/attach_data_01.cc index f53a203bfd..081c0498ec 100644 --- a/tests/mpi/attach_data_01.cc +++ b/tests/mpi/attach_data_01.cc @@ -32,13 +32,6 @@ #include -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void pack_function (const typename parallel::distributed::Triangulation::cell_iterator &cell, const typename parallel::distributed::Triangulation::CellStatus status, @@ -116,13 +109,13 @@ void test() cell != tr.end(); ++cell) { - if (id_to_string(cell->id())=="0_1:0") - { + if (cell->id().to_string()=="0_1:0") + { cell->set_refine_flag(); } - else if (id_to_string(cell->parent()->id())=="3_0:") + else if (cell->parent()->id().to_string()=="3_0:") cell->set_coarsen_flag(); - + if (cell->is_locally_owned()) { deallog << "myid=" << myid << " cellid=" << cell->id(); diff --git a/tests/mpi/mesh_worker_01.cc b/tests/mpi/mesh_worker_01.cc index 997fa8199e..c58001d21c 100644 --- a/tests/mpi/mesh_worker_01.cc +++ b/tests/mpi/mesh_worker_01.cc @@ -129,13 +129,6 @@ test_simple(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) // lctrl); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void test_loop(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) { diff --git a/tests/mpi/mesh_worker_02.cc b/tests/mpi/mesh_worker_02.cc index a9048dac75..b4cc614654 100644 --- a/tests/mpi/mesh_worker_02.cc +++ b/tests/mpi/mesh_worker_02.cc @@ -128,13 +128,6 @@ test_simple(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) // lctrl); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void test_loop(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) { diff --git a/tests/mpi/mesh_worker_03.cc b/tests/mpi/mesh_worker_03.cc index 6007ee25a7..4d8883530b 100644 --- a/tests/mpi/mesh_worker_03.cc +++ b/tests/mpi/mesh_worker_03.cc @@ -128,13 +128,6 @@ test_simple(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) // lctrl); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void test_loop(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) { diff --git a/tests/mpi/mesh_worker_04.cc b/tests/mpi/mesh_worker_04.cc index 3b2a72b375..00a684982e 100644 --- a/tests/mpi/mesh_worker_04.cc +++ b/tests/mpi/mesh_worker_04.cc @@ -129,13 +129,6 @@ test_simple(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) // lctrl); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void test_loop(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) { diff --git a/tests/mpi/mesh_worker_05.cc b/tests/mpi/mesh_worker_05.cc index 60b0ca37eb..ed5c321f96 100644 --- a/tests/mpi/mesh_worker_05.cc +++ b/tests/mpi/mesh_worker_05.cc @@ -130,13 +130,6 @@ test_simple(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) // lctrl); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void test_loop(DoFHandler &dofs, MeshWorker::LoopControl &lctrl) { diff --git a/tests/mpi/mesh_worker_matrix_01.cc b/tests/mpi/mesh_worker_matrix_01.cc index 275b48e8bf..a350c07447 100644 --- a/tests/mpi/mesh_worker_matrix_01.cc +++ b/tests/mpi/mesh_worker_matrix_01.cc @@ -170,13 +170,6 @@ test_simple(DoFHandler &dofs, bool faces) matrix.print(deallog.get_file_stream()); } -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void @@ -218,7 +211,7 @@ test(const FiniteElement &fe) f >> id; if (f.eof()) break; - std::vector &d = dofmap[id_to_string(id)]; + std::vector &d = dofmap[id.to_string()]; d.reserve(fe.dofs_per_cell); for (unsigned int i=0; i &fe) if (!cell->is_locally_owned()) continue; - std::vector &renumbered = dofmap[id_to_string(cell->id())]; + std::vector &renumbered = dofmap[cell->id().to_string()]; cell->set_dof_indices(renumbered); cell->update_cell_dof_indices_cache(); -- 2.39.5