From: Simon Sticko Date: Tue, 7 Apr 2020 18:48:05 +0000 (+0200) Subject: Move function coordinate_to_one_dim_higher to an internal namespace. X-Git-Tag: v9.2.0-rc1~260^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c067778c600aa9d7e25e044018fa63d12765c861;p=dealii.git Move function coordinate_to_one_dim_higher to an internal namespace. --- diff --git a/include/deal.II/base/bounding_box.h b/include/deal.II/base/bounding_box.h index 2f2b77d2d3..3333bd744f 100644 --- a/include/deal.II/base/bounding_box.h +++ b/include/deal.II/base/bounding_box.h @@ -276,51 +276,54 @@ BoundingBox create_unit_bounding_box(); -/** - * This function defines a convention for how coordinates in dim - * dimensions should translate to the coordinates in dim + 1 dimensions, - * when one of the coordinates in dim + 1 dimensions is locked to a given - * value. - * - * The convention is the following: Starting from the locked coordinate we - * store the lower dimensional coordinates consecutively and wrapping - * around when going over the dimension. This relationship can be - * described by the following tables: - * - * 2D - * ------------------------------------------------ - * | locked in 2D | 1D coordinate | 2D coordinate | - * |--------------------------------------------- | - * | x0 | (a) | (x0, a) | - * | x1 | (a) | (a , x1) | - * ------------------------------------------------ - * - * 3D - * -------------------------------------------------- - * | locked in 3D | 2D coordinates | 3D coordinates | - * |----------------------------------------------- | - * | x0 | (a, b) | (x0, a, b) | - * | x1 | (a, b) | ( b, x1, a) | - * | x2 | (a, b) | ( a, b, x2) | - * -------------------------------------------------- - * - * Given a locked coordinate, this function maps a coordinate index in dim - * dimension to a coordinate index in dim + 1 dimensions. - * - * @param locked_coordinate should be in the range [0, dim+1). - * @param coordiante_in_dim should be in the range [0, dim). - * @return A coordinate index in the range [0, dim+1) - */ -template -inline unsigned int -coordinate_to_one_dim_higher(const unsigned int locked_coordinate, - const unsigned int coordiante_in_dim) +namespace internal { - AssertIndexRange(locked_coordinate, dim + 1); - AssertIndexRange(coordiante_in_dim, dim); - return (locked_coordinate + coordiante_in_dim + 1) % (dim + 1); -} - + /** + * This function defines a convention for how coordinates in dim + * dimensions should translate to the coordinates in dim + 1 dimensions, + * when one of the coordinates in dim + 1 dimensions is locked to a given + * value. + * + * The convention is the following: Starting from the locked coordinate we + * store the lower dimensional coordinates consecutively and wrapping + * around when going over the dimension. This relationship can be + * described by the following tables: + * + * 2D + * ------------------------------------------------ + * | locked in 2D | 1D coordinate | 2D coordinate | + * |--------------------------------------------- | + * | x0 | (a) | (x0, a) | + * | x1 | (a) | (a , x1) | + * ------------------------------------------------ + * + * 3D + * -------------------------------------------------- + * | locked in 3D | 2D coordinates | 3D coordinates | + * |----------------------------------------------- | + * | x0 | (a, b) | (x0, a, b) | + * | x1 | (a, b) | ( b, x1, a) | + * | x2 | (a, b) | ( a, b, x2) | + * -------------------------------------------------- + * + * Given a locked coordinate, this function maps a coordinate index in dim + * dimension to a coordinate index in dim + 1 dimensions. + * + * @param locked_coordinate should be in the range [0, dim+1). + * @param coordiante_in_dim should be in the range [0, dim). + * @return A coordinate index in the range [0, dim+1) + */ + template + inline unsigned int + coordinate_to_one_dim_higher(const unsigned int locked_coordinate, + const unsigned int coordiante_in_dim) + { + AssertIndexRange(locked_coordinate, dim + 1); + AssertIndexRange(coordiante_in_dim, dim); + return (locked_coordinate + coordiante_in_dim + 1) % (dim + 1); + } + +} // namespace internal /*------------------------ Inline functions: BoundingBox --------------------*/ diff --git a/source/base/bounding_box.cc b/source/base/bounding_box.cc index 873445bbe9..3e886332cb 100644 --- a/source/base/bounding_box.cc +++ b/source/base/bounding_box.cc @@ -301,7 +301,7 @@ BoundingBox::cross_section(const unsigned int direction) const for (unsigned int d = 0; d < spacedim - 1; ++d) { const int index_to_write_from = - coordinate_to_one_dim_higher(direction, d); + internal::coordinate_to_one_dim_higher(direction, d); cross_section_lower_upper_corner.first[d] = boundary_points.first[index_to_write_from]; diff --git a/tests/base/coordinate_to_one_dim_higher.cc b/tests/base/coordinate_to_one_dim_higher.cc index 26973e9608..f903f78969 100644 --- a/tests/base/coordinate_to_one_dim_higher.cc +++ b/tests/base/coordinate_to_one_dim_higher.cc @@ -33,7 +33,8 @@ print_what_each_coordinate_maps_to() deallog << "locked coordinate = " << locked << std::endl; for (unsigned int i = 0; i < dim; ++i) { - deallog << i << " -> " << coordinate_to_one_dim_higher(locked, i) + deallog << i << " -> " + << internal::coordinate_to_one_dim_higher(locked, i) << std::endl; } }