From: ESeNonFossiIo Date: Thu, 4 Jun 2015 10:47:57 +0000 (+0200) Subject: fixing rebase X-Git-Tag: v8.3.0-rc1~125^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5a376ffa6b09a9bdfa6c99b61e31d10e41bfced;p=dealii.git fixing rebase --- diff --git a/build/tests/lac/block_linear_operator_08.debug/block_linear_operator_08.debug b/build/tests/lac/block_linear_operator_08.debug/block_linear_operator_08.debug deleted file mode 100755 index 022ef9ff34..0000000000 Binary files a/build/tests/lac/block_linear_operator_08.debug/block_linear_operator_08.debug and /dev/null differ diff --git a/build/tests/lac/block_linear_operator_08.debug/diff b/build/tests/lac/block_linear_operator_08.debug/diff deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/build/tests/lac/block_linear_operator_08.debug/interrupt_guard.cc_bck b/build/tests/lac/block_linear_operator_08.debug/interrupt_guard.cc_bck deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/build/tests/lac/block_linear_operator_08.release/block_linear_operator_08.release b/build/tests/lac/block_linear_operator_08.release/block_linear_operator_08.release deleted file mode 100755 index 986c2d5a06..0000000000 Binary files a/build/tests/lac/block_linear_operator_08.release/block_linear_operator_08.release and /dev/null differ diff --git a/build/tests/lac/block_linear_operator_08.release/diff b/build/tests/lac/block_linear_operator_08.release/diff deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/build/tests/lac/block_linear_operator_08.release/interrupt_guard.cc_bck b/build/tests/lac/block_linear_operator_08.release/interrupt_guard.cc_bck deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/build/tests/lac/block_linear_operator_08.release/output b/build/tests/lac/block_linear_operator_08.release/output deleted file mode 100644 index 9d3ee42e60..0000000000 --- a/build/tests/lac/block_linear_operator_08.release/output +++ /dev/null @@ -1,37 +0,0 @@ - -DEAL::Block vector: u1: -DEAL::[block 0 ] 0.0 1.0 -DEAL::[block 1 ] 1.0 2.0 -DEAL::Block vector: u2: -DEAL::[block 0 ] 0.0 1.0 -DEAL::[block 1 ] 1.0 2.0 -DEAL::Block vector: v1: -DEAL::[block 0 ] 1.0 1.0 -DEAL::[block 1 ] 1.0 1.0 -DEAL::Block vector: v2: -DEAL::[block 0 ] 1.0 1.0 -DEAL::[block 1 ] 1.0 1.0 -DEAL::Block vector: v1: -DEAL::[block 0 ] 0.0 0.0 -DEAL::[block 1 ] 2.0 3.0 -DEAL::Block vector: v2: -DEAL::[block 0 ] 0.0 0.0 -DEAL::[block 1 ] 2.0 3.0 -DEAL::Block vector: v1: -DEAL::[block 0 ] 5.0 8.0 -DEAL::[block 1 ] 0.0 0.0 -DEAL::Block vector: v2: -DEAL::[block 0 ] 5.0 8.0 -DEAL::[block 1 ] 0.0 0.0 -DEAL::Block vector: v1: -DEAL::[block 0 ] 1.0 1.0 -DEAL::[block 1 ] 3.0 4.0 -DEAL::Block vector: v2: -DEAL::[block 0 ] 1.0 1.0 -DEAL::[block 1 ] 3.0 4.0 -DEAL::Block vector: v1: -DEAL::[block 0 ] 6.0 9.0 -DEAL::[block 1 ] 1.0 1.0 -DEAL::Block vector: v2: -DEAL::[block 0 ] 6.0 9.0 -DEAL::[block 1 ] 1.0 1.0 diff --git a/tests/lac/block_linear_operator_08.cc b/tests/lac/block_linear_operator_08.cc new file mode 100644 index 0000000000..cd37399088 --- /dev/null +++ b/tests/lac/block_linear_operator_08.cc @@ -0,0 +1,151 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + +// Test upper_triangular_block_op and lower_triangular_operator +// (in the case of array of array of LinearOperator as argument) +// simultaneously: + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include + +#define PRINTME(name, var) \ + deallog << "Block vector: " name << ":" << std::endl; \ + for (unsigned int j = 0; j < 2; ++j) \ + deallog << "[block " << j << " ] " << var.block(j); + +void reinit_vec(BlockVector &u1, BlockVector &u2, BlockVector &v1, BlockVector &v2) +{ + for(unsigned int i = 0; i<2; ++i) + { + for(unsigned int j = 0; j<2; ++j) + { + u1.block(i)[j] = i+j; + u2.block(i)[j] = i+j; + v1.block(i)[j] = 1; + v2.block(i)[j] = 1; + } + } +} + +using namespace dealii; + +int main() +{ + initlog(); + deallog << std::setprecision(2); + + // BlockSparseMatrix: + { + BlockSparsityPattern dsp(2,2); + // set sizes + for (unsigned int i=0; i<2; ++i) + for (unsigned int j=0; j<2; ++j) + dsp.block(i,j).reinit ( 2, 2, 5); + dsp.collect_sizes (); + + for (unsigned int row=0; row<4; ++row) + for (unsigned int i=0; i<4; ++i) + dsp.add (row, i); + dsp.compress (); + + BlockSparseMatrix a (dsp); + + for (unsigned int i = 0; i < 2; ++i) + for (unsigned int j = 0; j < 2; ++j) + for (unsigned int h = 0; h < 2; ++h) + for (unsigned int k = 0; k < 2; ++k) + a.block(i,j).set(h, k, j + i + h + k); + + auto op00 = linear_operator,Vector>(a.block(0,0)); + auto op01 = linear_operator,Vector>(a.block(0,1)); + auto op10 = linear_operator,Vector>(a.block(1,0)); + auto op11 = linear_operator,Vector>(a.block(1,1)); + + auto lower_triangular_block_op = + lower_triangular_operator< 2, + BlockVector, + BlockVector>({{ + {{ op00, op01 }} , + {{ op10, op11 }} + } + }); + auto upper_triangular_block_op = + upper_triangular_operator< 2, + BlockVector, + BlockVector>({{ + {{ op00, op01 }} , + {{ op10, op11 }} + } + }); + + BlockVector u1; + lower_triangular_block_op.reinit_domain_vector(u1, false); + BlockVector v1; + lower_triangular_block_op.reinit_range_vector(v1, false); + BlockVector u2; + upper_triangular_block_op.reinit_domain_vector(u2, false); + BlockVector v2; + upper_triangular_block_op.reinit_range_vector(v2, false); + + + // check 1 + reinit_vec(u1,u2,v1,v2); + PRINTME("u1", u1); + PRINTME("u2", u2); + PRINTME("v1", v1); + PRINTME("v2", v2); + + lower_triangular_block_op.vmult(v1, u1); + upper_triangular_block_op.Tvmult(v2, u2); + + PRINTME("v1", v1); + PRINTME("v2", v2); + + + // check 2 + reinit_vec(u1,u2,v1,v2); + + lower_triangular_block_op.Tvmult(v1, u1); + upper_triangular_block_op.vmult(v2, u2); + + PRINTME("v1", v1); + PRINTME("v2", v2); + + // check 3 + reinit_vec(u1,u2,v1,v2); + + lower_triangular_block_op.vmult_add(v1, u1); + upper_triangular_block_op.Tvmult_add(v2, u2); + + PRINTME("v1", v1); + PRINTME("v2", v2); + + + // check 4 + reinit_vec(u1,u2,v1,v2); + + lower_triangular_block_op.Tvmult_add(v1, u1); + upper_triangular_block_op.vmult_add(v2, u2); + + PRINTME("v1", v1); + PRINTME("v2", v2); + } +} diff --git a/build/tests/lac/block_linear_operator_08.debug/output b/tests/lac/block_linear_operator_08.with_cxx11=on.output similarity index 100% rename from build/tests/lac/block_linear_operator_08.debug/output rename to tests/lac/block_linear_operator_08.with_cxx11=on.output