From 2edb03ecc67ffada20b280c873da4af8470df1a4 Mon Sep 17 00:00:00 2001 From: heister Date: Sat, 2 Nov 2013 19:53:49 +0000 Subject: [PATCH] add another quick test git-svn-id: https://svn.dealii.org/trunk@31515 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/tests/quick_tests/CMakeLists.txt | 25 +++++++ deal.II/tests/quick_tests/p4est.cc | 85 ++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 deal.II/tests/quick_tests/p4est.cc diff --git a/deal.II/tests/quick_tests/CMakeLists.txt b/deal.II/tests/quick_tests/CMakeLists.txt index 4c0791b5d9..e99f4457ab 100644 --- a/deal.II/tests/quick_tests/CMakeLists.txt +++ b/deal.II/tests/quick_tests/CMakeLists.txt @@ -73,6 +73,31 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ) SET_TESTS_PROPERTIES(${_target} PROPERTIES LABEL "sanity checks") + # test p4est. This test exposes a bug in OpenMPI 1.3 and 1.4 + # Update to OpenMPI 1.5 or newer. + SET(_target p4est.${_build_lowercase}) + + ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL p4est.cc) + DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) + + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK + COMMAND mpirun -n 10 ${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 && echo "${_target}: PASSED." || (rm ${_target}-OK && exit 1) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + ADD_CUSTOM_TARGET(${_target}.run + DEPENDS ${_target} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK + COMMAND echo "${_target}: PASSED.") + + ADD_TEST(NAME ${_target} + COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}.run -DTEST=${_target} + -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + SET_TESTS_PROPERTIES(${_target} PROPERTIES LABEL "sanity checks") + + ENDFOREACH() # diff --git a/deal.II/tests/quick_tests/p4est.cc b/deal.II/tests/quick_tests/p4est.cc new file mode 100644 index 0000000000..821fd63e7f --- /dev/null +++ b/deal.II/tests/quick_tests/p4est.cc @@ -0,0 +1,85 @@ +// --------------------------------------------------------------------- +// $Id: count_dofs_per_component_01.cc 31349 2013-10-20 19:07:06Z maier $ +// +// Copyright (C) 2008 - 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 DoFTools::count_dofs_per_component + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using namespace dealii; + +template +void test() +{ + parallel::distributed::Triangulation + triangulation (MPI_COMM_WORLD, + Triangulation::limit_level_difference_at_vertices); + + FESystem fe (FE_Q(3),2, + FE_DGQ(1),1); + + DoFHandler dof_handler (triangulation); + + GridGenerator::hyper_cube(triangulation); + triangulation.refine_global (2); + dof_handler.distribute_dofs (fe); + + std::vector dofs_per_component (fe.n_components()); + DoFTools::count_dofs_per_component (dof_handler, dofs_per_component); + + Assert (std::accumulate (dofs_per_component.begin(), dofs_per_component.end(), 0U) + == dof_handler.n_dofs(), + ExcInternalError()); + + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + if (myid == 0) + { + deallog << "Total number of dofs: " << dof_handler.n_dofs() << std::endl; + for (unsigned int i=0; i(); + test<3>(); + + return 0; +} -- 2.39.5