16 #include <deal.II/grid/grid_generator.h> 17 #include <deal.II/grid/grid_reordering.h> 18 #include <deal.II/grid/grid_tools.h> 19 #include <deal.II/grid/tria.h> 20 #include <deal.II/grid/tria_accessor.h> 21 #include <deal.II/grid/tria_iterator.h> 22 #include <deal.II/grid/tria_boundary_lib.h> 23 #include <deal.II/grid/intergrid_map.h> 25 #include <deal.II/distributed/tria.h> 26 #include <deal.II/distributed/shared_tria.h> 32 DEAL_II_NAMESPACE_OPEN
69 template <
int dim,
int spacedim>
80 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
81 cell->face(f)->set_boundary_id (f);
87 template<
int spacedim>
95 cell != tria.
end(); ++cell)
96 if (cell->center()(0) > 0)
97 cell->set_material_id(1);
104 template <
int dim,
int spacedim>
109 const double epsilon)
121 for (; face!=endface; ++face)
123 if (face->boundary_id() == 0)
126 if (std::abs(center(0)-p1[0]) < epsilon)
127 face->set_boundary_id(0);
128 else if (std::abs(center(0) - p2[0]) < epsilon)
129 face->set_boundary_id(1);
130 else if (dim > 1 && std::abs(center(1) - p1[1]) < epsilon)
131 face->set_boundary_id(2);
132 else if (dim > 1 && std::abs(center(1) - p2[1]) < epsilon)
133 face->set_boundary_id(3);
134 else if (dim > 2 && std::abs(center(2) - p1[2]) < epsilon)
135 face->set_boundary_id(4);
136 else if (dim > 2 && std::abs(center(2) - p2[2]) < epsilon)
137 face->set_boundary_id(5);
143 Assert (
false, ExcInternalError());
148 cell != tria.
end(); ++cell)
151 for (
unsigned int d=0; d<dim; ++d)
152 if (cell->center()(d) > 0)
id += 1 << d;
153 cell->set_material_id(
id);
175 cell != tria.
end (); ++cell)
177 Assert(cell->face(2)->at_boundary(), ExcInternalError());
178 cell->face (2)->set_all_boundary_ids (1);
201 Assert (cell->face(4)->at_boundary(), ExcInternalError());
202 cell->face(4)->set_all_boundary_ids(1);
205 Assert (cell->face(2)->at_boundary(), ExcInternalError());
206 cell->face(2)->set_all_boundary_ids(1);
209 Assert (cell->face(2)->at_boundary(), ExcInternalError());
210 cell->face(2)->set_all_boundary_ids(1);
213 Assert (cell->face(0)->at_boundary(), ExcInternalError());
214 cell->face(0)->set_all_boundary_ids(1);
217 Assert (cell->face(2)->at_boundary(), ExcInternalError());
218 cell->face(2)->set_all_boundary_ids(1);
221 Assert (cell->face(0)->at_boundary(), ExcInternalError());
222 cell->face(0)->set_all_boundary_ids(1);
229 cell != tria.
end(); ++cell)
231 Assert (cell->face(5)->at_boundary(), ExcInternalError());
232 cell->face(5)->set_all_boundary_ids(1);
248 unsigned int count = 0;
250 cell != tria.
end(); ++cell)
251 if (cell->face(5)->at_boundary())
253 cell->face(5)->set_all_boundary_ids(1);
256 Assert (count == 48, ExcInternalError());
259 Assert (
false, ExcNotImplemented());
272 const double inner_radius,
273 const double outer_radius)
278 double middle = (outer_radius-inner_radius)/2e0 + inner_radius;
279 double eps = 1e-3*middle;
282 for (; cell!=tria.
end(); ++cell)
283 for (
unsigned int f=0; f<GeometryInfo<3>::faces_per_cell; ++f)
285 if (!cell->face(f)->at_boundary())
288 double radius = cell->face(f)->center().norm() - center.
norm();
289 if (std::fabs(cell->face(f)->center()(0)) < eps )
291 cell->face(f)->set_boundary_id(2);
292 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
293 if (cell->face(f)->line(j)->at_boundary())
294 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
295 cell->face(f)->line(j)->set_boundary_id(2);
297 else if (std::fabs(cell->face(f)->center()(1)) < eps)
299 cell->face(f)->set_boundary_id(3);
300 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
301 if (cell->face(f)->line(j)->at_boundary())
302 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
303 cell->face(f)->line(j)->set_boundary_id(3);
305 else if (std::fabs(cell->face(f)->center()(2)) < eps )
307 cell->face(f)->set_boundary_id(4);
308 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
309 if (cell->face(f)->line(j)->at_boundary())
310 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
311 cell->face(f)->line(j)->set_boundary_id(4);
313 else if (radius < middle)
315 cell->face(f)->set_boundary_id(0);
316 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
317 if (cell->face(f)->line(j)->at_boundary())
318 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps)
319 cell->face(f)->line(j)->set_boundary_id(0);
321 else if (radius > middle)
323 cell->face(f)->set_boundary_id(1);
324 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
325 if (cell->face(f)->line(j)->at_boundary())
326 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps)
327 cell->face(f)->line(j)->set_boundary_id(1);
337 template <
int dim,
int spacedim>
348 for (
unsigned int i=0; i<dim; ++i)
350 p1(i) = std::min(p_1(i), p_2(i));
351 p2(i) = std::max(p_1(i), p_2(i));
362 vertices[0] = vertices[1] = p1;
363 vertices[2] = vertices[3] = p2;
365 vertices[1](0) = p2(0);
366 vertices[2](0) = p1(0);
369 vertices[0] = vertices[1] = vertices[2] = vertices[3] = p1;
370 vertices[4] = vertices[5] = vertices[6] = vertices[7] = p2;
372 vertices[1](0) = p2(0);
373 vertices[2](1) = p2(1);
374 vertices[3](0) = p2(0);
375 vertices[3](1) = p2(1);
377 vertices[4](0) = p1(0);
378 vertices[4](1) = p1(1);
379 vertices[5](1) = p1(1);
380 vertices[6](0) = p1(0);
384 Assert (
false, ExcNotImplemented ());
388 std::vector<CellData<dim> > cells (1);
389 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
390 cells[0].vertices[i] = i;
391 cells[0].material_id = 0;
397 colorize_hyper_rectangle (tria);
401 template <
int dim,
int spacedim>
408 ExcMessage (
"Invalid left-to-right bounds of hypercube"));
411 for (
unsigned int i=0; i<dim; ++i)
425 Assert(dim>1, ExcNotImplemented());
426 Assert(dim<4, ExcNotImplemented());
430 for (
unsigned int d=0; d<dim; ++d)
431 for (
unsigned int c=1; c<=dim; ++c)
432 vector_matrix[c-1][d] = vertices[c](d) - vertices[0](d);
433 Assert(determinant(vector_matrix) > 0.,
ExcMessage(
"Vertices of simplex must form a right handed system"));
437 std::vector<Point<dim> > points = vertices;
441 for (
unsigned int i=0; i<=dim; ++i)
443 points.push_back(0.5*(points[i]+points[(i+1)%(dim+1)]));
449 for (
unsigned int i=1; i<dim; ++i)
450 points.push_back(0.5*(points[i-1]+points[i+1]));
452 for (
unsigned int i=0; i<=dim; ++i)
453 points.push_back(1./3.*
455 points[(i+1)%(dim+1)]+
456 points[(i+2)%(dim+1)]));
458 points.push_back((1./(dim+1))*center);
460 std::vector<CellData<dim> > cells(dim+1);
465 cells[0].vertices[0] = 0;
466 cells[0].vertices[1] = 3;
467 cells[0].vertices[2] = 5;
468 cells[0].vertices[3] = 6;
469 cells[0].material_id = 0;
471 cells[1].vertices[0] = 3;
472 cells[1].vertices[1] = 1;
473 cells[1].vertices[2] = 6;
474 cells[1].vertices[3] = 4;
475 cells[1].material_id = 0;
477 cells[2].vertices[0] = 5;
478 cells[2].vertices[1] = 6;
479 cells[2].vertices[2] = 2;
480 cells[2].vertices[3] = 4;
481 cells[2].material_id = 0;
485 cells[0].vertices[0] = 0;
486 cells[0].vertices[1] = 4;
487 cells[0].vertices[2] = 8;
488 cells[0].vertices[3] = 10;
489 cells[0].vertices[4] = 7;
490 cells[0].vertices[5] = 13;
491 cells[0].vertices[6] = 12;
492 cells[0].vertices[7] = 14;
493 cells[0].material_id = 0;
495 cells[1].vertices[0] = 4;
496 cells[1].vertices[1] = 1;
497 cells[1].vertices[2] = 10;
498 cells[1].vertices[3] = 5;
499 cells[1].vertices[4] = 13;
500 cells[1].vertices[5] = 9;
501 cells[1].vertices[6] = 14;
502 cells[1].vertices[7] = 11;
503 cells[1].material_id = 0;
505 cells[2].vertices[0] = 8;
506 cells[2].vertices[1] = 10;
507 cells[2].vertices[2] = 2;
508 cells[2].vertices[3] = 5;
509 cells[2].vertices[4] = 12;
510 cells[2].vertices[5] = 14;
511 cells[2].vertices[6] = 6;
512 cells[2].vertices[7] = 11;
513 cells[2].material_id = 0;
515 cells[3].vertices[0] = 7;
516 cells[3].vertices[1] = 13;
517 cells[3].vertices[2] = 12;
518 cells[3].vertices[3] = 14;
519 cells[3].vertices[4] = 3;
520 cells[3].vertices[5] = 9;
521 cells[3].vertices[6] = 6;
522 cells[3].vertices[7] = 11;
523 cells[3].material_id = 0;
526 Assert(
false, ExcNotImplemented());
534 const unsigned int n_cells,
535 const unsigned int n_rotations,
539 const unsigned int dim=3;
540 Assert (n_cells>4,
ExcMessage(
"More than 4 cells are needed to create a moebius grid."));
541 Assert (r>0 && R>0,
ExcMessage(
"Outer and inner radius must be positive."));
542 Assert (R>r,
ExcMessage(
"Outer radius must be greater than inner radius."));
545 std::vector<Point<dim> > vertices (4*n_cells);
546 double beta_step=n_rotations*
numbers::PI/2.0/n_cells;
549 for (
unsigned int i=0; i<n_cells; ++i)
550 for (
unsigned int j=0; j<4; ++j)
552 vertices[4*i+j][0]=R*std::cos(i*alpha_step)+r*std::cos(i*beta_step+j*
numbers::PI/2.0)*std::cos(i*alpha_step);
553 vertices[4*i+j][1]=R*std::sin(i*alpha_step)+r*std::cos(i*beta_step+j*
numbers::PI/2.0)*std::sin(i*alpha_step);
554 vertices[4*i+j][2]=r*std::sin(i*beta_step+j*
numbers::PI/2.0);
557 unsigned int offset=0;
559 std::vector<CellData<dim> > cells (n_cells);
560 for (
unsigned int i=0; i<n_cells; ++i)
562 for (
unsigned int j=0; j<2; ++j)
564 cells[i].vertices[0+4*j]=offset+0+4*j;
565 cells[i].vertices[1+4*j]=offset+3+4*j;
566 cells[i].vertices[2+4*j]=offset+2+4*j;
567 cells[i].vertices[3+4*j]=offset+1+4*j;
570 cells[i].material_id=0;
574 cells[n_cells-1].vertices[4]=(0+n_rotations)%4;
575 cells[n_cells-1].vertices[5]=(3+n_rotations)%4;
576 cells[n_cells-1].vertices[6]=(2+n_rotations)%4;
577 cells[n_cells-1].vertices[7]=(1+n_rotations)%4;
590 Assert (R>r,
ExcMessage(
"Outer radius must be greater than inner radius."));
592 const unsigned int dim=2;
593 const unsigned int spacedim=3;
594 std::vector<Point<spacedim> > vertices (16);
613 std::vector<CellData<dim> > cells (16);
615 cells[0].vertices[0] = 0;
616 cells[0].vertices[1] = 4;
617 cells[0].vertices[2] = 7;
618 cells[0].vertices[3] = 3;
619 cells[0].material_id = 0;
621 cells[1].vertices[0] = 1;
622 cells[1].vertices[1] = 5;
623 cells[1].vertices[2] = 4;
624 cells[1].vertices[3] = 0;
625 cells[1].material_id = 0;
627 cells[2].vertices[0] = 2;
628 cells[2].vertices[1] = 6;
629 cells[2].vertices[2] = 5;
630 cells[2].vertices[3] = 1;
631 cells[2].material_id = 0;
633 cells[3].vertices[0] = 3;
634 cells[3].vertices[1] = 7;
635 cells[3].vertices[2] = 6;
636 cells[3].vertices[3] = 2;
637 cells[3].material_id = 0;
639 cells[4].vertices[0] = 4;
640 cells[4].vertices[1] = 8;
641 cells[4].vertices[2] = 11;
642 cells[4].vertices[3] = 7;
643 cells[4].material_id = 0;
645 cells[5].vertices[0] = 5;
646 cells[5].vertices[1] = 9;
647 cells[5].vertices[2] = 8;
648 cells[5].vertices[3] = 4;
649 cells[5].material_id = 0;
651 cells[6].vertices[0] = 6;
652 cells[6].vertices[1] = 10;
653 cells[6].vertices[2] = 9;
654 cells[6].vertices[3] = 5;
655 cells[6].material_id = 0;
657 cells[7].vertices[0] = 7;
658 cells[7].vertices[1] = 11;
659 cells[7].vertices[2] = 10;
660 cells[7].vertices[3] = 6;
661 cells[7].material_id = 0;
663 cells[8].vertices[0] = 8;
664 cells[8].vertices[1] = 12;
665 cells[8].vertices[2] = 15;
666 cells[8].vertices[3] = 11;
667 cells[8].material_id = 0;
669 cells[9].vertices[0] = 9;
670 cells[9].vertices[1] = 13;
671 cells[9].vertices[2] = 12;
672 cells[9].vertices[3] = 8;
673 cells[9].material_id = 0;
675 cells[10].vertices[0] = 10;
676 cells[10].vertices[1] = 14;
677 cells[10].vertices[2] = 13;
678 cells[10].vertices[3] = 9;
679 cells[10].material_id = 0;
681 cells[11].vertices[0] = 11;
682 cells[11].vertices[1] = 15;
683 cells[11].vertices[2] = 14;
684 cells[11].vertices[3] = 10;
685 cells[11].material_id = 0;
687 cells[12].vertices[0] = 12;
688 cells[12].vertices[1] = 0;
689 cells[12].vertices[2] = 3;
690 cells[12].vertices[3] = 15;
691 cells[12].material_id = 0;
693 cells[13].vertices[0] = 13;
694 cells[13].vertices[1] = 1;
695 cells[13].vertices[2] = 0;
696 cells[13].vertices[3] = 12;
697 cells[13].material_id = 0;
699 cells[14].vertices[0] = 14;
700 cells[14].vertices[1] = 2;
701 cells[14].vertices[2] = 1;
702 cells[14].vertices[3] = 13;
703 cells[14].material_id = 0;
705 cells[15].vertices[0] = 15;
706 cells[15].vertices[1] = 3;
707 cells[15].vertices[2] = 2;
708 cells[15].vertices[3] = 14;
709 cells[15].material_id = 0;
726 Assert (
false, ExcNotImplemented());
735 Assert (
false, ExcNotImplemented());
746 std_cxx11::array<Tensor<1,2>,2> edges;
747 edges[0] = corners[0];
748 edges[1] = corners[1];
749 std::vector<unsigned int> subdivisions;
750 subdivided_parallelepiped<2,2>(tria, origin, edges, subdivisions, colorize);
761 unsigned int n_subdivisions [dim];
762 for (
unsigned int i=0; i<dim; ++i)
763 n_subdivisions[i] = 1;
774 const unsigned int n_subdivisions,
780 unsigned int n_subdivisions_ [dim];
781 for (
unsigned int i=0; i<dim; ++i)
782 n_subdivisions_[i] = n_subdivisions;
794 const unsigned int(&n_subdivisions)[dim],
796 const unsigned int *n_subdivisions,
802 std::vector<unsigned int> subdivisions;
803 std_cxx11::array<Tensor<1,dim>,dim> edges;
804 for (
unsigned int i=0; i<dim; ++i)
806 subdivisions.push_back(n_subdivisions[i]);
807 edges[i] = corners[i];
810 subdivided_parallelepiped<dim,dim> (tria, origin, edges, subdivisions, colorize);
821 template <
int dim,
int spacedim>
826 const std::vector<unsigned int> &subdivisions,
829 if (subdivisions.size()==0)
831 std::vector<unsigned int> new_subdivisions(dim, 1);
832 subdivided_parallelepiped<dim,spacedim>(tria, origin, edges, new_subdivisions, colorize);
839 for (
unsigned int i=0; i<dim; ++i)
841 Assert (subdivisions[i]>0, ExcInvalidRepetitions(subdivisions[i]));
842 Assert (edges[i].norm()>0,
ExcMessage(
"Edges in subdivided_parallelepiped() must not be degenerate."));
846 for (
unsigned int i=0; i<dim; ++i)
847 for (
unsigned int j=i+1; j<dim; ++j)
848 Assert ((edges[i]!=edges[j]),
849 ExcMessage (
"Degenerate edges of subdivided_parallelepiped encountered."));
852 std::vector<Point<spacedim> > points;
857 for (
unsigned int x=0; x<=subdivisions[0]; ++x)
858 points.push_back (origin + edges[0]/subdivisions[0]*x);
862 for (
unsigned int y=0; y<=subdivisions[1]; ++y)
863 for (
unsigned int x=0; x<=subdivisions[0]; ++x)
864 points.push_back (origin
865 + edges[0]/subdivisions[0]*x
866 + edges[1]/subdivisions[1]*y);
870 for (
unsigned int z=0; z<=subdivisions[2]; ++z)
871 for (
unsigned int y=0; y<=subdivisions[1]; ++y)
872 for (
unsigned int x=0; x<=subdivisions[0]; ++x)
875 + edges[0]/subdivisions[0]*x
876 + edges[1]/subdivisions[1]*y
877 + edges[2]/subdivisions[2]*z);
881 Assert (
false, ExcNotImplemented());
885 unsigned int n_cells = 1;
886 for (
unsigned int i=0; i<dim; ++i)
887 n_cells *= subdivisions[i];
888 std::vector<CellData<dim> > cells (n_cells);
894 for (
unsigned int x=0; x<subdivisions[0]; ++x)
896 cells[x].vertices[0] = x;
897 cells[x].vertices[1] = x+1;
900 cells[x].material_id = 0;
907 const unsigned int n_dy = subdivisions[1];
908 const unsigned int n_dx = subdivisions[0];
910 for (
unsigned int y=0; y<n_dy; ++y)
911 for (
unsigned int x=0; x<n_dx; ++x)
913 const unsigned int c = y*n_dx + x;
914 cells[c].vertices[0] = y*(n_dx+1) + x;
915 cells[c].vertices[1] = y*(n_dx+1) + x+1;
916 cells[c].vertices[2] = (y+1)*(n_dx+1) + x;
917 cells[c].vertices[3] = (y+1)*(n_dx+1) + x+1;
920 cells[c].material_id = 0;
928 const unsigned int n_dz = subdivisions[2];
929 const unsigned int n_dy = subdivisions[1];
930 const unsigned int n_dx = subdivisions[0];
932 for (
unsigned int z=0; z<n_dz; ++z)
933 for (
unsigned int y=0; y<n_dy; ++y)
934 for (
unsigned int x=0; x<n_dx; ++x)
936 const unsigned int c = z*n_dy*n_dx + y*n_dx + x;
938 cells[c].vertices[0] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
939 cells[c].vertices[1] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
940 cells[c].vertices[2] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
941 cells[c].vertices[3] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
942 cells[c].vertices[4] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
943 cells[c].vertices[5] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
944 cells[c].vertices[6] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
945 cells[c].vertices[7] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
948 cells[c].material_id = 0;
954 Assert (
false, ExcNotImplemented());
969 for (; cell!=endc; ++cell)
971 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
973 if (cell->face(face)->at_boundary())
974 cell->face(face)->set_boundary_id(face);
981 template <
int dim,
int spacedim>
984 const unsigned int repetitions,
988 Assert (repetitions >= 1, ExcInvalidRepetitions(repetitions));
990 ExcMessage (
"Invalid left-to-right bounds of hypercube"));
993 for (
unsigned int i=0; i<dim; ++i)
999 std::vector<unsigned int> reps(dim, repetitions);
1005 template <
int dim,
int spacedim>
1009 const std::vector<unsigned int> &repetitions,
1012 const bool colorize)
1014 Assert(repetitions.size() == dim,
1015 ExcInvalidRepetitionsDimension(dim));
1021 for (
unsigned int i=0; i<dim; ++i)
1023 p1(i) = std::min(p_1(i), p_2(i));
1024 p2(i) = std::max(p_1(i), p_2(i));
1028 std::vector<Point<spacedim> > delta(dim);
1029 for (
unsigned int i=0; i<dim; ++i)
1031 Assert (repetitions[i] >= 1, ExcInvalidRepetitions(repetitions[i]));
1033 delta[i][i] = (p2[i]-p1[i])/repetitions[i];
1035 ExcMessage(
"The first dim entries of coordinates of p1 and p2 need to be different."));
1039 std::vector<Point<spacedim> > points;
1043 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1044 points.push_back (p1+(
double)x*delta[0]);
1048 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1049 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1050 points.push_back (p1+(
double)x*delta[0]
1051 +(
double)y*delta[1]);
1055 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1056 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1057 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1058 points.push_back (p1+(
double)x*delta[0] +
1059 (
double)y*delta[1] + (
double)z*delta[2]);
1063 Assert (
false, ExcNotImplemented());
1067 std::vector<CellData<dim> > cells;
1072 cells.resize (repetitions[0]);
1073 for (
unsigned int x=0; x<repetitions[0]; ++x)
1075 cells[x].vertices[0] = x;
1076 cells[x].vertices[1] = x+1;
1077 cells[x].material_id = 0;
1084 cells.resize (repetitions[1]*repetitions[0]);
1085 for (
unsigned int y=0; y<repetitions[1]; ++y)
1086 for (
unsigned int x=0; x<repetitions[0]; ++x)
1088 const unsigned int c = x+y*repetitions[0];
1089 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1090 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1091 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1092 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1093 cells[c].material_id = 0;
1100 const unsigned int n_x = (repetitions[0]+1);
1101 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1103 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1104 for (
unsigned int z=0; z<repetitions[2]; ++z)
1105 for (
unsigned int y=0; y<repetitions[1]; ++y)
1106 for (
unsigned int x=0; x<repetitions[0]; ++x)
1108 const unsigned int c = x+y*repetitions[0] +
1109 z*repetitions[0]*repetitions[1];
1110 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1111 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1112 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1113 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1114 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1115 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1116 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1117 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1118 cells[c].material_id = 0;
1125 Assert (
false, ExcNotImplemented());
1140 double epsilon = 10;
1141 for (
unsigned int i=0; i<dim; ++i)
1142 epsilon = std::min(epsilon, 0.01*delta[i][i]);
1144 ExcMessage (
"The distance between corner points must be positive."))
1148 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1158 const std::vector<std::vector<double> > &step_sz,
1161 const bool colorize)
1163 Assert(step_sz.size() == dim,
1164 ExcInvalidRepetitionsDimension(dim));
1174 std::vector< std::vector<double> > step_sizes(step_sz);
1176 for (
unsigned int i=0; i<dim; ++i)
1180 std::swap (p1(i), p2(i));
1181 std::reverse (step_sizes[i].begin(), step_sizes[i].end());
1185 for (
unsigned int j=0; j<step_sizes.at(i).size(); j++)
1186 x += step_sizes[i][j];
1187 Assert(std::fabs(x - (p2(i)-p1(i))) <= 1e-12*std::fabs(x),
1188 ExcInvalidRepetitions (i) );
1194 std::vector<Point<dim> > points;
1200 for (
unsigned int i=0; ; ++i)
1209 if (i == step_sizes[0].size())
1212 x += step_sizes[0][i];
1220 for (
unsigned int j=0; ; ++j)
1223 for (
unsigned int i=0; ; ++i)
1227 if (i == step_sizes[0].size())
1230 x += step_sizes[0][i];
1233 if (j == step_sizes[1].size())
1236 y += step_sizes[1][j];
1244 for (
unsigned int k=0; ; ++k)
1247 for (
unsigned int j=0; ; ++j)
1250 for (
unsigned int i=0; ; ++i)
1255 if (i == step_sizes[0].size())
1258 x += step_sizes[0][i];
1261 if (j == step_sizes[1].size())
1264 y += step_sizes[1][j];
1267 if (k == step_sizes[2].size())
1270 z += step_sizes[2][k];
1276 Assert (
false, ExcNotImplemented());
1281 std::vector<CellData<dim> > cells;
1286 cells.resize (step_sizes[0].size());
1287 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1289 cells[x].vertices[0] = x;
1290 cells[x].vertices[1] = x+1;
1291 cells[x].material_id = 0;
1298 cells.resize (step_sizes[1].size()*step_sizes[0].size());
1299 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1300 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1302 const unsigned int c = x+y*step_sizes[0].size();
1303 cells[c].vertices[0] = y*(step_sizes[0].size()+1)+x;
1304 cells[c].vertices[1] = y*(step_sizes[0].size()+1)+x+1;
1305 cells[c].vertices[2] = (y+1)*(step_sizes[0].size()+1)+x;
1306 cells[c].vertices[3] = (y+1)*(step_sizes[0].size()+1)+x+1;
1307 cells[c].material_id = 0;
1314 const unsigned int n_x = (step_sizes[0].size()+1);
1315 const unsigned int n_xy = (step_sizes[0].size()+1)*(step_sizes[1].size()+1);
1317 cells.resize (step_sizes[2].size()*step_sizes[1].size()*step_sizes[0].size());
1318 for (
unsigned int z=0; z<step_sizes[2].size(); ++z)
1319 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1320 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1322 const unsigned int c = x+y*step_sizes[0].size() +
1323 z*step_sizes[0].size()*step_sizes[1].size();
1324 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1325 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1326 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1327 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1328 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1329 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1330 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1331 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1332 cells[c].material_id = 0;
1339 Assert (
false, ExcNotImplemented());
1354 double min_size = *std::min_element (step_sizes[0].begin(),
1355 step_sizes[0].end());
1356 for (
unsigned int i=1; i<dim; ++i)
1357 min_size = std::min (min_size,
1358 *std::min_element (step_sizes[i].begin(),
1359 step_sizes[i].end()));
1360 const double epsilon = 0.01 * min_size;
1364 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1374 const std::vector< std::vector<double> > &spacing,
1377 const bool colorize)
1379 Assert(spacing.size() == 1,
1380 ExcInvalidRepetitionsDimension(1));
1382 const unsigned int n_cells = material_id.
size(0);
1384 Assert(spacing[0].size() == n_cells,
1385 ExcInvalidRepetitionsDimension(1));
1387 double delta = std::numeric_limits<double>::max();
1388 for (
unsigned int i=0; i<n_cells; i++)
1390 Assert (spacing[0][i] >= 0, ExcInvalidRepetitions(-1));
1391 delta = std::min (delta, spacing[0][i]);
1395 std::vector<Point<1> > points;
1397 for (
unsigned int x=0; x<=n_cells; ++x)
1401 ax += spacing[0][x];
1404 unsigned int n_val_cells = 0;
1405 for (
unsigned int i=0; i<n_cells; i++)
1408 std::vector<CellData<1> > cells(n_val_cells);
1409 unsigned int id = 0;
1410 for (
unsigned int x=0; x<n_cells; ++x)
1413 cells[id].vertices[0] = x;
1414 cells[id].vertices[1] = x+1;
1415 cells[id].material_id = material_id[x];
1426 Assert (
false, ExcNotImplemented());
1434 const std::vector< std::vector<double> > &spacing,
1437 const bool colorize)
1439 Assert(spacing.size() == 2,
1440 ExcInvalidRepetitionsDimension(2));
1442 std::vector<unsigned int> repetitions(2);
1443 unsigned int n_cells = 1;
1444 double delta = std::numeric_limits<double>::max();
1445 for (
unsigned int i=0; i<2; i++)
1447 repetitions[i] = spacing[i].size();
1448 n_cells *= repetitions[i];
1449 for (
unsigned int j=0; j<repetitions[i]; j++)
1451 Assert (spacing[i][j] >= 0, ExcInvalidRepetitions(-1));
1452 delta = std::min (delta, spacing[i][j]);
1454 Assert(material_id.
size(i) == repetitions[i],
1455 ExcInvalidRepetitionsDimension(i));
1459 std::vector<Point<2> > points;
1461 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1464 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1466 points.push_back (
Point<2> (ax,ay));
1467 if (x<repetitions[0])
1468 ax += spacing[0][x];
1470 if (y<repetitions[1])
1471 ay += spacing[1][y];
1475 unsigned int n_val_cells = 0;
1476 for (
unsigned int i=0; i<material_id.
size(0); i++)
1477 for (
unsigned int j=0; j<material_id.
size(1); j++)
1481 std::vector<CellData<2> > cells(n_val_cells);
1482 unsigned int id = 0;
1483 for (
unsigned int y=0; y<repetitions[1]; ++y)
1484 for (
unsigned int x=0; x<repetitions[0]; ++x)
1487 cells[id].vertices[0] = y*(repetitions[0]+1)+x;
1488 cells[id].vertices[1] = y*(repetitions[0]+1)+x+1;
1489 cells[id].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1490 cells[id].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1491 cells[id].material_id = material_id[x][y];
1504 double eps = 0.01 * delta;
1507 for (; cell !=endc; ++cell)
1509 Point<2> cell_center = cell->center();
1510 for (
unsigned int f=0; f<GeometryInfo<2>::faces_per_cell; ++f)
1511 if (cell->face(f)->boundary_id() == 0)
1513 Point<2> face_center = cell->face(f)->center();
1514 for (
unsigned int i=0; i<2; ++i)
1516 if (face_center[i]<cell_center[i]-eps)
1517 cell->face(f)->set_boundary_id(i*2);
1518 if (face_center[i]>cell_center[i]+eps)
1519 cell->face(f)->set_boundary_id(i*2+1);
1531 const std::vector< std::vector<double> > &spacing,
1534 const bool colorize)
1536 const unsigned int dim = 3;
1538 Assert(spacing.size() == dim,
1539 ExcInvalidRepetitionsDimension(dim));
1541 std::vector<unsigned int > repetitions(dim);
1542 unsigned int n_cells = 1;
1543 double delta = std::numeric_limits<double>::max();
1544 for (
unsigned int i=0; i<dim; i++)
1546 repetitions[i] = spacing[i].size();
1547 n_cells *= repetitions[i];
1548 for (
unsigned int j=0; j<repetitions[i]; j++)
1550 Assert (spacing[i][j] >= 0, ExcInvalidRepetitions(-1));
1551 delta = std::min (delta, spacing[i][j]);
1553 Assert(material_id.
size(i) == repetitions[i],
1554 ExcInvalidRepetitionsDimension(i));
1558 std::vector<Point<dim> > points;
1560 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1563 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1566 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1569 if (x<repetitions[0])
1570 ax += spacing[0][x];
1572 if (y<repetitions[1])
1573 ay += spacing[1][y];
1575 if (z<repetitions[2])
1576 az += spacing[2][z];
1580 unsigned int n_val_cells = 0;
1581 for (
unsigned int i=0; i<material_id.
size(0); i++)
1582 for (
unsigned int j=0; j<material_id.
size(1); j++)
1583 for (
unsigned int k=0; k<material_id.
size(2); k++)
1587 std::vector<CellData<dim> > cells(n_val_cells);
1588 unsigned int id = 0;
1589 const unsigned int n_x = (repetitions[0]+1);
1590 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1591 for (
unsigned int z=0; z<repetitions[2]; ++z)
1592 for (
unsigned int y=0; y<repetitions[1]; ++y)
1593 for (
unsigned int x=0; x<repetitions[0]; ++x)
1596 cells[id].vertices[0] = z*n_xy + y*n_x + x;
1597 cells[id].vertices[1] = z*n_xy + y*n_x + x+1;
1598 cells[id].vertices[2] = z*n_xy + (y+1)*n_x + x;
1599 cells[id].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1600 cells[id].vertices[4] = (z+1)*n_xy + y*n_x + x;
1601 cells[id].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1602 cells[id].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1603 cells[id].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1604 cells[id].material_id = material_id[x][y][z];
1615 if (colorize && dim>1)
1617 double eps = 0.01 * delta;
1620 for (; cell !=endc; ++cell)
1623 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
1624 if (cell->face(f)->boundary_id() == 0)
1626 Point<dim> face_center = cell->face(f)->center();
1627 for (
unsigned int i=0; i<dim; ++i)
1629 if (face_center[i]<cell_center[i]-eps)
1630 cell->face(f)->set_boundary_id(i*2);
1631 if (face_center[i]>cell_center[i]+eps)
1632 cell->face(f)->set_boundary_id(i*2+1);
1639 template <
int dim,
int spacedim>
1643 const std::vector<unsigned int> &holes)
1652 for (
unsigned int d=0; d<dim; ++d)
1659 std::vector<Point<spacedim> > delta(dim);
1660 unsigned int repetitions[dim];
1661 for (
unsigned int i=0; i<dim; ++i)
1663 Assert (holes[i] >= 1,
ExcMessage(
"At least one hole needed in each direction"));
1664 repetitions[i] = 2*holes[i]+1;
1665 delta[i][i] = (p2[i]-p1[i]);
1670 std::vector<Point<spacedim> > points;
1674 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1675 points.push_back (p1+(
double)x*delta[0]);
1679 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1680 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1681 points.push_back (p1+(
double)x*delta[0]
1682 +(
double)y*delta[1]);
1686 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1687 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1688 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1689 points.push_back (p1+(
double)x*delta[0] +
1690 (
double)y*delta[1] + (
double)z*delta[2]);
1694 Assert (
false, ExcNotImplemented());
1699 std::vector<CellData<dim> > cells;
1704 cells.resize (repetitions[1]*repetitions[0]-holes[1]*holes[0]);
1706 for (
unsigned int y=0; y<repetitions[1]; ++y)
1707 for (
unsigned int x=0; x<repetitions[0]; ++x)
1709 if ((x%2 == 1) && (y%2 ==1))
continue;
1710 Assert(c<cells.size(), ExcInternalError());
1711 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1712 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1713 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1714 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1715 cells[c].material_id = 0;
1723 const unsigned int n_x = (repetitions[0]+1);
1724 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1726 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1729 for (
unsigned int z=0; z<repetitions[2]; ++z)
1730 for (
unsigned int y=0; y<repetitions[1]; ++y)
1731 for (
unsigned int x=0; x<repetitions[0]; ++x)
1733 Assert(c<cells.size(),ExcInternalError());
1734 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1735 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1736 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1737 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1738 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1739 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1740 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1741 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1742 cells[c].material_id = 0;
1750 Assert (
false, ExcNotImplemented());
1756 template <
int dim,
int spacedim>
1758 const std::vector<unsigned int> &sizes,
1759 const bool colorize)
1762 Assert(dim>1, ExcNotImplemented());
1763 Assert(dim<4, ExcNotImplemented());
1768 for (
unsigned int d=0; d<dim; ++d)
1771 std::vector<Point<spacedim> > points;
1772 unsigned int n_cells = 1;
1773 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
1774 n_cells += sizes[i];
1776 std::vector<CellData<dim> > cells(n_cells);
1778 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
1781 for (
unsigned int d=0; d<dim; ++d)
1782 p(d) = 0.5 * dimensions[d] *
1784 points.push_back(p);
1785 cells[0].vertices[i] = i;
1787 cells[0].material_id = 0;
1790 unsigned int cell_index = 1;
1792 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1798 for (
unsigned int j=0; j<sizes[face]; ++j,++cell_index)
1800 const unsigned int last_cell = (j==0) ? 0U : (cell_index-1);
1802 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
1807 cells[cell_index].vertices[ocellv] = cells[last_cell].vertices[cellv];
1810 cells[cell_index].vertices[cellv] = points.size();
1814 points.push_back(p);
1816 cells[cell_index].material_id = (colorize) ? (face+1U) : 0U;
1829 Assert (
false, ExcNotImplemented());
1841 Assert (
false, ExcNotImplemented());
1851 Assert (
false, ExcNotImplemented());
1861 Assert (
false, ExcNotImplemented());
1871 Assert (
false, ExcNotImplemented());
1882 Assert (
false, ExcNotImplemented());
1892 const unsigned int ,
1895 Assert (
false, ExcNotImplemented());
1904 const unsigned int ,
1905 const unsigned int )
1907 Assert (
false, ExcNotImplemented());
1917 Assert (
false, ExcNotImplemented());
1927 const unsigned int ,
1930 Assert (
false, ExcNotImplemented());
1938 const unsigned int ,
1941 Assert (
false, ExcNotImplemented());
1948 const double thickness,
1949 const bool colorize)
1952 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
1954 std::vector<Point<2> > vertices(16);
1956 coords[0] = left-thickness;
1959 coords[3] = right+thickness;
1962 for (
unsigned int i0=0; i0<4; ++i0)
1963 for (
unsigned int i1=0; i1<4; ++i1)
1964 vertices[k++] =
Point<2>(coords[i1], coords[i0]);
1971 std::vector<CellData<2> > cells(9);
1973 for (
unsigned int i0=0; i0<3; ++i0)
1974 for (
unsigned int i1=0; i1<3; ++i1)
1976 cells[k].vertices[0] = i1+4*i0;
1977 cells[k].vertices[1] = i1+4*i0+1;
1978 cells[k].vertices[2] = i1+4*i0+4;
1979 cells[k].vertices[3] = i1+4*i0+5;
1981 cells[k].material_id = materials[k];
1997 const bool colorize)
1999 const double rl2=(right+left)/2;
2011 const int cell_vertices[4][4] = { { 0,1,3,2 },
2016 std::vector<CellData<2> > cells (4,
CellData<2>());
2017 for (
unsigned int i=0; i<4; ++i)
2019 for (
unsigned int j=0; j<4; ++j)
2020 cells[i].vertices[j] = cell_vertices[i][j];
2021 cells[i].material_id = 0;
2024 std::vector<
Point<2> >(&vertices[0], &vertices[10]),
2031 cell->face(1)->set_boundary_id(1);
2033 cell->face(3)->set_boundary_id(2);
2041 const double radius_0,
2042 const double radius_1,
2043 const double half_length)
2047 vertices_tmp[0] =
Point<2> (-half_length, -radius_0);
2048 vertices_tmp[1] =
Point<2> (half_length, -radius_1);
2049 vertices_tmp[2] =
Point<2> (-half_length, radius_0);
2050 vertices_tmp[3] =
Point<2> (half_length, radius_1);
2052 const std::vector<Point<2> > vertices (&vertices_tmp[0], &vertices_tmp[4]);
2055 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2056 cell_vertices[0][i] = i;
2058 std::vector<CellData<2> > cells (1,
CellData<2> ());
2060 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2061 cells[0].vertices[i] = cell_vertices[0][i];
2063 cells[0].material_id = 0;
2068 cell->face (0)->set_boundary_id (1);
2069 cell->face (1)->set_boundary_id (2);
2071 for (
unsigned int i = 2; i < 4; ++i)
2072 cell->face (i)->set_boundary_id (0);
2094 const int cell_vertices[3][4] = {{0, 1, 3, 4},
2099 std::vector<CellData<2> > cells (3,
CellData<2>());
2101 for (
unsigned int i=0; i<3; ++i)
2103 for (
unsigned int j=0; j<4; ++j)
2104 cells[i].vertices[j] = cell_vertices[i][j];
2105 cells[i].material_id = 0;
2109 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2121 const double radius)
2126 const double a = 1./(1+std::sqrt(2.0));
2128 p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2129 p+Point<2>(-1,-1) *(radius/std::sqrt(2.0)*a),
2130 p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2131 p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)*a),
2132 p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2133 p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)),
2134 p+Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2137 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2144 std::vector<CellData<2> > cells (5,
CellData<2>());
2146 for (
unsigned int i=0; i<5; ++i)
2148 for (
unsigned int j=0; j<4; ++j)
2149 cells[i].vertices[j] = cell_vertices[i][j];
2150 cells[i].material_id = 0;
2154 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2164 const double inner_radius,
2165 const double outer_radius,
2166 const unsigned int n_cells,
2167 const bool colorize)
2169 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2170 ExcInvalidRadii ());
2183 const unsigned int N = (n_cells == 0 ?
2184 static_cast<unsigned int> 2185 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
2186 (outer_radius - inner_radius))) :
2195 std::vector<Point<2> > vertices(2*N);
2196 for (
unsigned int i=0; i<N; ++i)
2198 vertices[i] =
Point<2>( std::cos(2*pi * i/N),
2199 std::sin(2*pi * i/N)) * outer_radius;
2200 vertices[i+N] = vertices[i] * (inner_radius/outer_radius);
2202 vertices[i] += center;
2203 vertices[i+N] += center;
2206 std::vector<CellData<2> > cells (N,
CellData<2>());
2208 for (
unsigned int i=0; i<N; ++i)
2210 cells[i].vertices[0] = i;
2211 cells[i].vertices[1] = (i+1)%N;
2212 cells[i].vertices[2] = N+i;
2213 cells[i].vertices[3] = N+((i+1)%N);
2215 cells[i].material_id = 0;
2222 colorize_hyper_shell(tria, center, inner_radius, outer_radius);
2230 const double radius,
2231 const double half_length)
2233 Point<2> p1 (-half_length, -radius);
2242 switch (f->boundary_id())
2245 f->set_boundary_id(1);
2248 f->set_boundary_id(2);
2251 f->set_boundary_id(0);
2269 Assert (
false, ExcNotImplemented());
2277 const double radius)
2282 const double a = 1./(1+std::sqrt(2.0));
2284 p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2285 p+Point<2>(0,-1) *(radius/std::sqrt(2.0)*a),
2286 p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2287 p+Point<2>(0,+1) *(radius/std::sqrt(2.0)*a),
2288 p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2289 p+Point<2>(0,+1) *radius,
2290 p+Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2293 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2299 std::vector<CellData<2> > cells (4,
CellData<2>());
2301 for (
unsigned int i=0; i<4; ++i)
2303 for (
unsigned int j=0; j<4; ++j)
2304 cells[i].vertices[j] = cell_vertices[i][j];
2305 cells[i].material_id = 0;
2309 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2319 for (
unsigned int i=0; i<GeometryInfo<2>::faces_per_cell; ++i)
2325 if (cell->face(i)->center()(0) < p(0)+1.e-5 * radius)
2326 cell->face(i)->set_boundary_id(1);
2339 const double inner_radius,
2340 const double outer_radius,
2341 const unsigned int n_cells,
2342 const bool colorize)
2344 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2345 ExcInvalidRadii ());
2357 const unsigned int N = (n_cells == 0 ?
2358 static_cast<unsigned int> 2359 (std::ceil((pi* (outer_radius + inner_radius)/2) /
2360 (outer_radius - inner_radius))) :
2369 std::vector<Point<2> > vertices(2*(N+1));
2370 for (
unsigned int i=0; i<=N; ++i)
2378 vertices[i] =
Point<2>( ( (i==0) || (i==N) ?
2380 std::cos(pi * i/N - pi/2) ),
2381 std::sin(pi * i/N - pi/2)) * outer_radius;
2382 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2384 vertices[i] += center;
2385 vertices[i+N+1] += center;
2389 std::vector<CellData<2> > cells (N,
CellData<2>());
2391 for (
unsigned int i=0; i<N; ++i)
2393 cells[i].vertices[0] = i;
2394 cells[i].vertices[1] = (i+1)%(N+1);
2395 cells[i].vertices[2] = N+1+i;
2396 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2398 cells[i].material_id = 0;
2406 for (; cell!=tria.
end(); ++cell)
2408 cell->face(2)->set_boundary_id(1);
2410 tria.
begin()->face(0)->set_boundary_id(3);
2412 tria.
last()->face(1)->set_boundary_id(2);
2420 const double inner_radius,
2421 const double outer_radius,
2422 const unsigned int n_cells,
2423 const bool colorize)
2425 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2426 ExcInvalidRadii ());
2438 const unsigned int N = (n_cells == 0 ?
2439 static_cast<unsigned int> 2440 (std::ceil((pi* (outer_radius + inner_radius)/4) /
2441 (outer_radius - inner_radius))) :
2450 std::vector<Point<2> > vertices(2*(N+1));
2451 for (
unsigned int i=0; i<=N; ++i)
2460 std::cos(pi * i/N/2) ),
2461 std::sin(pi * i/N/2)) * outer_radius;
2462 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2464 vertices[i] += center;
2465 vertices[i+N+1] += center;
2469 std::vector<CellData<2> > cells (N,
CellData<2>());
2471 for (
unsigned int i=0; i<N; ++i)
2473 cells[i].vertices[0] = i;
2474 cells[i].vertices[1] = (i+1)%(N+1);
2475 cells[i].vertices[2] = N+1+i;
2476 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2478 cells[i].material_id = 0;
2486 for (; cell!=tria.
end(); ++cell)
2488 cell->face(2)->set_boundary_id(1);
2490 tria.
begin()->face(0)->set_boundary_id(3);
2492 tria.
last()->face(1)->set_boundary_id(2);
2503 const bool colorize)
2505 const double rl2=(right+left)/2;
2506 const double len = (right-left)/2.;
2531 const int cell_vertices[4][8] = { { 0,1,3,2, 10, 11, 13, 12 },
2532 { 9,4,2,5, 19,14, 12, 15 },
2533 { 3,2,7,6,13,12,17,16 },
2534 { 2,5,6,8,12,15,16,18 }
2536 std::vector<CellData<3> > cells (4,
CellData<3>());
2537 for (
unsigned int i=0; i<4; ++i)
2539 for (
unsigned int j=0; j<8; ++j)
2540 cells[i].vertices[j] = cell_vertices[i][j];
2541 cells[i].material_id = 0;
2544 std::vector<
Point<3> >(&vertices[0], &vertices[20]),
2550 Assert(
false, ExcNotImplemented());
2552 cell->face(1)->set_boundary_id(1);
2554 cell->face(3)->set_boundary_id(2);
2565 const double thickness,
2566 const bool colorize)
2569 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
2571 std::vector<Point<3> > vertices(64);
2573 coords[0] = left-thickness;
2576 coords[3] = right+thickness;
2579 for (
unsigned int z=0; z<4; ++z)
2580 for (
unsigned int y=0; y<4; ++y)
2581 for (
unsigned int x=0; x<4; ++x)
2582 vertices[k++] =
Point<3>(coords[x], coords[y], coords[z]);
2597 std::vector<CellData<3> > cells(27);
2599 for (
unsigned int z=0; z<3; ++z)
2600 for (
unsigned int y=0; y<3; ++y)
2601 for (
unsigned int x=0; x<3; ++x)
2603 cells[k].vertices[0] = x+4*y+16*z;
2604 cells[k].vertices[1] = x+4*y+16*z+1;
2605 cells[k].vertices[2] = x+4*y+16*z+4;
2606 cells[k].vertices[3] = x+4*y+16*z+5;
2607 cells[k].vertices[4] = x+4*y+16*z+16;
2608 cells[k].vertices[5] = x+4*y+16*z+17;
2609 cells[k].vertices[6] = x+4*y+16*z+20;
2610 cells[k].vertices[7] = x+4*y+16*z+21;
2612 cells[k].material_id = materials[k];
2625 const double radius_0,
2626 const double radius_1,
2627 const double half_length)
2631 n_cells =
static_cast<unsigned int>(std::ceil (half_length /
2634 const unsigned int n_vertices = 4 * (n_cells + 1);
2635 std::vector<Point<3> > vertices_tmp(n_vertices);
2637 vertices_tmp[0] =
Point<3> (-half_length, 0, -radius_0);
2638 vertices_tmp[1] =
Point<3> (-half_length, radius_0, 0);
2639 vertices_tmp[2] =
Point<3> (-half_length, -radius_0, 0);
2640 vertices_tmp[3] =
Point<3> (-half_length, 0, radius_0);
2642 const double dx = 2 * half_length / n_cells;
2644 for (
unsigned int i = 0; i < n_cells; ++i)
2646 vertices_tmp[4 * (i + 1)]
2647 = vertices_tmp[4 * i] +
2648 Point<3> (dx, 0, 0.5 * (radius_0 - radius_1) * dx / half_length);
2649 vertices_tmp[4 * i + 5]
2650 = vertices_tmp[4 * i + 1] +
2651 Point<3> (dx, 0.5 * (radius_1 - radius_0) * dx / half_length, 0);
2652 vertices_tmp[4 * i + 6]
2653 = vertices_tmp[4 * i + 2] +
2654 Point<3> (dx, 0.5 * (radius_0 - radius_1) * dx / half_length, 0);
2655 vertices_tmp[4 * i + 7]
2656 = vertices_tmp[4 * i + 3] +
2657 Point<3> (dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length);
2660 const std::vector<Point<3> > vertices (vertices_tmp.begin(),
2661 vertices_tmp.end());
2664 for (
unsigned int i = 0; i < n_cells; ++i)
2665 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2666 cell_vertices[i][j] = 4 * i + j;
2668 std::vector<CellData<3> > cells (n_cells,
CellData<3> ());
2670 for (
unsigned int i = 0; i < n_cells; ++i)
2672 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2673 cells[i].vertices[j] = cell_vertices[i][j];
2675 cells[i].material_id = 0;
2681 cell != triangulation.
end (); ++cell)
2683 if (cell->vertex (0) (0) == -half_length)
2685 cell->face (4)->set_boundary_id (1);
2687 for (
unsigned int i = 0; i < 4; ++i)
2688 cell->line (i)->set_boundary_id (0);
2691 if (cell->vertex (4) (0) == half_length)
2693 cell->face (5)->set_boundary_id (2);
2695 for (
unsigned int i = 4; i < 8; ++i)
2696 cell->line (i)->set_boundary_id (0);
2699 for (
unsigned int i = 0; i < 4; ++i)
2700 cell->face (i)->set_boundary_id (0);
2732 Point<3> ((a+b)/2,(a+b)/2,(a+b)/2),
2748 const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13},
2749 {1, 2, 10, 11, 4, 5, 13, 14},
2750 {3, 4, 12, 13, 6, 7, 15, 16},
2751 {4, 5, 13, 14, 7, 8, 16, 17},
2752 {9, 10, 18, 19, 12, 13, 21, 22},
2753 {10, 11, 19, 20, 13, 14, 22, 23},
2754 {12, 13, 21, 22, 15, 16, 24, 25}
2757 std::vector<CellData<3> > cells (7,
CellData<3>());
2759 for (
unsigned int i=0; i<7; ++i)
2761 for (
unsigned int j=0; j<8; ++j)
2762 cells[i].vertices[j] = cell_vertices[i][j];
2763 cells[i].material_id = 0;
2767 std::vector<
Point<3> >(&vertices[0], &vertices[26]),
2779 const double radius)
2781 const double a = 1./(1+std::sqrt(3.0));
2784 const unsigned int n_vertices = 16;
2785 const Point<3> vertices[n_vertices]
2790 p+
Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)*a),
2791 p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)*a),
2792 p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)*a),
2793 p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)*a),
2794 p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)*a),
2795 p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)*a),
2796 p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)*a),
2797 p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)*a),
2800 p+Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)),
2801 p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)),
2802 p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)),
2803 p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)),
2804 p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)),
2805 p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)),
2806 p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)),
2807 p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)),
2812 const unsigned int n_cells = 7;
2813 const int cell_vertices[n_cells][8] = {{0, 1, 4, 5, 3, 2, 7, 6},
2814 {8, 9, 12, 13, 0, 1, 4, 5},
2815 {9, 13, 1, 5, 10, 14, 2, 6},
2816 {11, 10, 3, 2, 15, 14, 7, 6},
2817 {8, 0, 12, 4, 11, 3, 15, 7},
2818 {8, 9, 0, 1, 11, 10, 3, 2},
2819 {12, 4, 13, 5, 15, 7, 14, 6}
2822 std::vector<CellData<3> > cells (n_cells,
CellData<3>());
2824 for (
unsigned int i=0; i<n_cells; ++i)
2826 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
2827 cells[i].vertices[j] = cell_vertices[i][j];
2828 cells[i].material_id = 0;
2832 std::vector<
Point<3> >(&vertices[0], &vertices[n_vertices]),
2837 template <
int dim,
int spacedim>
2841 const double radius)
2845 std::set<types::boundary_id> boundary_ids;
2846 boundary_ids.insert (0);
2857 const double radius,
2858 const double half_length)
2862 const double d = radius/std::sqrt(2.0);
2863 const double a = d/(1+std::sqrt(2.0));
2892 for (
unsigned int i=0; i<24; ++i)
2894 const double h = vertices[i](1);
2895 vertices[i](1) = -vertices[i](0);
2899 int cell_vertices[10][8] =
2901 {0, 1, 8, 9, 2, 3, 10, 11},
2902 {0, 2, 8, 10, 6, 4, 14, 12},
2903 {2, 3, 10, 11, 4, 5, 12, 13},
2904 {1, 7, 9, 15, 3, 5, 11, 13},
2905 {6, 4, 14, 12, 7, 5, 15, 13}
2907 for (
unsigned int i=0; i<5; ++i)
2908 for (
unsigned int j=0; j<8; ++j)
2909 cell_vertices[i+5][j] = cell_vertices[i][j]+8;
2911 std::vector<CellData<3> > cells (10,
CellData<3>());
2913 for (
unsigned int i=0; i<10; ++i)
2915 for (
unsigned int j=0; j<8; ++j)
2916 cells[i].vertices[j] = cell_vertices[i][j];
2917 cells[i].material_id = 0;
2921 std::vector<
Point<3> >(&vertices[0], &vertices[24]),
2938 for (; cell != end; ++cell)
2939 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
2940 if (cell->at_boundary(i))
2942 if (cell->face(i)->center()(0) > half_length-1.e-5)
2944 cell->face(i)->set_boundary_id(2);
2946 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++e)
2947 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
2948 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
2949 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
2950 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
2951 cell->face(i)->line(e)->set_boundary_id(2);
2953 else if (cell->face(i)->center()(0) < -half_length+1.e-5)
2955 cell->face(i)->set_boundary_id(1);
2957 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++e)
2958 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
2959 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
2960 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
2961 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
2962 cell->face(i)->line(e)->set_boundary_id(1);
2974 const double radius)
2977 const double d = radius/std::sqrt(2.0);
2978 const double a = d/(1+std::sqrt(2.0));
2980 const double b = a/2.0;
2981 const double c = d/2.0;
2983 const double hb = radius*std::sqrt(3.0)/4.0;
2984 const double hc = radius*std::sqrt(3.0)/2.0;
2989 center+Point<3>( 0, -d, -d),
2990 center+Point<3>( 0, a, -a),
2991 center+Point<3>( 0, -a, -a),
2992 center+Point<3>( 0, a, a),
2993 center+Point<3>( 0, -a, a),
2994 center+Point<3>( 0, d, d),
2995 center+Point<3>( 0, -d, d),
2997 center+Point<3>(hc, c, -c),
2998 center+Point<3>(hc, -c, -c),
2999 center+Point<3>(hb, b, -b),
3000 center+Point<3>(hb, -b, -b),
3001 center+Point<3>(hb, b, b),
3002 center+Point<3>(hb, -b, b),
3003 center+Point<3>(hc, c, c),
3004 center+Point<3>(hc, -c, c),
3007 int cell_vertices[6][8] =
3009 {0, 1, 8, 9, 2, 3, 10, 11},
3010 {0, 2, 8, 10, 6, 4, 14, 12},
3011 {2, 3, 10, 11, 4, 5, 12, 13},
3012 {1, 7, 9, 15, 3, 5, 11, 13},
3013 {6, 4, 14, 12, 7, 5, 15, 13},
3014 {8, 10, 9, 11, 14, 12, 15, 13}
3017 std::vector<CellData<3> > cells (6,
CellData<3>());
3019 for (
unsigned int i=0; i<6; ++i)
3021 for (
unsigned int j=0; j<8; ++j)
3022 cells[i].vertices[j] = cell_vertices[i][j];
3023 cells[i].material_id = 0;
3027 std::vector<
Point<3> >(&vertices[0], &vertices[16]),
3041 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3043 if (!cell->at_boundary(i))
3049 if (cell->face(i)->center()(0) < center(0)+1.e-5*radius)
3051 cell->face(i)->set_boundary_id(1);
3052 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
3055 = { cell->face(i)->line(j)->vertex(0),
3056 cell->face(i)->line(j)->vertex(1)
3058 if ((std::fabs(line_vertices[0].distance(center)-radius) >
3061 (std::fabs(line_vertices[1].distance(center)-radius) >
3063 cell->face(i)->line(j)->set_boundary_id(1);
3076 const double inner_radius,
3077 const double outer_radius,
3078 const unsigned int n_cells,
3079 const bool colorize)
3081 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3082 ExcInvalidRadii ());
3084 const unsigned int n = (n_cells==0) ? 6 : n_cells;
3086 const double irad = inner_radius/std::sqrt(3.0);
3087 const double orad = outer_radius/std::sqrt(3.0);
3088 std::vector<Point<3> > vertices;
3089 std::vector<CellData<3> > cells;
3095 for (
unsigned int i=0; i<8; ++i)
3096 vertices.push_back(p+hexahedron[i]*irad);
3097 for (
unsigned int i=0; i<8; ++i)
3098 vertices.push_back(p+hexahedron[i]*orad);
3100 const unsigned int n_cells = 6;
3101 const int cell_vertices[n_cells][8] =
3103 {8, 9, 10, 11, 0, 1, 2, 3},
3104 {9, 11, 1, 3, 13, 15, 5, 7},
3105 {12, 13, 4, 5, 14, 15, 6, 7},
3106 {8, 0, 10, 2, 12, 4, 14, 6},
3107 {8, 9, 0, 1, 12, 13, 4, 5},
3108 {10, 2, 11, 3, 14, 6, 15, 7}
3113 for (
unsigned int i=0; i<n_cells; ++i)
3115 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
3116 cells[i].vertices[j] = cell_vertices[i][j];
3117 cells[i].material_id = 0;
3127 for (
unsigned int i=0; i<8; ++i)
3128 vertices.push_back(p+hexahedron[i]*irad);
3129 for (
unsigned int i=0; i<6; ++i)
3130 vertices.push_back(p+octahedron[i]*inner_radius);
3131 for (
unsigned int i=0; i<8; ++i)
3132 vertices.push_back(p+hexahedron[i]*orad);
3133 for (
unsigned int i=0; i<6; ++i)
3134 vertices.push_back(p+octahedron[i]*outer_radius);
3136 const unsigned int n_cells = 12;
3137 const unsigned int rhombi[n_cells][4] =
3155 for (
unsigned int i=0; i<n_cells; ++i)
3157 for (
unsigned int j=0; j<4; ++j)
3159 cells[i].vertices[j ] = rhombi[i][j];
3160 cells[i].vertices[j+4] = rhombi[i][j] + 14;
3162 cells[i].material_id = 0;
3176 hyper_shell (tmp, p, inner_radius, outer_radius, 12);
3234 const double r = inner_radius / outer_radius;
3235 const double rho = 2*r/(1+r);
3239 const double middle_radius = rho * outer_radius;
3245 std::vector<bool> vertex_already_treated (tmp.
n_vertices(),
false);
3247 cell != tmp.
end(); ++cell)
3248 for (
unsigned int f=0; f<GeometryInfo<3>::faces_per_cell; ++f)
3249 if (cell->at_boundary(f))
3250 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
3251 vertex_already_treated[cell->face(f)->vertex_index(v)] =
true;
3255 cell != tmp.
end(); ++cell)
3256 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
3257 if (vertex_already_treated[cell->vertex_index(v)] ==
false)
3268 const Tensor<1,3> old_distance = cell->vertex(v) - p;
3269 const double old_radius = cell->vertex(v).distance(p);
3270 cell->vertex(v) = p + old_distance * (middle_radius / old_radius);
3272 vertex_already_treated[cell->vertex_index(v)] =
true;
3279 cell != tmp.
end(); ++cell)
3281 const unsigned int cell_index = cell->active_cell_index();
3282 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
3283 cells[cell_index].vertices[v] = cell->vertex_index(v);
3284 cells[cell_index].material_id = 0;
3295 colorize_hyper_shell(tria, p, inner_radius, outer_radius);
3306 const double inner_radius,
3307 const double outer_radius,
3308 const unsigned int n,
3309 const bool colorize)
3311 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3312 ExcInvalidRadii ());
3317 const double d = outer_radius/std::sqrt(2.0);
3318 const double a = inner_radius/std::sqrt(2.0);
3320 const double b = a/2.0;
3321 const double c = d/2.0;
3323 const double hb = inner_radius*std::sqrt(3.0)/2.0;
3324 const double hc = outer_radius*std::sqrt(3.0)/2.0;
3329 center+Point<3>( 0, -d, -d),
3330 center+Point<3>( 0, a, -a),
3331 center+Point<3>( 0, -a, -a),
3332 center+Point<3>( 0, a, a),
3333 center+Point<3>( 0, -a, a),
3334 center+Point<3>( 0, d, d),
3335 center+Point<3>( 0, -d, d),
3337 center+Point<3>(hc, c, -c),
3338 center+Point<3>(hc, -c, -c),
3339 center+Point<3>(hb, b, -b),
3340 center+Point<3>(hb, -b, -b),
3341 center+Point<3>(hb, b, b),
3342 center+Point<3>(hb, -b, b),
3343 center+Point<3>(hc, c, c),
3344 center+Point<3>(hc, -c, c),
3347 int cell_vertices[5][8] =
3349 {0, 1, 8, 9, 2, 3, 10, 11},
3350 {0, 2, 8, 10, 6, 4, 14, 12},
3351 {1, 7, 9, 15, 3, 5, 11, 13},
3352 {6, 4, 14, 12, 7, 5, 15, 13},
3353 {8, 10, 9, 11, 14, 12, 15, 13}
3356 std::vector<CellData<3> > cells (5,
CellData<3>());
3358 for (
unsigned int i=0; i<5; ++i)
3360 for (
unsigned int j=0; j<8; ++j)
3361 cells[i].vertices[j] = cell_vertices[i][j];
3362 cells[i].material_id = 0;
3366 std::vector<
Point<3> >(&vertices[0], &vertices[16]),
3372 Assert(
false, ExcIndexRange(n, 0, 5));
3380 for (; cell!=tria.
end(); ++cell)
3381 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3382 if (cell->at_boundary(i))
3383 cell->face(i)->set_all_boundary_ids(2);
3389 for (cell=tria.
begin(); cell!=tria.
end(); ++cell)
3390 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3391 if (cell->at_boundary(i))
3396 const Point<3> face_center (face->center());
3397 if (std::abs(face_center(0)-center(0)) > 1.e-6 * face_center.norm())
3399 if (std::abs((face_center-center).norm()-inner_radius) <
3400 std::abs((face_center-center).norm()-outer_radius))
3401 face->set_all_boundary_ids(0);
3403 face->set_all_boundary_ids(1);
3414 const double inner_radius,
3415 const double outer_radius,
3416 const unsigned int n,
3417 const bool colorize)
3419 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3420 ExcInvalidRadii ());
3421 if (n == 0 || n == 3)
3423 const double a = inner_radius*std::sqrt(2.0)/2e0;
3424 const double b = outer_radius*std::sqrt(2.0)/2e0;
3425 const double c = a*std::sqrt(3.0)/2e0;
3426 const double d = b*std::sqrt(3.0)/2e0;
3427 const double e = outer_radius/2e0;
3428 const double h = inner_radius/2e0;
3430 std::vector<Point<3> > vertices;
3432 vertices.push_back (center+
Point<3>( 0, inner_radius, 0));
3433 vertices.push_back (center+
Point<3>( a, a, 0));
3434 vertices.push_back (center+
Point<3>( b, b, 0));
3435 vertices.push_back (center+
Point<3>( 0, outer_radius, 0));
3436 vertices.push_back (center+
Point<3>( 0, a , a));
3437 vertices.push_back (center+
Point<3>( c, c , h));
3438 vertices.push_back (center+
Point<3>( d, d , e));
3439 vertices.push_back (center+
Point<3>( 0, b , b));
3440 vertices.push_back (center+
Point<3>( inner_radius, 0 , 0));
3441 vertices.push_back (center+
Point<3>( outer_radius, 0 , 0));
3442 vertices.push_back (center+
Point<3>( a, 0 , a));
3443 vertices.push_back (center+
Point<3>( b, 0 , b));
3444 vertices.push_back (center+
Point<3>( 0, 0 , inner_radius));
3445 vertices.push_back (center+
Point<3>( 0, 0 , outer_radius));
3447 const int cell_vertices[3][8] =
3449 {0, 1, 3, 2, 4, 5, 7, 6},
3450 {1, 8, 2, 9, 5, 10, 6, 11},
3451 {4, 5, 7, 6, 12, 10, 13, 11},
3453 std::vector<CellData<3> > cells(3);
3455 for (
unsigned int i=0; i<3; ++i)
3457 for (
unsigned int j=0; j<8; ++j)
3458 cells[i].vertices[j] = cell_vertices[i][j];
3459 cells[i].material_id = 0;
3470 colorize_quarter_hyper_shell(tria, center, inner_radius, outer_radius);
3477 const double length,
3478 const double inner_radius,
3479 const double outer_radius,
3480 const unsigned int n_radial_cells,
3481 const unsigned int n_axial_cells)
3483 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3484 ExcInvalidRadii ());
3497 const unsigned int N_r = (n_radial_cells == 0 ?
3498 static_cast<unsigned int> 3499 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
3500 (outer_radius - inner_radius))) :
3502 const unsigned int N_z = (n_axial_cells == 0 ?
3503 static_cast<unsigned int> 3504 (std::ceil (length /
3505 (2*pi*(outer_radius + inner_radius)/2/N_r))) :
3514 std::vector<Point<2> > vertices_2d(2*N_r);
3515 for (
unsigned int i=0; i<N_r; ++i)
3517 vertices_2d[i] =
Point<2>( std::cos(2*pi * i/N_r),
3518 std::sin(2*pi * i/N_r)) * outer_radius;
3519 vertices_2d[i+N_r] = vertices_2d[i] * (inner_radius/outer_radius);
3522 std::vector<Point<3> > vertices_3d;
3523 vertices_3d.reserve (2*N_r*(N_z+1));
3524 for (
unsigned int j=0; j<=N_z; ++j)
3525 for (
unsigned int i=0; i<2*N_r; ++i)
3527 const Point<3> v (vertices_2d[i][0],
3530 vertices_3d.push_back (v);
3533 std::vector<CellData<3> > cells (N_r*N_z,
CellData<3>());
3535 for (
unsigned int j=0; j<N_z; ++j)
3536 for (
unsigned int i=0; i<N_r; ++i)
3538 cells[i+j*N_r].vertices[0] = i + (j+1)*2*N_r;
3539 cells[i+j*N_r].vertices[1] = (i+1)%N_r + (j+1)*2*N_r;
3540 cells[i+j*N_r].vertices[2] = i + j*2*N_r;
3541 cells[i+j*N_r].vertices[3] = (i+1)%N_r + j*2*N_r;
3543 cells[i+j*N_r].vertices[4] = N_r+i + (j+1)*2*N_r;
3544 cells[i+j*N_r].vertices[5] = N_r+((i+1)%N_r) + (j+1)*2*N_r;
3545 cells[i+j*N_r].vertices[6] = N_r+i + j*2*N_r;
3546 cells[i+j*N_r].vertices[7] = N_r+((i+1)%N_r) + j*2*N_r;
3548 cells[i+j*N_r].material_id = 0;
3557 template <
int dim,
int spacedim>
3564 ExcMessage (
"The input triangulations must be coarse meshes."));
3566 ExcMessage (
"The input triangulations must be coarse meshes."));
3569 std::vector<Point<spacedim> > vertices = triangulation_1.
get_vertices();
3570 vertices.insert (vertices.end(),
3575 std::vector<CellData<dim> > cells;
3576 cells.reserve (triangulation_1.
n_cells() + triangulation_2.
n_cells());
3578 cell = triangulation_1.
begin(); cell != triangulation_1.
end(); ++cell)
3581 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3582 this_cell.
vertices[v] = cell->vertex_index(v);
3583 this_cell.material_id = cell->material_id();
3584 cells.push_back (this_cell);
3590 cell = triangulation_2.
begin(); cell != triangulation_2.
end(); ++cell)
3593 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3595 this_cell.material_id = cell->material_id();
3596 cells.push_back (this_cell);
3602 std::vector<unsigned int> considered_vertices;
3605 considered_vertices);
3615 template <
int dim,
int spacedim>
3622 ExcMessage (
"The two input triangulations are not derived from " 3623 "the same coarse mesh as required."));
3627 ExcMessage (
"The source triangulations for this function must both " 3628 "be available entirely locally, and not be distributed " 3629 "triangulations."));
3646 for (
unsigned int iteration=0; iteration<triangulation_2.
n_levels();
3652 bool any_cell_flagged =
false;
3655 result_cell != result.
end(); ++result_cell)
3656 if (intergrid_map[result_cell]->has_children())
3658 any_cell_flagged =
true;
3659 result_cell->set_refine_flag ();
3662 if (any_cell_flagged ==
false)
3671 template <
int dim,
int spacedim>
3679 std::vector<Point<spacedim> > vertices = input_triangulation.
get_vertices();
3683 std::vector<CellData<dim> > cells;
3685 cell = input_triangulation.
begin_active(); cell != input_triangulation.
end(); ++cell)
3686 if (cells_to_remove.find(cell) == cells_to_remove.end())
3688 Assert (static_cast<unsigned int>(cell->level()) == input_triangulation.
n_levels()-1,
3689 ExcMessage (
"Your input triangulation appears to have " 3690 "adaptively refined cells. This is not allowed. You can " 3691 "only call this function on a triangulation in which " 3692 "all cells are on the same refinement level."));
3695 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3696 this_cell.
vertices[v] = cell->vertex_index(v);
3697 this_cell.material_id = cell->material_id();
3698 cells.push_back (this_cell);
3704 std::vector<unsigned int> considered_vertices;
3707 considered_vertices);
3718 const unsigned int n_slices,
3719 const double height,
3723 ExcMessage (
"The input triangulation must be a coarse mesh, i.e., it must " 3724 "not have been refined."));
3726 ExcMessage(
"The output triangulation object needs to be empty."));
3728 ExcMessage(
"The given height for extrusion must be positive."));
3730 ExcMessage(
"The number of slices for extrusion must be at least 2."));
3732 std::vector<Point<3> > points(n_slices*input.
n_vertices());
3733 std::vector<CellData<3> > cells;
3738 for (
unsigned int slice=0; slice<n_slices; ++slice)
3740 for (
unsigned int i=0; i<input.
n_vertices(); ++i)
3743 points[slice*input.
n_vertices()+i](0) = v(0);
3744 points[slice*input.
n_vertices()+i](1) = v(1);
3745 points[slice*input.
n_vertices()+i](2) = height * slice / (n_slices-1);
3752 cell = input.
begin(); cell != input.
end(); ++cell)
3754 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
3757 for (
unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
3760 = cell->vertex_index(v)+slice*input.
n_vertices();
3762 = cell->vertex_index(v)+(slice+1)*input.
n_vertices();
3765 this_cell.material_id = cell->material_id();
3766 cells.push_back(this_cell);
3778 cell = input.
begin(); cell != input.
end(); ++cell)
3781 for (
unsigned int f=0; f<4; ++f)
3782 if (cell->at_boundary(f)
3784 (cell->face(f)->boundary_indicator() != 0))
3786 quad.boundary_id = cell->face(f)->boundary_id();
3787 max_boundary_id = std::max(max_boundary_id, quad.boundary_id);
3788 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
3805 ExcMessage (
"The input triangulation to this function is using boundary " 3806 "indicators in a range that do not allow using " 3807 "max_boundary_id+1 and max_boundary_id+2 as boundary " 3808 "indicators for the bottom and top faces of the " 3809 "extruded triangulation."));
3811 cell = input.
begin(); cell != input.
end(); ++cell)
3814 quad.boundary_id = max_boundary_id + 1;
3815 quad.
vertices[0] = cell->vertex_index(0);
3816 quad.
vertices[1] = cell->vertex_index(1);
3817 quad.
vertices[2] = cell->vertex_index(2);
3818 quad.
vertices[3] = cell->vertex_index(3);
3821 quad.boundary_id = max_boundary_id + 2;
3822 for (
int i=0; i<4; ++i)
3842 Assert(
false, ExcNotImplemented());
3850 const double inner_radius,
3851 const double outer_radius,
3858 Assert(inner_radius < outer_radius,
3859 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
3864 center, inner_radius, outer_radius,
3868 endc = triangulation.
end();
3869 std::vector<bool> treated_vertices(triangulation.
n_vertices(),
false);
3870 for (; cell != endc; ++cell)
3872 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
3873 if (cell->face(f)->at_boundary())
3875 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
3877 unsigned int vv = cell->face(f)->vertex_index(v);
3878 if (treated_vertices[vv] ==
false)
3880 treated_vertices[vv] =
true;
3884 cell->face(f)->vertex(v) = center+
Point<dim>(outer_radius,outer_radius);
3887 cell->face(f)->vertex(v) = center+Point<dim>(-outer_radius,outer_radius);
3890 cell->face(f)->vertex(v) = center+Point<dim>(-outer_radius,-outer_radius);
3893 cell->face(f)->vertex(v) = center+Point<dim>(outer_radius,-outer_radius);
3901 double eps = 1e-3 * outer_radius;
3903 for (; cell != endc; ++cell)
3905 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
3906 if (cell->face(f)->at_boundary())
3908 double dx = cell->face(f)->center()(0) - center(0);
3909 double dy = cell->face(f)->center()(1) - center(1);
3912 if (std::abs(dx + outer_radius) < eps)
3913 cell->face(f)->set_boundary_id(0);
3914 else if (std::abs(dx - outer_radius) < eps)
3915 cell->face(f)->set_boundary_id(1);
3916 else if (std::abs(dy + outer_radius) < eps)
3917 cell->face(f)->set_boundary_id(2);
3918 else if (std::abs(dy - outer_radius) < eps)
3919 cell->face(f)->set_boundary_id(3);
3921 cell->face(f)->set_boundary_id(4);
3925 double d = (cell->face(f)->center() - center).norm();
3926 if (d-inner_radius < 0)
3927 cell->face(f)->set_boundary_id(1);
3929 cell->face(f)->set_boundary_id(0);
3939 const double inner_radius,
3940 const double outer_radius,
3942 const unsigned int Nz,
3947 Assert(inner_radius < outer_radius,
3948 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
3950 ExcMessage(
"Must give positive extension L"));
3954 L, inner_radius, outer_radius,
3960 endc = triangulation.
end();
3961 std::vector<bool> treated_vertices(triangulation.
n_vertices(),
false);
3962 for (; cell != endc; ++cell)
3964 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
3965 if (cell->face(f)->at_boundary())
3967 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
3969 unsigned int vv = cell->face(f)->vertex_index(v);
3970 if (treated_vertices[vv] ==
false)
3972 treated_vertices[vv] =
true;
3973 for (
unsigned int i=0; i<=Nz; ++i)
3975 double d = ((double) i)*L/((double) Nz);
3979 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,outer_radius,d);
3982 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,outer_radius,d);
3985 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,-outer_radius,d);
3988 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,-outer_radius,d);
3998 double eps = 1e-3 * outer_radius;
4000 for (; cell != endc; ++cell)
4002 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4003 if (cell->face(f)->at_boundary())
4005 double dx = cell->face(f)->center()(0);
4006 double dy = cell->face(f)->center()(1);
4007 double dz = cell->face(f)->center()(2);
4011 if (std::abs(dx + outer_radius) < eps)
4012 cell->face(f)->set_boundary_id(0);
4014 else if (std::abs(dx - outer_radius) < eps)
4015 cell->face(f)->set_boundary_id(1);
4017 else if (std::abs(dy + outer_radius) < eps)
4018 cell->face(f)->set_boundary_id(2);
4020 else if (std::abs(dy - outer_radius) < eps)
4021 cell->face(f)->set_boundary_id(3);
4023 else if (std::abs(dz) < eps)
4024 cell->face(f)->set_boundary_id(4);
4026 else if (std::abs(dz - L) < eps)
4027 cell->face(f)->set_boundary_id(5);
4031 cell->face(f)->set_boundary_id(6);
4032 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_face; ++l)
4033 cell->face(f)->line(l)->set_boundary_id(6);
4041 double d = c.
norm();
4042 if (d-inner_radius < 0)
4044 cell->face(f)->set_boundary_id(1);
4045 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_face; ++l)
4046 cell->face(f)->line(l)->set_boundary_id(1);
4049 cell->face(f)->set_boundary_id(0);
4055 template <
int dim,
int spacedim1,
int spacedim2>
4064 ExcMessage(
"Cannot use this function on parallel::distributed::Triangulation."));
4066 std::vector<Point<spacedim2> > v;
4067 std::vector<CellData<dim> > cells;
4070 const unsigned int spacedim = std::min(spacedim1,spacedim2);
4071 const std::vector<Point<spacedim1> > &in_vertices = in_tria.
get_vertices();
4073 v.resize(in_vertices.size());
4074 for (
unsigned int i=0; i<in_vertices.size(); ++i)
4075 for (
unsigned int d=0; d<spacedim; ++d)
4076 v[i][d] = in_vertices[i][d];
4081 endc = in_tria.
end();
4083 for (
unsigned int id=0; cell != endc; ++cell, ++id)
4085 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
4086 cells[
id].vertices[i] = cell->vertex_index(i);
4087 cells[id].material_id = cell->material_id();
4088 cells[id].manifold_id = cell->manifold_id();
4104 for (; face != endf; ++face)
4105 if (face->at_boundary())
4107 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4108 subcelldata.
boundary_lines[f].vertices[i] = face->vertex_index(i);
4119 for (; face != endf; ++face)
4120 if (face->at_boundary())
4122 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4123 subcelldata.
boundary_quads[f].vertices[i] = face->vertex_index(i);
4132 Assert(
false, ExcInternalError());
4140 template <
template <
int,
int>
class MeshType,
int dim,
int spacedim>
4142 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4143 typename MeshType<dim,spacedim>::face_iterator>
4145 typename ExtractBoundaryMesh<MeshType,dim,spacedim>::return_type
4148 MeshType<dim-1,spacedim> &surface_mesh,
4149 const std::set<types::boundary_id> &boundary_ids)
4156 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4157 typename MeshType<dim,spacedim>::face_iterator>
4158 surface_to_volume_mapping;
4160 const unsigned int boundary_dim = dim-1;
4164 std::vector<typename MeshType<dim,spacedim>::face_iterator>
4168 std::vector< bool > touched (volume_mesh.get_triangulation().n_vertices(),
false);
4169 std::vector< CellData< boundary_dim > > cells;
4171 std::vector< Point<spacedim> > vertices;
4173 std::map<unsigned int,unsigned int> map_vert_index;
4175 for (
typename MeshType<dim,spacedim>::cell_iterator
4176 cell = volume_mesh.begin(0);
4177 cell != volume_mesh.end(0);
4179 for (
unsigned int i=0; i < GeometryInfo<dim>::faces_per_cell; ++i)
4181 const typename MeshType<dim,spacedim>::face_iterator
4182 face = cell->face(i);
4184 if ( face->at_boundary()
4186 (boundary_ids.empty() ||
4187 ( boundary_ids.find(face->boundary_id()) != boundary_ids.end())) )
4191 for (
unsigned int j=0;
4192 j<GeometryInfo<boundary_dim>::vertices_per_cell; ++j)
4194 const unsigned int v_index = face->vertex_index(j);
4196 if ( !touched[v_index] )
4198 vertices.push_back(face->vertex(j));
4199 map_vert_index[v_index] = vertices.size() - 1;
4200 touched[v_index] =
true;
4203 c_data.
vertices[j] = map_vert_index[v_index];
4234 for (
unsigned int e=0; e<4; ++e)
4240 bool edge_found =
false;
4241 for (
unsigned int i=0; i<subcell_data.
boundary_lines.size(); ++i)
4243 == map_vert_index[face->line(e)->vertex_index(0)])
4246 == map_vert_index[face->line(e)->vertex_index(1)]))
4249 == map_vert_index[face->line(e)->vertex_index(1)])
4252 == map_vert_index[face->line(e)->vertex_index(0)])))
4257 if (edge_found ==
true)
4262 edge.
vertices[0] = map_vert_index[face->line(e)->vertex_index(0)];
4263 edge.
vertices[1] = map_vert_index[face->line(e)->vertex_index(1)];
4271 cells.push_back(c_data);
4272 mapping.push_back(face);
4278 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4279 .create_triangulation (vertices, cells, subcell_data);
4282 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4283 cell = surface_mesh.begin(0);
4284 cell!=surface_mesh.end(0); ++cell)
4285 surface_to_volume_mapping[cell] = mapping.at(cell->index());
4289 bool changed =
false;
4291 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4292 cell = surface_mesh.begin_active(); cell!=surface_mesh.end(); ++cell)
4293 if (surface_to_volume_mapping[cell]->has_children() == true )
4295 cell->set_refine_flag ();
4301 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4302 .execute_coarsening_and_refinement();
4304 for (
typename MeshType<dim-1,spacedim>::cell_iterator
4305 surface_cell = surface_mesh.begin(); surface_cell!=surface_mesh.end(); ++surface_cell)
4306 for (
unsigned int c=0; c<surface_cell->n_children(); c++)
4307 if (surface_to_volume_mapping.find(surface_cell->child(c)) == surface_to_volume_mapping.end())
4308 surface_to_volume_mapping[surface_cell->child(c)]
4309 = surface_to_volume_mapping[surface_cell]->child(c);
4316 return surface_to_volume_mapping;
4328 const double radius);
4332 const double radius);
4334 #include "grid_generator.inst" 4336 DEAL_II_NAMESPACE_CLOSE
std::vector< CellData< 1 > > boundary_lines
unsigned int n_active_cells() const
void set_boundary(const types::manifold_id number, const Boundary< dim, spacedim > &boundary_object)
void create_union_triangulation(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
unsigned int n_vertices() const
#define AssertDimension(dim1, dim2)
active_face_iterator begin_active_face() const
cell_iterator last() const
void hyper_sphere(Triangulation< dim, spacedim > &tria, const Point< spacedim > ¢er=Point< spacedim >(), const double radius=1.)
unsigned int n_cells() const
unsigned char material_id
static unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
void truncated_cone(Triangulation< dim > &tria, const double radius_0=1.0, const double radius_1=0.5, const double half_length=1.0)
void hyper_rectangle(Triangulation< dim, spacedim > &tria, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void moebius(Triangulation< 3, 3 > &tria, const unsigned int n_cells, const unsigned int n_rotations, const double R, const double r)
::ExceptionBase & ExcMessage(std::string arg1)
void flatten_triangulation(const Triangulation< dim, spacedim1 > &in_tria, Triangulation< dim, spacedim2 > &out_tria)
void quarter_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
virtual void copy_triangulation(const Triangulation< dim, spacedim > &old_tria)
void extrude_triangulation(const Triangulation< 2, 2 > &input, const unsigned int n_slices, const double height, Triangulation< 3, 3 > &result)
void enclosed_hyper_cube(Triangulation< dim > &tria, const double left=0., const double right=1., const double thickness=1., const bool colorize=false)
void parallelogram(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], const bool colorize=false)
active_cell_iterator begin_active(const unsigned int level=0) const
#define AssertThrow(cond, exc)
numbers::NumberTraits< Number >::real_type norm() const
void hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, bool colorize=false)
cell_iterator begin(const unsigned int level=0) const
void cylinder_shell(Triangulation< dim > &tria, const double length, const double inner_radius, const double outer_radius, const unsigned int n_radial_cells=0, const unsigned int n_axial_cells=0)
unsigned int n_levels() const
void hyper_cross(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &sizes, const bool colorize_cells=false)
A center cell with stacks of cell protruding from each surface.
unsigned int n_active_faces() const
cell_iterator end() const
void merge_triangulations(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
void subdivided_parallelepiped(Triangulation< dim > &tria, const unsigned int n_subdivisions, const Point< dim >(&corners) [dim], const bool colorize=false)
virtual void execute_coarsening_and_refinement()
void half_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
unsigned int n_active_lines() const
void simplex(Triangulation< dim, dim > &tria, const std::vector< Point< dim > > &vertices)
Triangulation of a d-simplex with (d+1) vertices and mesh cells.
static void reorder_cells(std::vector< CellData< dim > > &original_cells, const bool use_new_style_ordering=false)
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
#define Assert(cond, exc)
static void invert_all_cells_of_negative_grid(const std::vector< Point< spacedim > > &all_vertices, std::vector< CellData< dim > > &original_cells)
const types::boundary_id invalid_boundary_id
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
const std::vector< Point< spacedim > > & get_vertices() const
::ExceptionBase & ExcLowerRange(int arg1, int arg2)." )
void subdivided_hyper_cube(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double left=0., const double right=1.)
void create_triangulation_with_removed_cells(const Triangulation< dim, spacedim > &input_triangulation, const std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > &cells_to_remove, Triangulation< dim, spacedim > &result)
void make_mapping(const MeshType &source_grid, const MeshType &destination_grid)
std::map< typename MeshType< dim-1, spacedim >::cell_iterator, typename MeshType< dim, spacedim >::face_iterator > extract_boundary_mesh(const MeshType< dim, spacedim > &volume_mesh, MeshType< dim-1, spacedim > &surface_mesh, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
face_iterator begin_face() const
void hyper_cube_slit(Triangulation< dim > &tria, const double left=0., const double right=1., const bool colorize=false)
void subdivided_hyper_rectangle(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
types::manifold_id manifold_id
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
void half_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
std::vector< CellData< 2 > > boundary_quads
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void refine_global(const unsigned int times=1)
unsigned int size(const unsigned int i) const
unsigned char boundary_id
face_iterator end_face() const
const types::boundary_id internal_face_boundary_id
void hyper_cube_with_cylindrical_hole(Triangulation< dim > &triangulation, const double inner_radius=.25, const double outer_radius=.5, const double L=.5, const unsigned int repetitions=1, const bool colorize=false)
void hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners) [dim], const bool colorize=false)
void hyper_L(Triangulation< dim > &tria, const double left=-1., const double right=1.)
const types::material_id invalid_material_id
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
unsigned int vertices[GeometryInfo< structdim >::vertices_per_cell]
void torus(Triangulation< 2, 3 > &tria, const double R, const double r)