146 dealii::Triangulation<dim> &triangulation)
const override
150 dealii::Triangulation<dim, dim> tria1;
151 tria1.set_mesh_smoothing(triangulation.get_mesh_smoothing());
156 if constexpr (dim == 1) {
157 dealii::GridGenerator::
158 subdivided_hyper_rectangle_with_simplices<dim, dim>(
160 }
else if constexpr (dim == 2) {
161 dealii::GridGenerator::subdivided_hyper_rectangle_with_simplices(
166 }
else if constexpr (dim == 3) {
167 dealii::GridGenerator::subdivided_hyper_rectangle_with_simplices(
177 if constexpr (dim == 1) {
178 dealii::GridGenerator::subdivided_hyper_rectangle<dim, dim>(
180 }
else if constexpr (dim == 2) {
181 dealii::GridGenerator::subdivided_hyper_rectangle(
186 }
else if constexpr (dim == 3) {
187 dealii::GridGenerator::subdivided_hyper_rectangle(
195 triangulation.copy_triangulation(tria1);
202 "A transformation can only be used with a mesh "
203 "consisting of quadrilaterals or hexahedra."));
205 const auto transformation =
206 std::make_shared<dealii::FunctionParser<dim>>(
208 AssertThrow(transformation->n_components == dim,
210 "The transformation must consist of exactly dim "
211 "semicolon separated expressions."));
215 const typename dealii::Triangulation<dim>::cell_iterator &,
216 const dealii::Point<dim> &point) {
217 dealii::Point<dim> result;
218 for (
unsigned int d = 0; d < dim; ++d)
219 result[d] = transformation->value(point, d);
231 triangulation.set_all_manifold_ids(1);
232 triangulation.set_manifold(1, grading);
237 for (
auto cell : triangulation.active_cell_iterators()) {
238 for (
auto f : cell->face_indices()) {
239 auto face = cell->face(f);
240 if (!face->at_boundary())
242 const auto position = face->center();
249 if constexpr (dim >= 2) {
256 if constexpr (dim == 3) {
265 std::vector<int> directions;
271 "For prescribing periodic boundaries in x-direction, "
272 "both, the left and right boundary conditions must "
273 "be set to periodic"));
274 directions.push_back(0);
281 "For prescribing periodic boundaries in y-direction, "
282 "both, the bottom and top boundary conditions must "
283 "be set to periodic"));
284 directions.push_back(1);
291 "For prescribing periodic boundaries in z-direction, "
292 "both, the back and front boundary conditions must "
293 "be set to periodic"));
294 directions.push_back(2);
297#ifndef BUG_COLLECT_PERIODIC_FACES_INSTANTIATION
298 if (!directions.empty()) {
299 std::vector<dealii::GridTools::PeriodicFacePair<
300 typename dealii::Triangulation<dim>::cell_iterator>>
303 for (
const auto direction : directions)
304 dealii::GridTools::collect_periodic_faces(
310 triangulation.add_periodicity(periodic_faces);