template <typename Number>
BlockVector &operator= (const ::dealii::BlockVector<Number> &v);
- /**
- * Reinitialize the BlockVector to contain as many blocks as there are
- * Epetra_Maps given in the input argument, according to the parallel
- * distribution of the individual components described in the maps.
- *
- * If <tt>omit_zeroing_entries==false</tt>, the vector is filled with
- * zeros.
- *
- * This function is deprecated.
- */
- void reinit (const std::vector<Epetra_Map> ¶llel_partitioning,
- const bool omit_zeroing_entries = false) DEAL_II_DEPRECATED;
-
/**
* Reinitialize the BlockVector to contain as many blocks as there are
* index sets given in the input argument, according to the parallel
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2011 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check correct behaviour of sadd of Trilinos vectors
-// if they have different Epetra maps
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/base/index_set.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <algorithm>
-
-void test ()
-{
- TrilinosWrappers::MPI::Vector ghosted, ghosted2, distributed, distributed2;
- //All processes should own 10 entries
- const int entries_per_process = 10;
- const int n_proc = Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
- IndexSet locally_owned(entries_per_process*n_proc);
- IndexSet locally_relevant(entries_per_process*n_proc);
- const int my_id = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
- const int begin_index = my_id*entries_per_process;
- const int end_index = (my_id+1)*entries_per_process;
- const int local_begin = std::max(0, begin_index-entries_per_process/2);
- const int local_end = entries_per_process*n_proc;
-
- locally_owned.add_range(begin_index, end_index);
- locally_relevant.add_range
- (local_begin, local_end);
-
- distributed.reinit(locally_owned, MPI_COMM_WORLD);
- distributed2.reinit(locally_owned, MPI_COMM_WORLD);
- ghosted.reinit (locally_owned, locally_relevant, MPI_COMM_WORLD);
- ghosted2.reinit (locally_owned, locally_relevant, MPI_COMM_WORLD);
-
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- distributed.sadd (2., ghosted);
- ghosted = distributed;
- deallog << "sadd (s, v)" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- distributed.sadd (2., 3., ghosted);
- ghosted = distributed;
- deallog << "sadd (s, a, v)" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- ghosted2 = distributed;
- ghosted2 *= 0.354;
- distributed.sadd (2., 3., ghosted, 4., ghosted2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w)" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- distributed=1.;
- ghosted=distributed;
- distributed2 = 7.22;
- distributed.sadd (2., 3., ghosted, 4., ghosted2, 5., distributed2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w, c, x)" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-}
-
-
-
-int main (int argc, char **argv)
-{
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
- unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
- deallog.push(Utilities::int_to_string(myid));
-
- if (myid == 0)
- {
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog << std::setprecision(4);
- deallog.threshold_double(1.e-10);
-
- test();
- }
- else
- test();
-
-}
+++ /dev/null
-
-DEAL:0::sadd (s, v)
-DEAL:0::0: 3.600
-DEAL:0::1: 3.600
-DEAL:0::2: 3.600
-DEAL:0::3: 3.600
-DEAL:0::4: 3.600
-DEAL:0::5: 3.600
-DEAL:0::6: 3.600
-DEAL:0::7: 3.600
-DEAL:0::8: 3.600
-DEAL:0::9: 3.600
-DEAL:0::sadd (s, a, v)
-DEAL:0::0: 6.800
-DEAL:0::1: 6.800
-DEAL:0::2: 6.800
-DEAL:0::3: 6.800
-DEAL:0::4: 6.800
-DEAL:0::5: 6.800
-DEAL:0::6: 6.800
-DEAL:0::7: 6.800
-DEAL:0::8: 6.800
-DEAL:0::9: 6.800
-DEAL:0::sadd (s, a, v, b, w)
-DEAL:0::0: 8.216
-DEAL:0::1: 8.216
-DEAL:0::2: 8.216
-DEAL:0::3: 8.216
-DEAL:0::4: 8.216
-DEAL:0::5: 8.216
-DEAL:0::6: 8.216
-DEAL:0::7: 8.216
-DEAL:0::8: 8.216
-DEAL:0::9: 8.216
-DEAL:0::sadd (s, a, v, b, w, c, x)
-DEAL:0::0: 42.52
-DEAL:0::1: 42.52
-DEAL:0::2: 42.52
-DEAL:0::3: 42.52
-DEAL:0::4: 42.52
-DEAL:0::5: 42.52
-DEAL:0::6: 42.52
-DEAL:0::7: 42.52
-DEAL:0::8: 42.52
-DEAL:0::9: 42.52
+++ /dev/null
-
-DEAL:0::sadd (s, v)
-DEAL:0::0: 3.600
-DEAL:0::1: 3.600
-DEAL:0::2: 3.600
-DEAL:0::3: 3.600
-DEAL:0::4: 3.600
-DEAL:0::5: 3.600
-DEAL:0::6: 3.600
-DEAL:0::7: 3.600
-DEAL:0::8: 3.600
-DEAL:0::9: 3.600
-DEAL:0::10: 3.600
-DEAL:0::11: 3.600
-DEAL:0::12: 3.600
-DEAL:0::13: 3.600
-DEAL:0::14: 3.600
-DEAL:0::15: 3.600
-DEAL:0::16: 3.600
-DEAL:0::17: 3.600
-DEAL:0::18: 3.600
-DEAL:0::19: 3.600
-DEAL:0::sadd (s, a, v)
-DEAL:0::0: 6.800
-DEAL:0::1: 6.800
-DEAL:0::2: 6.800
-DEAL:0::3: 6.800
-DEAL:0::4: 6.800
-DEAL:0::5: 6.800
-DEAL:0::6: 6.800
-DEAL:0::7: 6.800
-DEAL:0::8: 6.800
-DEAL:0::9: 6.800
-DEAL:0::10: 6.800
-DEAL:0::11: 6.800
-DEAL:0::12: 6.800
-DEAL:0::13: 6.800
-DEAL:0::14: 6.800
-DEAL:0::15: 6.800
-DEAL:0::16: 6.800
-DEAL:0::17: 6.800
-DEAL:0::18: 6.800
-DEAL:0::19: 6.800
-DEAL:0::sadd (s, a, v, b, w)
-DEAL:0::0: 8.216
-DEAL:0::1: 8.216
-DEAL:0::2: 8.216
-DEAL:0::3: 8.216
-DEAL:0::4: 8.216
-DEAL:0::5: 8.216
-DEAL:0::6: 8.216
-DEAL:0::7: 8.216
-DEAL:0::8: 8.216
-DEAL:0::9: 8.216
-DEAL:0::10: 8.216
-DEAL:0::11: 8.216
-DEAL:0::12: 8.216
-DEAL:0::13: 8.216
-DEAL:0::14: 8.216
-DEAL:0::15: 8.216
-DEAL:0::16: 8.216
-DEAL:0::17: 8.216
-DEAL:0::18: 8.216
-DEAL:0::19: 8.216
-DEAL:0::sadd (s, a, v, b, w, c, x)
-DEAL:0::0: 42.52
-DEAL:0::1: 42.52
-DEAL:0::2: 42.52
-DEAL:0::3: 42.52
-DEAL:0::4: 42.52
-DEAL:0::5: 42.52
-DEAL:0::6: 42.52
-DEAL:0::7: 42.52
-DEAL:0::8: 42.52
-DEAL:0::9: 42.52
-DEAL:0::10: 42.52
-DEAL:0::11: 42.52
-DEAL:0::12: 42.52
-DEAL:0::13: 42.52
-DEAL:0::14: 42.52
-DEAL:0::15: 42.52
-DEAL:0::16: 42.52
-DEAL:0::17: 42.52
-DEAL:0::18: 42.52
-DEAL:0::19: 42.52
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2011 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check correct behaviour of sadd of Trilinos vectors
-// if there are processes that doesn't own anything
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/base/index_set.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <algorithm>
-
-void test ()
-{
- TrilinosWrappers::MPI::Vector ghosted, ghosted2, distributed, distributed2;
- const unsigned int my_id = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
- const unsigned int n_proc = Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
- //All processes except for the last one own elements
- const int entries_per_process = (my_id==n_proc-1)?0:10;
- IndexSet locally_owned(entries_per_process*(n_proc-1));
- IndexSet locally_relevant(entries_per_process*(n_proc-1));
- const int begin_index = my_id*entries_per_process;
- const unsigned int end_index = (my_id+1)*entries_per_process;
- const unsigned int local_begin = std::max(0, begin_index-entries_per_process/2);
- const unsigned int local_end = entries_per_process*(n_proc-1);
-
- if (my_id != n_proc-1)
- {
- locally_owned.add_range(begin_index, end_index);
- locally_relevant.add_range(local_begin, local_end);
- }
-
- distributed.reinit(locally_owned, MPI_COMM_WORLD);
- distributed2.reinit(locally_owned, MPI_COMM_WORLD);
- ghosted.reinit (locally_owned, locally_relevant, MPI_COMM_WORLD);
- ghosted2.reinit (locally_owned, locally_relevant, MPI_COMM_WORLD);
-
- //sadd(s,v) with ghosted vector
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- distributed.sadd (2., ghosted);
- ghosted = distributed;
- deallog << "sadd (s, v) ghosted" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,v) with distributed vector
- distributed=1.;
- distributed.sadd (1.5, distributed);
- ghosted = distributed;
- deallog << "sadd (s, v) distributed" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v) with ghosted vector
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- distributed.sadd (2., 3., ghosted);
- ghosted = distributed;
- deallog << "sadd (s, a, v) ghosted" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v) with distributed vector
- distributed=1.;
- distributed.sadd (2., 3., distributed);
- ghosted = distributed;
- deallog << "sadd (s, a, v) distributed" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v,b,w) with ghosted vector
- distributed=1.;
- ghosted=distributed;
- ghosted *= 1.6;
- ghosted2 = distributed;
- ghosted2 *= 0.354;
- distributed.sadd (2., 3., ghosted, 4., ghosted2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w) ghosted" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v,b,w) with distributed vector
- distributed=1.;
- distributed2=1.6;
- distributed.sadd (2., 3., distributed, 4., distributed2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w) distributed" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v,b,w,c,x) with ghosted vector
- distributed=1.;
- ghosted=distributed;
- distributed2 = 7.22;
- ghosted2=distributed2;
- distributed.sadd (2., 3., ghosted, 4., ghosted2, 5., distributed2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w, c, x) ghosted" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-
- //sadd(s,a,v,b,w,c,x) with distributed vector
- distributed=1.;
- distributed2 = 7.22;
- distributed.sadd (2., 3., distributed, 4., distributed, 5., distributed2);
- ghosted = distributed;
- deallog << "sadd (s, a, v, b, w, c, x) distributed" <<std::endl;
- if (my_id==0)
- for (unsigned int i=local_begin; i<local_end; ++i)
- deallog << i << ": " << ghosted(i) << std::endl;
-}
-
-
-
-int main (int argc, char **argv)
-{
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
- unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
- deallog.push(Utilities::int_to_string(myid));
-
- if (myid == 0)
- {
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog << std::setprecision(4);
- deallog.threshold_double(1.e-10);
-
- test();
- }
- else
- test();
-
-}
+++ /dev/null
-
-DEAL:0::sadd (s, v) ghosted
-DEAL:0::0: 3.600
-DEAL:0::1: 3.600
-DEAL:0::2: 3.600
-DEAL:0::3: 3.600
-DEAL:0::4: 3.600
-DEAL:0::5: 3.600
-DEAL:0::6: 3.600
-DEAL:0::7: 3.600
-DEAL:0::8: 3.600
-DEAL:0::9: 3.600
-DEAL:0::10: 3.600
-DEAL:0::11: 3.600
-DEAL:0::12: 3.600
-DEAL:0::13: 3.600
-DEAL:0::14: 3.600
-DEAL:0::15: 3.600
-DEAL:0::16: 3.600
-DEAL:0::17: 3.600
-DEAL:0::18: 3.600
-DEAL:0::19: 3.600
-DEAL:0::sadd (s, v) distributed
-DEAL:0::0: 2.500
-DEAL:0::1: 2.500
-DEAL:0::2: 2.500
-DEAL:0::3: 2.500
-DEAL:0::4: 2.500
-DEAL:0::5: 2.500
-DEAL:0::6: 2.500
-DEAL:0::7: 2.500
-DEAL:0::8: 2.500
-DEAL:0::9: 2.500
-DEAL:0::10: 2.500
-DEAL:0::11: 2.500
-DEAL:0::12: 2.500
-DEAL:0::13: 2.500
-DEAL:0::14: 2.500
-DEAL:0::15: 2.500
-DEAL:0::16: 2.500
-DEAL:0::17: 2.500
-DEAL:0::18: 2.500
-DEAL:0::19: 2.500
-DEAL:0::sadd (s, a, v) ghosted
-DEAL:0::0: 6.800
-DEAL:0::1: 6.800
-DEAL:0::2: 6.800
-DEAL:0::3: 6.800
-DEAL:0::4: 6.800
-DEAL:0::5: 6.800
-DEAL:0::6: 6.800
-DEAL:0::7: 6.800
-DEAL:0::8: 6.800
-DEAL:0::9: 6.800
-DEAL:0::10: 6.800
-DEAL:0::11: 6.800
-DEAL:0::12: 6.800
-DEAL:0::13: 6.800
-DEAL:0::14: 6.800
-DEAL:0::15: 6.800
-DEAL:0::16: 6.800
-DEAL:0::17: 6.800
-DEAL:0::18: 6.800
-DEAL:0::19: 6.800
-DEAL:0::sadd (s, a, v) distributed
-DEAL:0::0: 5.000
-DEAL:0::1: 5.000
-DEAL:0::2: 5.000
-DEAL:0::3: 5.000
-DEAL:0::4: 5.000
-DEAL:0::5: 5.000
-DEAL:0::6: 5.000
-DEAL:0::7: 5.000
-DEAL:0::8: 5.000
-DEAL:0::9: 5.000
-DEAL:0::10: 5.000
-DEAL:0::11: 5.000
-DEAL:0::12: 5.000
-DEAL:0::13: 5.000
-DEAL:0::14: 5.000
-DEAL:0::15: 5.000
-DEAL:0::16: 5.000
-DEAL:0::17: 5.000
-DEAL:0::18: 5.000
-DEAL:0::19: 5.000
-DEAL:0::sadd (s, a, v, b, w) ghosted
-DEAL:0::0: 8.216
-DEAL:0::1: 8.216
-DEAL:0::2: 8.216
-DEAL:0::3: 8.216
-DEAL:0::4: 8.216
-DEAL:0::5: 8.216
-DEAL:0::6: 8.216
-DEAL:0::7: 8.216
-DEAL:0::8: 8.216
-DEAL:0::9: 8.216
-DEAL:0::10: 8.216
-DEAL:0::11: 8.216
-DEAL:0::12: 8.216
-DEAL:0::13: 8.216
-DEAL:0::14: 8.216
-DEAL:0::15: 8.216
-DEAL:0::16: 8.216
-DEAL:0::17: 8.216
-DEAL:0::18: 8.216
-DEAL:0::19: 8.216
-DEAL:0::sadd (s, a, v, b, w) distributed
-DEAL:0::0: 11.40
-DEAL:0::1: 11.40
-DEAL:0::2: 11.40
-DEAL:0::3: 11.40
-DEAL:0::4: 11.40
-DEAL:0::5: 11.40
-DEAL:0::6: 11.40
-DEAL:0::7: 11.40
-DEAL:0::8: 11.40
-DEAL:0::9: 11.40
-DEAL:0::10: 11.40
-DEAL:0::11: 11.40
-DEAL:0::12: 11.40
-DEAL:0::13: 11.40
-DEAL:0::14: 11.40
-DEAL:0::15: 11.40
-DEAL:0::16: 11.40
-DEAL:0::17: 11.40
-DEAL:0::18: 11.40
-DEAL:0::19: 11.40
-DEAL:0::sadd (s, a, v, b, w, c, x) ghosted
-DEAL:0::0: 69.98
-DEAL:0::1: 69.98
-DEAL:0::2: 69.98
-DEAL:0::3: 69.98
-DEAL:0::4: 69.98
-DEAL:0::5: 69.98
-DEAL:0::6: 69.98
-DEAL:0::7: 69.98
-DEAL:0::8: 69.98
-DEAL:0::9: 69.98
-DEAL:0::10: 69.98
-DEAL:0::11: 69.98
-DEAL:0::12: 69.98
-DEAL:0::13: 69.98
-DEAL:0::14: 69.98
-DEAL:0::15: 69.98
-DEAL:0::16: 69.98
-DEAL:0::17: 69.98
-DEAL:0::18: 69.98
-DEAL:0::19: 69.98
-DEAL:0::sadd (s, a, v, b, w, c, x) distributed
-DEAL:0::0: 45.10
-DEAL:0::1: 45.10
-DEAL:0::2: 45.10
-DEAL:0::3: 45.10
-DEAL:0::4: 45.10
-DEAL:0::5: 45.10
-DEAL:0::6: 45.10
-DEAL:0::7: 45.10
-DEAL:0::8: 45.10
-DEAL:0::9: 45.10
-DEAL:0::10: 45.10
-DEAL:0::11: 45.10
-DEAL:0::12: 45.10
-DEAL:0::13: 45.10
-DEAL:0::14: 45.10
-DEAL:0::15: 45.10
-DEAL:0::16: 45.10
-DEAL:0::17: 45.10
-DEAL:0::18: 45.10
-DEAL:0::19: 45.10
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
v.compress (VectorOperation::insert);
// then copy it
- TrilinosWrappers::Vector w (v.size());
+ TrilinosWrappers::Vector w;
+ w.reinit(v.size());
w = v;
// make sure they're equal
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
// then copy it to a vector of different
// size
- TrilinosWrappers::Vector w (1);
+ TrilinosWrappers::Vector w;
+ w.reinit(1);
w = v;
// make sure they're equal
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
+ TrilinosWrappers::Vector x;
+ x.reinit(100);
test (v,w,x);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check TrilinosWrappers::Vector::sadd(s,s,V,s,V)
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test (TrilinosWrappers::Vector &v,
- TrilinosWrappers::Vector &w,
- TrilinosWrappers::Vector &x)
-{
- for (unsigned int i=0; i<v.size(); ++i)
- {
- v(i) = i;
- w(i) = i+1.;
- x(i) = i+2.;
- }
-
- v.compress (VectorOperation::insert);
- w.compress (VectorOperation::insert);
- x.compress (VectorOperation::insert);
-
- v.sadd (1.5, 2, w, 3, x);
-
- // make sure we get the expected result
- for (unsigned int i=0; i<v.size(); ++i)
- {
- AssertThrow (w(i) == i+1., ExcInternalError());
- AssertThrow (x(i) == i+2., ExcInternalError());
- AssertThrow (v(i) == 1.5*i+2*(i+1.)+3*(i+2.), ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
- test (v,w,x);
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check TrilinosWrappers::Vector::sadd(s,s,V,s,V,s,V)
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test (TrilinosWrappers::Vector &v,
- TrilinosWrappers::Vector &w,
- TrilinosWrappers::Vector &x,
- TrilinosWrappers::Vector &y)
-{
- for (unsigned int i=0; i<v.size(); ++i)
- {
- v(i) = i;
- w(i) = i+1.;
- x(i) = i+2.;
- y(i) = i+3.;
- }
-
- v.compress (VectorOperation::insert);
- w.compress (VectorOperation::insert);
- x.compress (VectorOperation::insert);
- y.compress (VectorOperation::insert);
-
- v.sadd (1.5, 2, w, 3, x, 4, y);
-
- // make sure we get the expected result
- for (unsigned int i=0; i<v.size(); ++i)
- {
- AssertThrow (w(i) == i+1., ExcInternalError());
- AssertThrow (x(i) == i+2., ExcInternalError());
- AssertThrow (y(i) == i+3., ExcInternalError());
- AssertThrow (v(i) == 1.5*i+2*(i+1.)+3*(i+2.)+4*(i+3), ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
- TrilinosWrappers::Vector y (100);
- test (v,w,x,y);
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check TrilinosWrappers::Vector::equ (s,V,s,V)
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test (TrilinosWrappers::Vector &v,
- TrilinosWrappers::Vector &w,
- TrilinosWrappers::Vector &x)
-{
- for (unsigned int i=0; i<v.size(); ++i)
- {
- v(i) = i;
- w(i) = i+1.;
- x(i) = i+2.;
- }
-
- v.compress (VectorOperation::insert);
- w.compress (VectorOperation::insert);
- x.compress (VectorOperation::insert);
-
- v.equ (2, w, 3, x);
-
- // make sure we get the expected result
- for (unsigned int i=0; i<v.size(); ++i)
- {
- AssertThrow (w(i) == i+1., ExcInternalError());
- AssertThrow (x(i) == i+2., ExcInternalError());
- AssertThrow (v(i) == 2*(i+1.)+3*(i+2.), ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
- test (v,w,x);
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check TrilinosWrappers::Vector::ratio
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test (TrilinosWrappers::Vector &v,
- TrilinosWrappers::Vector &w,
- TrilinosWrappers::Vector &x)
-{
- for (unsigned int i=0; i<v.size(); ++i)
- {
- v(i) = i;
- w(i) = i+1.;
- x(i) = i+2.;
- }
-
- v.compress (VectorOperation::insert);
- w.compress (VectorOperation::insert);
- x.compress (VectorOperation::insert);
-
- v.ratio (w, x);
-
- // make sure we get the expected result
- const double eps=typeid(TrilinosScalar)==typeid(double) ? 1e-14 : 1e-5;
- for (unsigned int i=0; i<v.size(); ++i)
- {
- AssertThrow (w(i) == i+1., ExcInternalError());
- AssertThrow (x(i) == i+2., ExcInternalError());
- AssertThrow (std::fabs(v(i) - (i+1.)/(i+2.)) < eps*v(i),
- ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
- test (v,w,x);
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
void test (TrilinosWrappers::BlockVector &v)
{
std::vector<types::global_dof_index> sizes (2, 3);
- dealii::BlockVector<TrilinosScalar> w (sizes);
+ dealii::BlockVector<TrilinosScalar> w;
+ w.reinit(sizes);
for (unsigned int i=0; i<w.size(); ++i)
w(i) = i;
{
{
std::vector<types::global_dof_index> sizes (2, 3);
- TrilinosWrappers::BlockVector v (sizes);
+ TrilinosWrappers::BlockVector v;
+ v.reinit(sizes);
test (v);
}
}
// now also check the reverse assignment
w = 0;
- w = v;
+ TrilinosWrappers::BlockVector v_serial;
+ v_serial.reinit(v);
+ w = v_serial;
for (unsigned int i=0; i<v.size(); ++i)
{
AssertThrow (w(i) == i, ExcInternalError());
try
{
{
- std::vector<Epetra_Map> sizes;
- Epetra_Map map(TrilinosWrappers::types::int_type(3),
- TrilinosWrappers::types::int_type(3),
- 0,
- Utilities::Trilinos::comm_world());
- sizes.push_back (map);
- sizes.push_back (map);
-
- TrilinosWrappers::MPI::BlockVector v (sizes);
+ std::vector<IndexSet> sizes(2, complete_index_set(3));
+
+ TrilinosWrappers::MPI::BlockVector v;
+ v.reinit(sizes, MPI_COMM_WORLD);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// check TrilinosWrappers::Vector (const ::Vector &) copy constructor
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test (TrilinosWrappers::Vector &v)
-{
- // set only certain elements of the
- // vector.
- std::vector<bool> pattern (v.size(), false);
- for (unsigned int i=0; i<v.size(); i+=1+i)
- {
- v(i) += i;
- pattern[i] = true;
- }
-
- v.compress (VectorOperation::add);
-
- Vector<double> w (v);
- Vector<float> x (v);
-
- TrilinosWrappers::Vector w1 (w);
- TrilinosWrappers::Vector x1 (x);
-
- for (unsigned int i=0; i<v.size(); ++i)
- {
- AssertThrow (w1(i) == w(i), ExcInternalError());
- AssertThrow (x1(i) == x(i), ExcInternalError());
- }
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- TrilinosWrappers::Vector v (100);
- test (v);
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
Vector<float> x(v.size());
x=v;
- TrilinosWrappers::Vector w1(v.size());
+ TrilinosWrappers::Vector w1;
+ w1.reinit(v.size());
w1=w;
- TrilinosWrappers::Vector x1(v.size());
+ TrilinosWrappers::Vector x1;
+ x1.reinit(v.size());
x1=x;
for (unsigned int i=0; i<v.size(); ++i)
try
{
{
- TrilinosWrappers::Vector v (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
test (v);
}
}
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2004 - 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-// This test used to fail after upgrading to petsc 2.2.1
-
-
-#include "../tests.h"
-#include <deal.II/base/utilities.h>
-#include <deal.II/lac/trilinos_vector.h>
-
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-
-void test ()
-{
- TrilinosWrappers::MPI::Vector
- v (Epetra_Map(TrilinosWrappers::types::int_type(100),0,
- Utilities::Trilinos::comm_world()));
- v(0) = 1;
- v = 0;
-
- deallog << "OK" << std::endl;
-}
-
-
-
-int main (int argc,char **argv)
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads());
-
-
- try
- {
- {
- test ();
- }
- }
- catch (std::exception &exc)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Exception on processing: " << std::endl
- << exc.what() << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
-
- return 1;
- }
- catch (...)
- {
- std::cerr << std::endl << std::endl
- << "----------------------------------------------------"
- << std::endl;
- std::cerr << "Unknown exception!" << std::endl
- << "Aborting!" << std::endl
- << "----------------------------------------------------"
- << std::endl;
- return 1;
- };
-}
+++ /dev/null
-
-DEAL::OK
void test ()
{
- TrilinosWrappers::BlockVector v(2);
+ TrilinosWrappers::BlockVector v;
+ v.reinit(2);
for (unsigned int i=0; i<v.n_blocks(); ++i)
v.block(i).reinit(1);
v.collect_sizes();
void test ()
{
- TrilinosWrappers::BlockVector v(2);
+ TrilinosWrappers::BlockVector v;
+ v.reinit(2);
for (unsigned int i=0; i<v.n_blocks(); ++i)
v.block(i).reinit(1);
v.collect_sizes();
// ---------------------------------------------------------------------
-// this test is an adaptation of lac/block_vector_iterator for PETSc block
+// this test is an adaptation of lac/block_vector_iterator for Trilinos block
// vectors
#include "../tests.h"
// iterators
if (true)
{
- TrilinosWrappers::BlockVector v1(ivector);
- TrilinosWrappers::BlockVector v2(ivector);
+ TrilinosWrappers::BlockVector v1;
+ v1.reinit(ivector);
+ TrilinosWrappers::BlockVector v2;
+ v2.reinit(ivector);
// initialize first vector with
// simple loop
deallog << "Check 1: " << (v1==v2 ? "true" : "false") << std::endl;
};
- // Check 1: initialization via
- // iterators
- if (true)
- {
- TrilinosWrappers::BlockVector v1(ivector);
-
- // initialize first vector with
- // simple loop
- for (unsigned int i=0; i<v1.size(); ++i)
- v1(i) = i;
- // initialize other vector
- // through iterators into first
- // vector
- TrilinosWrappers::BlockVector v2(ivector, v1.begin(), v1.end());
- // check that the two vectors are equal
- deallog << "Check 2: " << (v1==v2 ? "true" : "false") << std::endl;
- };
-
- // Check 3: loop forward and back
+ // Check 2: loop forward and back
// and check that things are the
// same
if (true)
{
- TrilinosWrappers::BlockVector v1(ivector);
+ TrilinosWrappers::BlockVector v1;
+ v1.reinit(ivector);
// initialize first vector with
// simple loop
for (unsigned int i=0; i<v1.size(); ++i)
};
- // Check 4: same, but this time
+ // Check 3: same, but this time
// with const iterators
if (true)
{
- TrilinosWrappers::BlockVector v1(ivector);
+ TrilinosWrappers::BlockVector v1;
+ v1.reinit(ivector);
// initialize first vector with
// simple loop
for (unsigned int i=0; i<v1.size(); ++i)
deallog << "Check 4: true" << std::endl;
};
- // Checks 5-14: use some standard
+ // Checks 4-13: use some standard
// algorithms
if (true)
{
- TrilinosWrappers::BlockVector v1(ivector);
+ TrilinosWrappers::BlockVector v1;
+ v1.reinit(ivector);
// initialize first vector with
// simple loop
for (unsigned int i=0; i<v1.size(); ++i)
<< std::endl;
// check std::copy
- TrilinosWrappers::BlockVector v2(ivector);
+ TrilinosWrappers::BlockVector v2;
+ v2.reinit(ivector);
std::copy (v1.begin(), v1.end(), v2.begin());
deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl;
deallog << "Check 14: " << (p3 == v1.end() ? "true" : "false") << std::endl;
};
- // Check 15: initialization through
- // iterators
- if (true)
- {
- TrilinosWrappers::BlockVector v1(ivector);
- // initialize first vector with
- // simple loop
- for (unsigned int i=0; i<v1.size(); ++i)
- v1(i) = i;
-
- // initialize a normal vector
- // from it
- Vector<double> v2(v1.begin(), v1.end());
-
- // and reverse way
- TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
- deallog << "Check 15: " << (v1==v3 ? "true" : "false") << std::endl;
- };
-
- // Check 16: initialization through
- // iterators. variant with one
- // constant object
- if (true)
- {
- TrilinosWrappers::BlockVector v1(ivector);
- // initialize first vector with
- // simple loop
- for (unsigned int i=0; i<v1.size(); ++i)
- v1(i) = i;
-
- // initialize a normal vector
- // from it
- const Vector<double> v2(v1.begin(), v1.end());
-
- // and reverse way
- TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
- deallog << "Check 16: " << (v1==v3 ? "true" : "false") << std::endl;
- };
-
- // Check 17: initialization through
- // iterators. variant with two
- // constant object
- if (true)
- {
- TrilinosWrappers::BlockVector v1(ivector);
- // initialize first vector with
- // simple loop
- for (unsigned int i=0; i<v1.size(); ++i)
- v1(i) = i;
-
- // initialize a normal vector
- // from it
- const Vector<double> v2(v1.begin(), v1.end());
-
- // and reverse way
- const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
- deallog << "Check 17: " << (v1==v3 ? "true" : "false") << std::endl;
- };
-
- // Check 18: initialization through
- // iterators. variant with three
- // constant object
- if (true)
- {
- TrilinosWrappers::BlockVector v0(ivector);
- // initialize first vector with
- // simple loop
- for (unsigned int i=0; i<v0.size(); ++i)
- v0(i) = i;
-
- const TrilinosWrappers::BlockVector v1 = v0;
-
- // initialize a normal vector
- // from it
- const Vector<double> v2(v1.begin(), v1.end());
-
- // and reverse way
- const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
- deallog << "Check 18: " << (v1==v3 ? "true" : "false") << std::endl;
- };
-
- // Check 19: operator[]
+ // Check 15: operator[]
if (true)
{
- TrilinosWrappers::BlockVector v1(ivector);
+ TrilinosWrappers::BlockVector v1;
+ v1.reinit(ivector);
for (unsigned int i=0; i<v1.size(); ++i)
v1(i) = i;
// if we came thus far,
// everything is alright
- deallog << "Check 19: true" << std::endl;
+ deallog << "Check 15: true" << std::endl;
};
}
DEAL::Check 1: true
-DEAL::Check 2: true
DEAL::Check 3: true
DEAL::Check 4: true
DEAL::Check 5: true
DEAL::Check 13: true
DEAL::Check 14: true
DEAL::Check 15: true
-DEAL::Check 16: true
-DEAL::Check 17: true
-DEAL::Check 18: true
-DEAL::Check 19: true
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
// this is part of a whole suite of tests that checks the relative speed of
-// using PETSc for sparse matrices as compared to the speed of our own
-// library. the tests therefore may not all actually use PETSc, but they are
+// using Trilinos for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use Trilinos, but they are
// meant to compare it
//
// the tests build the 5-point stencil matrix for a uniform grid of size N*N
// then do a single matrix-vector
// multiplication with subsequent formation
// of the matrix norm
- TrilinosWrappers::Vector v1(N*N), v2(N*N);
+ TrilinosWrappers::Vector v1;
+ v1.reinit(N*N);
+ TrilinosWrappers::Vector v2;
+ v2.reinit(N*N);
for (unsigned int i=0; i<N*N; ++i)
v1(i) = i;
matrix.vmult (v2, v1);
// this is part of a whole suite of tests that checks the relative speed of
-// using PETSc for sparse matrices as compared to the speed of our own
-// library. the tests therefore may not all actually use PETSc, but they are
+// using Trilinos for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use Trilinos, but they are
// meant to compare it
//
// the tests build the 5-point stencil matrix for a uniform grid of size N*N
const unsigned int N = 200;
// build the sparse matrix
- Epetra_Map map (TrilinosWrappers::types::int_type(N*N), 0,
- Utilities::Trilinos::comm_world());
- TrilinosWrappers::SparseMatrix matrix (map, 5);
+ IndexSet indices = complete_index_set(N*N);
+ TrilinosWrappers::SparseMatrix matrix (indices, MPI_COMM_WORLD, 5);
for (unsigned int i=0; i<N; i++)
for (unsigned int j=0; j<N; j++)
{
// then do a single matrix-vector
// multiplication with subsequent formation
// of the matrix norm
- TrilinosWrappers::MPI::Vector v1(map);
- TrilinosWrappers::MPI::Vector v2(map);
+ TrilinosWrappers::MPI::Vector v1(indices, MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::Vector v2(indices, MPI_COMM_WORLD);
for (unsigned int i=0; i<N*N; ++i)
v1(i) = i;
matrix.vmult (v2, v1);
// this is part of a whole suite of tests that checks the relative speed of
-// using PETSc for sparse matrices as compared to the speed of our own
-// library. the tests therefore may not all actually use PETSc, but they are
+// using Trilinos for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use Trilinos, but they are
// meant to compare it
//
// the tests build the 5-point stencil matrix for a uniform grid of size N*N
}
// build the sparse matrix
- Epetra_Map map (TrilinosWrappers::types::int_type(N*N), 0,
- Utilities::Trilinos::comm_world());
- TrilinosWrappers::SparseMatrix matrix (map, 5);
+ IndexSet indices = complete_index_set(N*N);
+ TrilinosWrappers::SparseMatrix matrix (indices, MPI_COMM_WORLD, 5);
for (unsigned int i_=0; i_<N; i_++)
for (unsigned int j_=0; j_<N; j_++)
{
// then do a single matrix-vector
// multiplication with subsequent formation
// of the matrix norm
- TrilinosWrappers::MPI::Vector v1(map);
- TrilinosWrappers::MPI::Vector v2(map);
+ TrilinosWrappers::MPI::Vector v1(indices, MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::Vector v2(indices, MPI_COMM_WORLD);
for (unsigned int i=0; i<N*N; ++i)
v1(i) = i;
matrix.vmult (v2, v1);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u;
+ u.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
A.reinit(csp);
testproblem.five_point(A);
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u1(dim);
- TrilinosWrappers::Vector u2(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u1;
+ u1.reinit(dim);
+ TrilinosWrappers::Vector u2;
+ u2.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
for (unsigned int row=0; row<dim; row++)
A.set(row,row, 2.0*(row+1));
- TrilinosWrappers::Vector f(dim);
- TrilinosWrappers::Vector u1(dim);
- TrilinosWrappers::Vector u2(dim);
+ TrilinosWrappers::Vector f;
+ f.reinit(dim);
+ TrilinosWrappers::Vector u1;
+ u1.reinit(dim);
+ TrilinosWrappers::Vector u2;
+ u2.reinit(dim);
f = 1.;
A.compress (VectorOperation::insert);
f.compress (VectorOperation::insert);
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (30);
+ TrilinosWrappers::Vector v;
+ v.reinit(30);
test (v);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
- TrilinosWrappers::Vector x (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
+ TrilinosWrappers::Vector x;
+ x.reinit(100);
test (v,w,x);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
try
{
{
- TrilinosWrappers::Vector v (100);
- TrilinosWrappers::Vector w (100);
+ TrilinosWrappers::Vector v;
+ v.reinit(100);
+ TrilinosWrappers::Vector w;
+ w.reinit(100);
test (v,w);
}
}
void test ()
{
- TrilinosWrappers::Vector v(3);
+ TrilinosWrappers::Vector v;
+ v.reinit(3);
v(0) = 0;
v(1) = 1;
v(2) = 2;
void test ()
{
- TrilinosWrappers::Vector v(5);
+ TrilinosWrappers::Vector v;
+ v.reinit(5);
for (unsigned int i=0; i<v.size(); ++i)
v(i) = 1;
- TrilinosWrappers::Vector w(9);
+ TrilinosWrappers::Vector w;
+ w.reinit(9);
for (unsigned int i=0; i<w.size(); ++i)
w(i) = 2;