From: Nicola Giuliani Date: Thu, 14 Jan 2021 08:28:19 +0000 (+0100) Subject: added cell bb tests X-Git-Tag: v9.3.0-rc1~628^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bf912ea20f025cf4b0fdeb81ac2615555a28d4e;p=dealii.git added cell bb tests --- diff --git a/tests/simplex/cell_bounding_boxes_2d.cc b/tests/simplex/cell_bounding_boxes_2d.cc new file mode 100644 index 0000000000..182d5dd47d --- /dev/null +++ b/tests/simplex/cell_bounding_boxes_2d.cc @@ -0,0 +1,60 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2021 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Test bounding box creation for simplex 2D tria. + +#include +#include +#include +#include + +#include "../tests.h" + + + +template +void +create_simplex_grid(Triangulation &tria_simplex) +{ + tria_simplex.clear(); + Triangulation tria_standard; + GridGenerator::hyper_cube(tria_standard); + GridGenerator::convert_hypercube_to_simplex_mesh(tria_standard, tria_simplex); +} + + +template +void +compute_bounding_boxes(Triangulation &tria) +{ + for (const auto cell : tria.active_cell_iterators()) + { + const auto cell_bb = cell->bounding_box(); + deallog << "Center : " << cell_bb.center() + << " , volume : " << cell_bb.volume() << std::endl; + } +} + + +int +main() +{ + initlog(); + deallog << std::setprecision(5); + Triangulation<2> tria; + create_simplex_grid(tria); + compute_bounding_boxes(tria); +} diff --git a/tests/simplex/cell_bounding_boxes_2d.with_simplex_support=on.output b/tests/simplex/cell_bounding_boxes_2d.with_simplex_support=on.output new file mode 100644 index 0000000000..1b2e35c283 --- /dev/null +++ b/tests/simplex/cell_bounding_boxes_2d.with_simplex_support=on.output @@ -0,0 +1,9 @@ + +DEAL::Center : 0.25000 0.25000 , volume : 0.25000 +DEAL::Center : 0.25000 0.25000 , volume : 0.25000 +DEAL::Center : 0.75000 0.25000 , volume : 0.25000 +DEAL::Center : 0.75000 0.25000 , volume : 0.25000 +DEAL::Center : 0.25000 0.75000 , volume : 0.25000 +DEAL::Center : 0.25000 0.75000 , volume : 0.25000 +DEAL::Center : 0.75000 0.75000 , volume : 0.25000 +DEAL::Center : 0.75000 0.75000 , volume : 0.25000 diff --git a/tests/simplex/cell_bounding_boxes_3d.cc b/tests/simplex/cell_bounding_boxes_3d.cc new file mode 100644 index 0000000000..227fd9687e --- /dev/null +++ b/tests/simplex/cell_bounding_boxes_3d.cc @@ -0,0 +1,60 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2021 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Test bounding box creation for simplex 3D tria. + +#include +#include +#include +#include + +#include "../tests.h" + + + +template +void +create_simplex_grid(Triangulation &tria_simplex) +{ + tria_simplex.clear(); + Triangulation tria_standard; + GridGenerator::hyper_cube(tria_standard); + GridGenerator::convert_hypercube_to_simplex_mesh(tria_standard, tria_simplex); +} + + +template +void +compute_bounding_boxes(Triangulation &tria) +{ + for (const auto cell : tria.active_cell_iterators()) + { + const auto cell_bb = cell->bounding_box(); + deallog << "Center : " << cell_bb.center() + << " , volume : " << cell_bb.volume() << std::endl; + } +} + + +int +main() +{ + initlog(); + deallog << std::setprecision(5); + Triangulation<3> tria; + create_simplex_grid(tria); + compute_bounding_boxes(tria); +} diff --git a/tests/simplex/cell_bounding_boxes_3d.with_simplex_support=on.output b/tests/simplex/cell_bounding_boxes_3d.with_simplex_support=on.output new file mode 100644 index 0000000000..56cc394a83 --- /dev/null +++ b/tests/simplex/cell_bounding_boxes_3d.with_simplex_support=on.output @@ -0,0 +1,25 @@ + +DEAL::Center : 0.50000 0.25000 0.25000 , volume : 0.25000 +DEAL::Center : 0.50000 0.75000 0.25000 , volume : 0.25000 +DEAL::Center : 0.50000 0.75000 0.75000 , volume : 0.25000 +DEAL::Center : 0.50000 0.25000 0.75000 , volume : 0.25000 +DEAL::Center : 0.25000 0.50000 0.25000 , volume : 0.25000 +DEAL::Center : 0.25000 0.50000 0.75000 , volume : 0.25000 +DEAL::Center : 0.75000 0.50000 0.75000 , volume : 0.25000 +DEAL::Center : 0.75000 0.50000 0.25000 , volume : 0.25000 +DEAL::Center : 0.25000 0.25000 0.50000 , volume : 0.25000 +DEAL::Center : 0.75000 0.25000 0.50000 , volume : 0.25000 +DEAL::Center : 0.75000 0.75000 0.50000 , volume : 0.25000 +DEAL::Center : 0.25000 0.75000 0.50000 , volume : 0.25000 +DEAL::Center : 0.75000 0.25000 0.50000 , volume : 0.25000 +DEAL::Center : 0.75000 0.75000 0.50000 , volume : 0.25000 +DEAL::Center : 0.25000 0.75000 0.50000 , volume : 0.25000 +DEAL::Center : 0.25000 0.25000 0.50000 , volume : 0.25000 +DEAL::Center : 0.25000 0.25000 0.75000 , volume : 0.12500 +DEAL::Center : 0.75000 0.25000 0.75000 , volume : 0.12500 +DEAL::Center : 0.75000 0.75000 0.75000 , volume : 0.12500 +DEAL::Center : 0.25000 0.75000 0.75000 , volume : 0.12500 +DEAL::Center : 0.75000 0.25000 0.25000 , volume : 0.12500 +DEAL::Center : 0.75000 0.75000 0.25000 , volume : 0.12500 +DEAL::Center : 0.25000 0.75000 0.25000 , volume : 0.12500 +DEAL::Center : 0.25000 0.25000 0.25000 , volume : 0.12500