From 6525ee51f8485de7abf6f77e452830b04d42f842 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 18 Nov 2018 12:38:29 +0100 Subject: [PATCH] Move definition of global points inside GridGenerator funtions --- source/grid/grid_generator.cc | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 44e8a50ed0..793c033881 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -35,26 +35,6 @@ namespace GridGenerator { namespace { - // Corner points of the cube [-1,1]^3 - const Point<3> hexahedron[8] = {Point<3>(-1, -1, -1), - Point<3>(+1, -1, -1), - Point<3>(-1, +1, -1), - Point<3>(+1, +1, -1), - Point<3>(-1, -1, +1), - Point<3>(+1, -1, +1), - Point<3>(-1, +1, +1), - Point<3>(+1, +1, +1)}; - - // Octahedron inscribed in the cube - // [-1,1]^3 - const Point<3> octahedron[6] = {Point<3>(-1, 0, 0), - Point<3>(1, 0, 0), - Point<3>(0, -1, 0), - Point<3>(0, 1, 0), - Point<3>(0, 0, -1), - Point<3>(0, 0, 1)}; - - /** * Perform the action specified by the @p colorize flag of the * hyper_rectangle() function of this class. @@ -3919,6 +3899,16 @@ namespace GridGenerator std::vector> vertices; std::vector> cells; + // Corner points of the cube [-1,1]^3 + static const std::array, 8> hexahedron = {{{-1, -1, -1}, // + {+1, -1, -1}, // + {-1, +1, -1}, // + {+1, +1, -1}, // + {-1, -1, +1}, // + {+1, -1, +1}, // + {-1, +1, +1}, // + {+1, +1, +1}}}; + // Start with the shell bounded by // two nested cubes if (n == 6) @@ -3952,8 +3942,17 @@ namespace GridGenerator // A more regular subdivision can // be obtained by two nested // rhombic dodecahedra + else if (n == 12) { + // Octahedron inscribed in the cube [-1,1]^3 + static const std::array, 6> octahedron = {{{-1, 0, 0}, // + {1, 0, 0}, // + {0, -1, 0}, // + {0, 1, 0}, // + {0, 0, -1}, // + {0, 0, 1}}}; + for (unsigned int i = 0; i < 8; ++i) vertices.push_back(p + hexahedron[i] * irad); for (unsigned int i = 0; i < 6; ++i) -- 2.39.5