From: Timo Heister Date: Thu, 7 Aug 2014 17:43:44 +0000 (-0400) Subject: add test X-Git-Tag: v8.2.0-rc1~208^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F70%2Fhead;p=dealii.git add test --- diff --git a/tests/mpi/condense_01.cc b/tests/mpi/condense_01.cc new file mode 100644 index 0000000000..9de14ef581 --- /dev/null +++ b/tests/mpi/condense_01.cc @@ -0,0 +1,98 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// 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. +// +// --------------------------------------------------------------------- + + + +// test ConstraintMatrix::condense(in, out) + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + + +template +void test() +{ + const unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD); + parallel::distributed::Triangulation triangulation(MPI_COMM_WORLD); + GridGenerator::hyper_cube (triangulation, -0.5, 0.5); + + triangulation.refine_global(1); + + /* + for (typename Triangulation::active_cell_iterator cell = triangulation.begin_active (); cell != triangulation.end (); ++cell) + if (cell->is_locally_owned ()) + { + if(cell->center().square() < 0.3*0.3) + cell->set_refine_flag (); + } + */ + typename Triangulation::active_cell_iterator cell = triangulation.begin_active (); + if (cell->is_locally_owned ()) + cell->set_refine_flag (); + + triangulation.execute_coarsening_and_refinement (); + if (myid == 0) + deallog << "#cells = " << triangulation.n_global_active_cells() << std::endl; + + FE_Q fe(1); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + ConstraintMatrix constraints; + DoFTools::make_hanging_node_constraints (dof_handler, constraints); + constraints.close (); + + IndexSet locally_owned_dofs, locally_relevant_dofs; + DoFTools::extract_locally_owned_dofs (dof_handler, locally_owned_dofs); + DoFTools::extract_locally_relevant_dofs (dof_handler, locally_relevant_dofs); + + PETScWrappers::MPI::Vector vec (locally_owned_dofs, MPI_COMM_WORLD); + PETScWrappers::MPI::Vector vec_ghosted (locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD); + vec = 1; + vec_ghosted = vec; + vec = -1; + + constraints.condense (vec_ghosted, vec); + + vec.print(deallog.get_file_stream()); + + 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/condense_01.with_trilinos=true.mpirun=2.output b/tests/mpi/condense_01.with_trilinos=true.mpirun=2.output new file mode 100644 index 0000000000..a9dc4b36ca --- /dev/null +++ b/tests/mpi/condense_01.with_trilinos=true.mpirun=2.output @@ -0,0 +1,7 @@ + +DEAL:0::#cells = 7 +[Proc0 0-8] 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.500e+00 0.000e+00 1.500e+00 0.000e+00 2.000e+00 +DEAL:0::OK + +[Proc1 9-13] 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 + diff --git a/tests/mpi/condense_01.with_trilinos=true.mpirun=7.output b/tests/mpi/condense_01.with_trilinos=true.mpirun=7.output new file mode 100644 index 0000000000..b8c6aa7346 --- /dev/null +++ b/tests/mpi/condense_01.with_trilinos=true.mpirun=7.output @@ -0,0 +1,22 @@ + +DEAL:0::#cells = 7 +[Proc0 0-8] 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.500e+00 0.000e+00 1.500e+00 0.000e+00 2.000e+00 +DEAL:0::OK + +[Proc1 9-8] + + +[Proc2 9-8] + + +[Proc3 9-8] + + +[Proc4 9-10] 1.000e+00 1.000e+00 + + +[Proc5 11-12] 1.000e+00 1.000e+00 + + +[Proc6 13-13] 1.000e+00 +