133 dealii::Triangulation<dim> &triangulation)
const override
137 dealii::Triangulation<dim, dim> tria1;
138 tria1.set_mesh_smoothing(triangulation.get_mesh_smoothing());
140 if (use_simplices_) {
143 if constexpr (dim == 1) {
144 dealii::GridGenerator::
145 subdivided_hyper_rectangle_with_simplices<dim, dim>(
146 tria1, {subdivisions_x_}, point_left_, point_right_);
147 }
else if constexpr (dim == 2) {
148 dealii::GridGenerator::subdivided_hyper_rectangle_with_simplices(
150 {subdivisions_x_, subdivisions_y_},
153 }
else if constexpr (dim == 3) {
154 dealii::GridGenerator::subdivided_hyper_rectangle_with_simplices(
156 {subdivisions_x_, subdivisions_y_, subdivisions_z_},
164 if constexpr (dim == 1) {
165 dealii::GridGenerator::subdivided_hyper_rectangle<dim, dim>(
166 tria1, {subdivisions_x_}, point_left_, point_right_);
167 }
else if constexpr (dim == 2) {
168 dealii::GridGenerator::subdivided_hyper_rectangle(
170 {subdivisions_x_, subdivisions_y_},
173 }
else if constexpr (dim == 3) {
174 dealii::GridGenerator::subdivided_hyper_rectangle(
176 {subdivisions_x_, subdivisions_y_, subdivisions_z_},
182 triangulation.copy_triangulation(tria1);
188 if (grading_push_forward_ != grading_pull_back_) {
189 dealii::FunctionManifold<dim> grading(grading_push_forward_,
191 triangulation.set_all_manifold_ids(1);
192 triangulation.set_manifold(1, grading);
197 for (
auto cell : triangulation.active_cell_iterators()) {
198 for (
auto f : cell->face_indices()) {
199 auto face = cell->face(f);
200 if (!face->at_boundary())
202 const auto position = face->center();
204 if (position[0] < point_left_[0] + 1.e-8)
205 face->set_boundary_id(boundary_left_);
206 if (position[0] > point_right_[0] - 1.e-8)
207 face->set_boundary_id(boundary_right_);
209 if constexpr (dim >= 2) {
210 if (position[1] < point_left_[1] + 1.e-8)
211 face->set_boundary_id(boundary_bottom_);
212 if (position[1] > point_right_[1] - 1.e-8)
213 face->set_boundary_id(boundary_top_);
216 if constexpr (dim == 3) {
217 if (position[2] < point_left_[2] + 1.e-8)
218 face->set_boundary_id(boundary_back_);
219 if (position[2] > point_right_[2] - 1.e-8)
220 face->set_boundary_id(boundary_front_);
225 std::vector<int> directions;
229 AssertThrow(boundary_left_ == boundary_right_,
231 "For prescribing periodic boundaries in x-direction, "
232 "both, the left and right boundary conditions must "
233 "be set to periodic"));
234 directions.push_back(0);
239 AssertThrow(boundary_bottom_ == boundary_top_,
241 "For prescribing periodic boundaries in y-direction, "
242 "both, the bottom and top boundary conditions must "
243 "be set to periodic"));
244 directions.push_back(1);
249 AssertThrow(boundary_back_ == boundary_front_,
251 "For prescribing periodic boundaries in z-direction, "
252 "both, the back and front boundary conditions must "
253 "be set to periodic"));
254 directions.push_back(2);
257#ifndef BUG_COLLECT_PERIODIC_FACES_INSTANTIATION
258 if (!directions.empty()) {
259 std::vector<dealii::GridTools::PeriodicFacePair<
260 typename dealii::Triangulation<dim>::cell_iterator>>
263 for (
const auto direction : directions)
264 dealii::GridTools::collect_periodic_faces(
270 triangulation.add_periodicity(periodic_faces);