From 98b1463057466df0996d51081c9c1518cf381264 Mon Sep 17 00:00:00 2001
From: heister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Sat, 3 Nov 2012 03:58:21 +0000
Subject: [PATCH] test for GrowingVectorMemory and PETSc

git-svn-id: https://svn.dealii.org/trunk@27332 0785d39b-7218-0410-832d-ea1e28bc413d
---
 tests/mpi/petsc_03.cc                  | 73 ++++++++++++++++++++++++++
 tests/mpi/petsc_03/ncpu_1/cmp/generic  |  3 ++
 tests/mpi/petsc_03/ncpu_10/cmp/generic |  3 ++
 tests/mpi/petsc_03/ncpu_4/cmp/generic  |  3 ++
 4 files changed, 82 insertions(+)
 create mode 100644 tests/mpi/petsc_03.cc
 create mode 100644 tests/mpi/petsc_03/ncpu_1/cmp/generic
 create mode 100644 tests/mpi/petsc_03/ncpu_10/cmp/generic
 create mode 100644 tests/mpi/petsc_03/ncpu_4/cmp/generic

diff --git a/tests/mpi/petsc_03.cc b/tests/mpi/petsc_03.cc
new file mode 100644
index 0000000000..3ae6c7e581
--- /dev/null
+++ b/tests/mpi/petsc_03.cc
@@ -0,0 +1,73 @@
+//---------------------------------------------------------------------------
+//    $Id: petsc_02.cc 25686 2012-07-04 14:18:43Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+// PETScWrappers: document bug when using GrowingVectorMemory
+// at the end of a run.
+
+#include "../tests.h"
+
+#include <deal.II/lac/petsc_parallel_vector.h>
+#include <deal.II/lac/petsc_parallel_block_vector.h>
+#include <deal.II/lac/petsc_vector.h>
+#include <deal.II/lac/petsc_parallel_vector.h>
+#include <deal.II/lac/vector_memory.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/utilities.h>
+
+#include <fstream>
+//#include <mpi.h>
+
+template<class v>
+void testit()
+{
+  GrowingVectorMemory<v> m;
+  m.free(m.alloc());
+}
+
+
+
+void test()
+{
+  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+  unsigned int numprocs = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
+
+  if (myid==0)
+    deallog << "Running on " << numprocs << " CPU(s)." << std::endl;
+
+  testit<PETScWrappers::MPI::Vector>();
+  testit<PETScWrappers::MPI::BlockVector>();
+  testit<PETScWrappers::Vector>();
+  testit<PETScWrappers::BlockVector>();
+
+  if (myid==0)
+    deallog << "done" << std::endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
+
+  if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
+    {
+      std::ofstream logfile(output_file_for_mpi(JobIdentifier::base_name(__FILE__)).c_str());
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      test();
+    }
+  else
+    test();
+}
diff --git a/tests/mpi/petsc_03/ncpu_1/cmp/generic b/tests/mpi/petsc_03/ncpu_1/cmp/generic
new file mode 100644
index 0000000000..721906ea79
--- /dev/null
+++ b/tests/mpi/petsc_03/ncpu_1/cmp/generic
@@ -0,0 +1,3 @@
+
+DEAL::Running on 1 CPU(s).
+DEAL::done
diff --git a/tests/mpi/petsc_03/ncpu_10/cmp/generic b/tests/mpi/petsc_03/ncpu_10/cmp/generic
new file mode 100644
index 0000000000..7430da6964
--- /dev/null
+++ b/tests/mpi/petsc_03/ncpu_10/cmp/generic
@@ -0,0 +1,3 @@
+
+DEAL::Running on 10 CPU(s).
+DEAL::done
diff --git a/tests/mpi/petsc_03/ncpu_4/cmp/generic b/tests/mpi/petsc_03/ncpu_4/cmp/generic
new file mode 100644
index 0000000000..befd397045
--- /dev/null
+++ b/tests/mpi/petsc_03/ncpu_4/cmp/generic
@@ -0,0 +1,3 @@
+
+DEAL::Running on 4 CPU(s).
+DEAL::done
-- 
2.39.5