]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add test
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 Oct 2013 20:24:24 +0000 (20:24 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 Oct 2013 20:24:24 +0000 (20:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@31470 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/derivative_approximation_01.cc [new file with mode: 0644]
tests/mpi/derivative_approximation_01.with_trilinos=true.mpirun=3.debug.output [new file with mode: 0644]

diff --git a/tests/mpi/derivative_approximation_01.cc b/tests/mpi/derivative_approximation_01.cc
new file mode 100644 (file)
index 0000000..d10b1df
--- /dev/null
@@ -0,0 +1,115 @@
+// ---------------------------------------------------------------------
+// $Id: trilinos_distribute_04.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2009 - 2013 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// document bug in the DerivateApproximation in parallel
+/*
+ --------------------------------------------------------
+ An error occurred in line <3349> of file </ssd/deal-trunk/deal.II/include/deal.II/dofs/dof_accessor.templates.h> in function
+     void dealii::DoFCellAccessor<DH, lda>::get_dof_values(const InputVector&, ForwardIterator, ForwardIterator) const [with InputVector = dealii::TrilinosWrappers::MPI::Vector, ForwardIterator = double*, DH = dealii::DoFHandler<2>, bool level_dof_access = false]
+ The violated condition was: 
+     this->is_artificial() == false
+ The name and call sequence of the exception was:
+     ExcMessage ("Can't ask for DoF indices on artificial cells.")
+ Additional Information: 
+ Can't ask for DoF indices on artificial cells.
+ --------------------------------------------------------
+  
+ */
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/trilinos_vector.h>
+#include <deal.II/lac/constraint_matrix.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/base/function.h>
+#include <deal.II/numerics/vector_tools.h>
+#include <deal.II/numerics/derivative_approximation.h>
+
+#include <fstream>
+#include <sstream>
+
+
+
+template <int dim>
+void test()
+{
+  const unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+  const unsigned int n_processes = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
+
+  parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
+
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(2);
+
+  if (myid==0)
+    {
+      typename Triangulation<dim>::active_cell_iterator it = tr.begin_active();
+      ++it;
+      ++it;
+      ++it;
+      for (unsigned int i=0; i<5; ++i)
+        {
+          it->set_refine_flag();
+          ++it;
+        }
+    }
+  tr.execute_coarsening_and_refinement();
+
+  const FE_Q<dim> fe(1);
+  DoFHandler<dim> dofh(tr);
+  dofh.distribute_dofs (fe);
+
+  IndexSet locally_relevant_set;
+  DoFTools::extract_locally_relevant_dofs (dofh,
+                                           locally_relevant_set);
+
+  TrilinosWrappers::MPI::Vector vec (dofh.locally_owned_dofs(), MPI_COMM_WORLD);
+  for (unsigned int i=vec.local_range().first; i<vec.local_range().second; ++i)
+    vec(i) = i;
+  vec.compress(VectorOperation::insert);
+
+  TrilinosWrappers::MPI::Vector vec_rel ( locally_relevant_set);
+  vec_rel = vec;
+
+  MappingQ1<dim> mapping;
+  Vector<float> indicators(tr.n_active_cells());
+  DerivativeApproximation::approximate_gradient  (mapping,
+                                                 dofh,
+                                                 vec_rel,
+                                                 indicators);
+
+  deallog <<"output:" << indicators.l2_norm() << std::endl;
+
+  if (myid == 0)
+    deallog << "OK" << std::endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  MPILogInitAll log;
+
+  test<2>();
+}
diff --git a/tests/mpi/derivative_approximation_01.with_trilinos=true.mpirun=3.debug.output b/tests/mpi/derivative_approximation_01.with_trilinos=true.mpirun=3.debug.output
new file mode 100644 (file)
index 0000000..9954536
--- /dev/null
@@ -0,0 +1,29 @@
+
+DEAL:0::locally owned:
+DEAL:0::{[0,26]}
+DEAL:0::relevant set:
+DEAL:0::{[0,29], [33,34], [39,43]}
+DEAL:0::constraint_matrix:
+    0 = 0
+    1 = 0
+    2 = 0
+    4 = 0
+    6 = 0
+    8 3:  0.500000
+    8 5:  0.500000
+    9 3:  0.500000
+    9 7:  0.500000
+    12 7:  0.500000
+    12 13:  0.500000
+    14 = 0
+    15 5:  0.500000
+    17 = 0
+    21 = 0
+    23 = 0
+    24 = 0
+    26 = 0
+    27 = 0
+    41 13:  0.500000
+    41 33:  0.500000
+    43 = 0
+DEAL:0::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.