From 25a8bf0eee089a326608adabe466664801d36931 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 9 Jan 2013 17:18:38 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@27997 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/constraint_matrix_condense_01.cc | 99 +++++++++++++++++++ .../ncpu_1/cmp/generic | 2 + .../ncpu_10/cmp/generic | 6 ++ .../ncpu_4/cmp/generic | 6 ++ 4 files changed, 113 insertions(+) create mode 100644 tests/mpi/constraint_matrix_condense_01.cc create mode 100644 tests/mpi/constraint_matrix_condense_01/ncpu_1/cmp/generic create mode 100644 tests/mpi/constraint_matrix_condense_01/ncpu_10/cmp/generic create mode 100644 tests/mpi/constraint_matrix_condense_01/ncpu_4/cmp/generic diff --git a/tests/mpi/constraint_matrix_condense_01.cc b/tests/mpi/constraint_matrix_condense_01.cc new file mode 100644 index 0000000000..48c458f890 --- /dev/null +++ b/tests/mpi/constraint_matrix_condense_01.cc @@ -0,0 +1,99 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2013 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. +// +//--------------------------------------------------------------------------- + + +// check ConstraintMatrix::condense(Vector) for parallel vectors. this +// function used to crash +// +// original test case by Daniel Arndt + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + + +void test () +{ + MPI_Comm mpi_communicator (MPI_COMM_WORLD); + parallel::distributed::Triangulation<3> triangulation(mpi_communicator); + + FE_Q<3> fe(1); + + DoFHandler<3> dof_handler(triangulation); + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (1); + + dof_handler.distribute_dofs (fe); + + IndexSet locally_owned_dofs; + locally_owned_dofs = dof_handler.locally_owned_dofs(); + IndexSet locally_relevant_dofs; + DoFTools::extract_locally_relevant_dofs (dof_handler,locally_relevant_dofs); + + PETScWrappers::MPI::Vector force; + force.reinit (mpi_communicator, locally_owned_dofs, locally_relevant_dofs); + + ConstraintMatrix constraints (locally_relevant_dofs); + constraints.clear(); + { + constraints.reinit (locally_relevant_dofs); + IndexSet boundary_dofs (dof_handler.n_dofs()); + DoFTools::extract_boundary_dofs + (dof_handler, std::vector(1,true),boundary_dofs); + + unsigned int first_nboundary_dof = 0; + while(boundary_dofs.is_element(first_nboundary_dof)) + first_nboundary_dof++; + + constraints.add_line (first_nboundary_dof); + for (unsigned int i=0; i