From: Matthias Maier Date: Mon, 4 May 2015 11:53:12 +0000 (+0200) Subject: fixup X-Git-Tag: v8.3.0-rc1~202^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e97b358051a52b6a190b643c820c5a08705267e;p=dealii.git fixup --- diff --git a/tests/lac/block_vector_move_operations.with_cxx11=on.output b/tests/lac/block_vector_move_operations.with_cxx11=on.output index e69de29bb2..bf0d55296d 100644 --- a/tests/lac/block_vector_move_operations.with_cxx11=on.output +++ b/tests/lac/block_vector_move_operations.with_cxx11=on.output @@ -0,0 +1,40 @@ + +DEAL::Block vector: move constructor: +DEAL::[block 0 ] 0.00000 0.00000 +DEAL::[block 1 ] 0.00000 0.00000 +DEAL::[block 2 ] 0.00000 0.00000 +DEAL::[block 3 ] 0.00000 0.00000 +DEAL::[block 4 ] 0.00000 0.00000 +DEAL:: +DEAL::Block vector: BlockVector: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: copy assignemnt: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: old object: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: move assignemnt: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::old object size: 5 +DEAL::Block vector: move assignemnt: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::old object size: 0 diff --git a/tests/lac/vector_move_operations.cc b/tests/lac/vector_move_operations.cc index 951c5003c4..fbc4b5a3a6 100644 --- a/tests/lac/vector_move_operations.cc +++ b/tests/lac/vector_move_operations.cc @@ -46,6 +46,7 @@ int main() deallog << "old object size: " << u.size() << std::endl; // and swap again with different sizes + u.reinit(0); u = std::move(v); deallog << "move assignment: " << u; deallog << "old object size: " << v.size() << std::endl; diff --git a/tests/lac/vector_move_operations.with_cxx11=on.output b/tests/lac/vector_move_operations.with_cxx11=on.output index 25f8614359..2bd7dd57de 100644 --- a/tests/lac/vector_move_operations.with_cxx11=on.output +++ b/tests/lac/vector_move_operations.with_cxx11=on.output @@ -5,6 +5,6 @@ DEAL::vector: 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8 DEAL::copy assignment: 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10.0000 DEAL::old object: 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10.0000 DEAL::move assignment: 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10.0000 -DEAL::old object size: 0 +DEAL::old object size: 10 DEAL::move assignment: 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10.0000 DEAL::old object size: 0 diff --git a/tests/trilinos/block_vector_move_operations.cc b/tests/trilinos/block_vector_move_operations.cc new file mode 100644 index 0000000000..3fedf645ae --- /dev/null +++ b/tests/trilinos/block_vector_move_operations.cc @@ -0,0 +1,68 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2012 - 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include "../tests.h" +#include +#include + +#define PRINTBLOCK(name, var) \ + deallog << "Block vector: " name << ":" << std::endl; \ + for (unsigned int i = 0; i < var.n_blocks(); ++i) \ + { \ + deallog << "[block " << i << " ] "; \ + for (unsigned int j = 0; j < var.block(i).size(); ++j) \ + deallog << var.block(i)[j] << " "; \ + deallog << std::endl; \ + } + + +int main (int argc, char **argv) +{ + initlog(); + + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, numbers::invalid_unsigned_int); + + { + std::vector local_owned(5); + for (auto &index : local_owned) + { + index.set_size(2); + index.add_range(0,2); + } + + TrilinosWrappers::MPI::BlockVector temp(local_owned, MPI_COMM_WORLD); + for (unsigned int i = 0; i < 5; ++i) + for (unsigned int j = 0; j < 2; ++j) + temp.block(i)[j] = (double)(10 * i + j); + + PRINTBLOCK("BlockVector", temp); + + TrilinosWrappers::MPI::BlockVector u(std::move(temp)); + PRINTBLOCK("move constructor", u); + + TrilinosWrappers::MPI::BlockVector v; + v = u; + PRINTBLOCK("copy assignemnt", v); + PRINTBLOCK("old object", u); + + v.reinit(0); + v = std::move(u); + PRINTBLOCK("move assignemnt", v); + deallog << "old object size: " << u.n_blocks() << std::endl; + } +} + + diff --git a/tests/trilinos/block_vector_move_operations.with_cxx11=on.output b/tests/trilinos/block_vector_move_operations.with_cxx11=on.output new file mode 100644 index 0000000000..c944639e55 --- /dev/null +++ b/tests/trilinos/block_vector_move_operations.with_cxx11=on.output @@ -0,0 +1,32 @@ + +DEAL::Block vector: BlockVector: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: move constructor: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: copy assignemnt: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: old object: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::Block vector: move assignemnt: +DEAL::[block 0 ] 0.00000 1.00000 +DEAL::[block 1 ] 10.0000 11.0000 +DEAL::[block 2 ] 20.0000 21.0000 +DEAL::[block 3 ] 30.0000 31.0000 +DEAL::[block 4 ] 40.0000 41.0000 +DEAL::old object size: 0 diff --git a/tests/trilinos/vector_move_operations.cc b/tests/trilinos/vector_move_operations.cc index 97e495da86..5e6b5fd8d6 100644 --- a/tests/trilinos/vector_move_operations.cc +++ b/tests/trilinos/vector_move_operations.cc @@ -24,17 +24,6 @@ deallog << var[i] << " "; \ deallog << std::endl; -#define PRINTBLOCK(name, var) \ - deallog << "Block vector: " name << ":" << std::endl; \ - for (unsigned int i = 0; i < var.n_blocks(); ++i) \ - { \ - deallog << "[block " << i << " ] "; \ - for (unsigned int j = 0; j < var.block(i).size(); ++j) \ - deallog << var.block(i)[j] << " "; \ - deallog << std::endl; \ - } - - int main (int argc, char **argv) { initlog(); @@ -64,37 +53,6 @@ int main (int argc, char **argv) PRINTME("move assignemnt", v); deallog << "old object size: " << u.size() << std::endl; } - - deallog << std::endl; - - { - std::vector local_owned(5); - for (auto &index : local_owned) - { - index.set_size(2); - index.add_range(0,2); - } - - TrilinosWrappers::MPI::BlockVector temp(local_owned, MPI_COMM_WORLD); - for (unsigned int i = 0; i < 5; ++i) - for (unsigned int j = 0; j < 2; ++j) - temp.block(i)[j] = (double)(10 * i + j); - - PRINTBLOCK("BlockVector", temp); - - TrilinosWrappers::MPI::BlockVector u(std::move(temp)); - PRINTME("move constructor", u); - - TrilinosWrappers::MPI::BlockVector v; - v = u; - PRINTBLOCK("copy assignemnt", v); - PRINTBLOCK("old object", u); - - v.reinit(0); - v = std::move(u); - PRINTBLOCK("move assignemnt", v); - deallog << "old object size: " << u.n_blocks() << std::endl; - } } diff --git a/tests/trilinos/vector_move_operations.with_cxx11=on.output b/tests/trilinos/vector_move_operations.with_cxx11=on.output index 5cee774607..d932a34f43 100644 --- a/tests/trilinos/vector_move_operations.with_cxx11=on.output +++ b/tests/trilinos/vector_move_operations.with_cxx11=on.output @@ -10,35 +10,3 @@ DEAL::1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10 DEAL::Vector: move assignemnt: DEAL::1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 10.0000 DEAL::old object size: 0 -DEAL:: -DEAL::Block vector: BlockVector: -DEAL::[block 0 ] 0.00000 1.00000 -DEAL::[block 1 ] 10.0000 11.0000 -DEAL::[block 2 ] 20.0000 21.0000 -DEAL::[block 3 ] 30.0000 31.0000 -DEAL::[block 4 ] 40.0000 41.0000 -DEAL::Block vector: move constructor: -DEAL::[block 0 ] 0.00000 1.00000 -DEAL::[block 1 ] 10.0000 11.0000 -DEAL::[block 2 ] 20.0000 21.0000 -DEAL::[block 3 ] 30.0000 31.0000 -DEAL::[block 4 ] 40.0000 41.0000 -DEAL::Block vector: copy assignemnt: -DEAL::[block 0 ] 0.00000 1.00000 -DEAL::[block 1 ] 10.0000 11.0000 -DEAL::[block 2 ] 20.0000 21.0000 -DEAL::[block 3 ] 30.0000 31.0000 -DEAL::[block 4 ] 40.0000 41.0000 -DEAL::Block vector: old object: -DEAL::[block 0 ] 0.00000 1.00000 -DEAL::[block 1 ] 10.0000 11.0000 -DEAL::[block 2 ] 20.0000 21.0000 -DEAL::[block 3 ] 30.0000 31.0000 -DEAL::[block 4 ] 40.0000 41.0000 -DEAL::Block vector: move assignemnt: -DEAL::[block 0 ] 0.00000 1.00000 -DEAL::[block 1 ] 10.0000 11.0000 -DEAL::[block 2 ] 20.0000 21.0000 -DEAL::[block 3 ] 30.0000 31.0000 -DEAL::[block 4 ] 40.0000 41.0000 -DEAL::old object size: 0