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/manifold_lib.h> 20 #include <deal.II/grid/tria.h> 21 #include <deal.II/grid/tria_accessor.h> 22 #include <deal.II/grid/tria_iterator.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)
122 if (face->at_boundary())
123 if (face->boundary_id() == 0)
127 if (std::abs(center(0)-p1[0]) <
epsilon)
128 face->set_boundary_id(0);
129 else if (std::abs(center(0) - p2[0]) < epsilon)
130 face->set_boundary_id(1);
131 else if (dim > 1 && std::abs(center(1) - p1[1]) < epsilon)
132 face->set_boundary_id(2);
133 else if (dim > 1 && std::abs(center(1) - p2[1]) < epsilon)
134 face->set_boundary_id(3);
135 else if (dim > 2 && std::abs(center(2) - p1[2]) < epsilon)
136 face->set_boundary_id(4);
137 else if (dim > 2 && std::abs(center(2) - p2[2]) < epsilon)
138 face->set_boundary_id(5);
149 cell != tria.
end(); ++cell)
152 for (
unsigned int d=0;
d<dim; ++
d)
153 if (cell->center()(
d) > 0)
155 cell->set_material_id(
id);
177 cell != tria.
end (); ++cell)
180 cell->face (2)->set_all_boundary_ids (1);
204 cell->face(4)->set_all_boundary_ids(1);
208 cell->face(2)->set_all_boundary_ids(1);
212 cell->face(2)->set_all_boundary_ids(1);
216 cell->face(0)->set_all_boundary_ids(1);
220 cell->face(2)->set_all_boundary_ids(1);
224 cell->face(0)->set_all_boundary_ids(1);
231 cell != tria.
end(); ++cell)
234 cell->face(5)->set_all_boundary_ids(1);
250 unsigned int count = 0;
252 cell != tria.
end(); ++cell)
253 if (cell->face(5)->at_boundary())
255 cell->face(5)->set_all_boundary_ids(1);
274 const double inner_radius,
275 const double outer_radius)
280 double middle = (outer_radius-inner_radius)/2e0 + inner_radius;
281 double eps = 1
e-3*middle;
284 for (; cell!=tria.
end(); ++cell)
285 for (
unsigned int f=0; f<GeometryInfo<3>::faces_per_cell; ++f)
287 if (!cell->face(f)->at_boundary())
290 double radius = cell->face(f)->center().norm() - center.
norm();
291 if (std::fabs(cell->face(f)->center()(0)) <
eps )
293 cell->face(f)->set_boundary_id(2);
294 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
295 if (cell->face(f)->line(j)->at_boundary())
296 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
297 cell->face(f)->line(j)->set_boundary_id(2);
299 else if (std::fabs(cell->face(f)->center()(1)) <
eps)
301 cell->face(f)->set_boundary_id(3);
302 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
303 if (cell->face(f)->line(j)->at_boundary())
304 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
305 cell->face(f)->line(j)->set_boundary_id(3);
307 else if (std::fabs(cell->face(f)->center()(2)) <
eps )
309 cell->face(f)->set_boundary_id(4);
310 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
311 if (cell->face(f)->line(j)->at_boundary())
312 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps)
313 cell->face(f)->line(j)->set_boundary_id(4);
315 else if (radius < middle)
317 cell->face(f)->set_boundary_id(0);
318 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
319 if (cell->face(f)->line(j)->at_boundary())
320 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps)
321 cell->face(f)->line(j)->set_boundary_id(0);
323 else if (radius > middle)
325 cell->face(f)->set_boundary_id(1);
326 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
327 if (cell->face(f)->line(j)->at_boundary())
328 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps)
329 cell->face(f)->line(j)->set_boundary_id(1);
339 template <
int dim,
int spacedim>
350 for (
unsigned int i=0; i<dim; ++i)
352 p1(i) = std::min(p_1(i), p_2(i));
353 p2(i) = std::max(p_1(i), p_2(i));
364 vertices[0] = vertices[1] = p1;
365 vertices[2] = vertices[3] = p2;
367 vertices[1](0) = p2(0);
368 vertices[2](0) = p1(0);
371 vertices[0] = vertices[1] = vertices[2] = vertices[3] = p1;
372 vertices[4] = vertices[5] = vertices[6] = vertices[7] = p2;
374 vertices[1](0) = p2(0);
375 vertices[2](1) = p2(1);
376 vertices[3](0) = p2(0);
377 vertices[3](1) = p2(1);
379 vertices[4](0) = p1(0);
380 vertices[4](1) = p1(1);
381 vertices[5](1) = p1(1);
382 vertices[6](0) = p1(0);
390 std::vector<CellData<dim> > cells (1);
391 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
392 cells[0].vertices[i] = i;
393 cells[0].material_id = 0;
399 colorize_hyper_rectangle (tria);
403 template <
int dim,
int spacedim>
410 ExcMessage (
"Invalid left-to-right bounds of hypercube"));
413 for (
unsigned int i=0; i<dim; ++i)
432 for (
unsigned int d=0; d<dim; ++d)
433 for (
unsigned int c=1; c<=dim; ++c)
434 vector_matrix[c-1][d] = vertices[c](d) - vertices[0](d);
439 std::vector<Point<dim> > points = vertices;
443 for (
unsigned int i=0; i<=dim; ++i)
445 points.push_back(0.5*(points[i]+points[(i+1)%(dim+1)]));
451 for (
unsigned int i=1; i<dim; ++i)
452 points.push_back(0.5*(points[i-1]+points[i+1]));
454 for (
unsigned int i=0; i<=dim; ++i)
455 points.push_back(1./3.*
457 points[(i+1)%(dim+1)]+
458 points[(i+2)%(dim+1)]));
460 points.push_back((1./(dim+1))*center);
462 std::vector<CellData<dim> > cells(dim+1);
467 cells[0].vertices[0] = 0;
468 cells[0].vertices[1] = 3;
469 cells[0].vertices[2] = 5;
470 cells[0].vertices[3] = 6;
471 cells[0].material_id = 0;
473 cells[1].vertices[0] = 3;
474 cells[1].vertices[1] = 1;
475 cells[1].vertices[2] = 6;
476 cells[1].vertices[3] = 4;
477 cells[1].material_id = 0;
479 cells[2].vertices[0] = 5;
480 cells[2].vertices[1] = 6;
481 cells[2].vertices[2] = 2;
482 cells[2].vertices[3] = 4;
483 cells[2].material_id = 0;
487 cells[0].vertices[0] = 0;
488 cells[0].vertices[1] = 4;
489 cells[0].vertices[2] = 8;
490 cells[0].vertices[3] = 10;
491 cells[0].vertices[4] = 7;
492 cells[0].vertices[5] = 13;
493 cells[0].vertices[6] = 12;
494 cells[0].vertices[7] = 14;
495 cells[0].material_id = 0;
497 cells[1].vertices[0] = 4;
498 cells[1].vertices[1] = 1;
499 cells[1].vertices[2] = 10;
500 cells[1].vertices[3] = 5;
501 cells[1].vertices[4] = 13;
502 cells[1].vertices[5] = 9;
503 cells[1].vertices[6] = 14;
504 cells[1].vertices[7] = 11;
505 cells[1].material_id = 0;
507 cells[2].vertices[0] = 8;
508 cells[2].vertices[1] = 10;
509 cells[2].vertices[2] = 2;
510 cells[2].vertices[3] = 5;
511 cells[2].vertices[4] = 12;
512 cells[2].vertices[5] = 14;
513 cells[2].vertices[6] = 6;
514 cells[2].vertices[7] = 11;
515 cells[2].material_id = 0;
517 cells[3].vertices[0] = 7;
518 cells[3].vertices[1] = 13;
519 cells[3].vertices[2] = 12;
520 cells[3].vertices[3] = 14;
521 cells[3].vertices[4] = 3;
522 cells[3].vertices[5] = 9;
523 cells[3].vertices[6] = 6;
524 cells[3].vertices[7] = 11;
525 cells[3].material_id = 0;
536 const unsigned int n_cells,
537 const unsigned int n_rotations,
541 const unsigned int dim=3;
542 Assert (n_cells>4,
ExcMessage(
"More than 4 cells are needed to create a moebius grid."));
543 Assert (r>0 && R>0,
ExcMessage(
"Outer and inner radius must be positive."));
544 Assert (R>r,
ExcMessage(
"Outer radius must be greater than inner radius."));
547 std::vector<Point<dim> > vertices (4*n_cells);
548 double beta_step=n_rotations*
numbers::PI/2.0/n_cells;
551 for (
unsigned int i=0; i<n_cells; ++i)
552 for (
unsigned int j=0; j<4; ++j)
554 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);
555 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);
556 vertices[4*i+j][2]=r*std::sin(i*beta_step+j*
numbers::PI/2.0);
559 unsigned int offset=0;
561 std::vector<CellData<dim> > cells (n_cells);
562 for (
unsigned int i=0; i<n_cells; ++i)
564 for (
unsigned int j=0; j<2; ++j)
566 cells[i].vertices[0+4*j]=offset+0+4*j;
567 cells[i].vertices[1+4*j]=offset+3+4*j;
568 cells[i].vertices[2+4*j]=offset+2+4*j;
569 cells[i].vertices[3+4*j]=offset+1+4*j;
572 cells[i].material_id=0;
576 cells[n_cells-1].vertices[4]=(0+n_rotations)%4;
577 cells[n_cells-1].vertices[5]=(3+n_rotations)%4;
578 cells[n_cells-1].vertices[6]=(2+n_rotations)%4;
579 cells[n_cells-1].vertices[7]=(1+n_rotations)%4;
597 const unsigned int dim=2;
598 const unsigned int spacedim=3;
599 std::vector<Point<spacedim> > vertices (16);
618 std::vector<CellData<dim> > cells (16);
620 cells[0].vertices[0] = 0;
621 cells[0].vertices[1] = 4;
622 cells[0].vertices[2] = 7;
623 cells[0].vertices[3] = 3;
624 cells[0].material_id = 0;
626 cells[1].vertices[0] = 1;
627 cells[1].vertices[1] = 5;
628 cells[1].vertices[2] = 4;
629 cells[1].vertices[3] = 0;
630 cells[1].material_id = 0;
632 cells[2].vertices[0] = 2;
633 cells[2].vertices[1] = 6;
634 cells[2].vertices[2] = 5;
635 cells[2].vertices[3] = 1;
636 cells[2].material_id = 0;
638 cells[3].vertices[0] = 3;
639 cells[3].vertices[1] = 7;
640 cells[3].vertices[2] = 6;
641 cells[3].vertices[3] = 2;
642 cells[3].material_id = 0;
644 cells[4].vertices[0] = 4;
645 cells[4].vertices[1] = 8;
646 cells[4].vertices[2] = 11;
647 cells[4].vertices[3] = 7;
648 cells[4].material_id = 0;
650 cells[5].vertices[0] = 5;
651 cells[5].vertices[1] = 9;
652 cells[5].vertices[2] = 8;
653 cells[5].vertices[3] = 4;
654 cells[5].material_id = 0;
656 cells[6].vertices[0] = 6;
657 cells[6].vertices[1] = 10;
658 cells[6].vertices[2] = 9;
659 cells[6].vertices[3] = 5;
660 cells[6].material_id = 0;
662 cells[7].vertices[0] = 7;
663 cells[7].vertices[1] = 11;
664 cells[7].vertices[2] = 10;
665 cells[7].vertices[3] = 6;
666 cells[7].material_id = 0;
668 cells[8].vertices[0] = 8;
669 cells[8].vertices[1] = 12;
670 cells[8].vertices[2] = 15;
671 cells[8].vertices[3] = 11;
672 cells[8].material_id = 0;
674 cells[9].vertices[0] = 9;
675 cells[9].vertices[1] = 13;
676 cells[9].vertices[2] = 12;
677 cells[9].vertices[3] = 8;
678 cells[9].material_id = 0;
680 cells[10].vertices[0] = 10;
681 cells[10].vertices[1] = 14;
682 cells[10].vertices[2] = 13;
683 cells[10].vertices[3] = 9;
684 cells[10].material_id = 0;
686 cells[11].vertices[0] = 11;
687 cells[11].vertices[1] = 15;
688 cells[11].vertices[2] = 14;
689 cells[11].vertices[3] = 10;
690 cells[11].material_id = 0;
692 cells[12].vertices[0] = 12;
693 cells[12].vertices[1] = 0;
694 cells[12].vertices[2] = 3;
695 cells[12].vertices[3] = 15;
696 cells[12].material_id = 0;
698 cells[13].vertices[0] = 13;
699 cells[13].vertices[1] = 1;
700 cells[13].vertices[2] = 0;
701 cells[13].vertices[3] = 12;
702 cells[13].material_id = 0;
704 cells[14].vertices[0] = 14;
705 cells[14].vertices[1] = 2;
706 cells[14].vertices[2] = 1;
707 cells[14].vertices[3] = 13;
708 cells[14].material_id = 0;
710 cells[15].vertices[0] = 15;
711 cells[15].vertices[1] = 3;
712 cells[15].vertices[2] = 2;
713 cells[15].vertices[3] = 14;
714 cells[15].material_id = 0;
749 tria.set_all_manifold_ids(1);
750 tria.set_all_manifold_ids_on_boundary(0);
769 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
770 cell->vertex(i) = vertices[i];
775 ExcMessage(
"The volume of the cell is not greater than zero. " 776 "This could be due to the wrong ordering of the vertices."));
807 std::array<Tensor<1,2>,2> edges;
808 edges[0] = corners[0];
809 edges[1] = corners[1];
810 std::vector<unsigned int> subdivisions;
811 subdivided_parallelepiped<2,2>(tria, origin, edges, subdivisions, colorize);
822 unsigned int n_subdivisions [dim];
823 for (
unsigned int i=0; i<dim; ++i)
824 n_subdivisions[i] = 1;
835 const unsigned int n_subdivisions,
841 unsigned int n_subdivisions_ [dim];
842 for (
unsigned int i=0; i<dim; ++i)
843 n_subdivisions_[i] = n_subdivisions;
855 const unsigned int(&n_subdivisions)[dim],
857 const unsigned int *n_subdivisions,
863 std::vector<unsigned int> subdivisions;
864 std::array<Tensor<1,dim>,dim> edges;
865 for (
unsigned int i=0; i<dim; ++i)
867 subdivisions.push_back(n_subdivisions[i]);
868 edges[i] = corners[i];
871 subdivided_parallelepiped<dim,dim> (tria, origin, edges, subdivisions, colorize);
882 template <
int dim,
int spacedim>
887 const std::vector<unsigned int> &subdivisions,
890 std::vector<unsigned int> compute_subdivisions = subdivisions;
891 if (compute_subdivisions.size() == 0)
893 compute_subdivisions.resize(dim, 1);
896 Assert(compute_subdivisions.size()==dim,
897 ExcMessage(
"One subdivision must be provided for each dimension."));
899 for (
unsigned int i=0; i<dim; ++i)
902 Assert (edges[i].norm()>0,
903 ExcMessage(
"Edges in subdivided_parallelepiped() must not be degenerate."));
911 bool twisted_data =
false;
916 twisted_data = (edges[0][0] < 0);
923 const double plane_normal = edges[0][0]*edges[1][1] - edges[0][1]*edges[1][0];
924 twisted_data = (plane_normal < 0.0);
932 Assert(std::abs(edges[0]*edges[1]
933 /(edges[0].norm()*edges[1].norm())
935 ExcMessage(
"Edges in subdivided_parallelepiped() must point in" 936 " different directions."));
938 (edges[0], edges[1]);
952 twisted_data = (plane_normal*edges[2] < 0.0);
961 (
"The triangulation you are trying to create will consist of cells" 962 " with negative measures. This is usually the result of input data" 963 " that does not define a right-handed coordinate system. The usual" 964 " fix for this is to ensure that in 1D the given point is to the" 965 " right of the origin (or the given edge tensor is positive), in 2D" 966 " that the two edges (and their cross product) obey the right-hand" 967 " rule (which may usually be done by switching the order of the" 968 " points or edge tensors), or in 3D that the edges form a" 969 " right-handed coordinate system (which may also be accomplished by" 970 " switching the order of the first two points or edge tensors)."));
973 for (
unsigned int i=0; i<dim; ++i)
974 for (
unsigned int j=i+1; j<dim; ++j)
975 Assert ((edges[i]!=edges[j]),
976 ExcMessage (
"Degenerate edges of subdivided_parallelepiped encountered."));
979 std::vector<Point<spacedim> > points;
984 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
985 points.push_back (origin + edges[0]/compute_subdivisions[0]*x);
989 for (
unsigned int y=0; y<=compute_subdivisions[1]; ++y)
990 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
991 points.push_back (origin
992 + edges[0]/compute_subdivisions[0]*x
993 + edges[1]/compute_subdivisions[1]*y);
997 for (
unsigned int z=0; z<=compute_subdivisions[2]; ++z)
998 for (
unsigned int y=0; y<=compute_subdivisions[1]; ++y)
999 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
1002 + edges[0]/compute_subdivisions[0]*x
1003 + edges[1]/compute_subdivisions[1]*y
1004 + edges[2]/compute_subdivisions[2]*z);
1012 unsigned int n_cells = 1;
1013 for (
unsigned int i=0; i<dim; ++i)
1014 n_cells *= compute_subdivisions[i];
1015 std::vector<CellData<dim> > cells (n_cells);
1021 for (
unsigned int x=0; x<compute_subdivisions[0]; ++x)
1023 cells[x].vertices[0] = x;
1024 cells[x].vertices[1] = x+1;
1027 cells[x].material_id = 0;
1034 const unsigned int n_dy = compute_subdivisions[1];
1035 const unsigned int n_dx = compute_subdivisions[0];
1037 for (
unsigned int y=0; y<n_dy; ++y)
1038 for (
unsigned int x=0; x<n_dx; ++x)
1040 const unsigned int c = y*n_dx + x;
1041 cells[c].vertices[0] = y*(n_dx+1) + x;
1042 cells[c].vertices[1] = y*(n_dx+1) + x+1;
1043 cells[c].vertices[2] = (y+1)*(n_dx+1) + x;
1044 cells[c].vertices[3] = (y+1)*(n_dx+1) + x+1;
1047 cells[c].material_id = 0;
1055 const unsigned int n_dz = compute_subdivisions[2];
1056 const unsigned int n_dy = compute_subdivisions[1];
1057 const unsigned int n_dx = compute_subdivisions[0];
1059 for (
unsigned int z=0; z<n_dz; ++z)
1060 for (
unsigned int y=0; y<n_dy; ++y)
1061 for (
unsigned int x=0; x<n_dx; ++x)
1063 const unsigned int c = z*n_dy*n_dx + y*n_dx + x;
1065 cells[c].vertices[0] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
1066 cells[c].vertices[1] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
1067 cells[c].vertices[2] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
1068 cells[c].vertices[3] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
1069 cells[c].vertices[4] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
1070 cells[c].vertices[5] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
1071 cells[c].vertices[6] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
1072 cells[c].vertices[7] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
1075 cells[c].material_id = 0;
1096 for (; cell!=endc; ++cell)
1098 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1100 if (cell->face(face)->at_boundary())
1101 cell->face(face)->set_boundary_id(face);
1108 template <
int dim,
int spacedim>
1111 const unsigned int repetitions,
1117 ExcMessage (
"Invalid left-to-right bounds of hypercube"));
1120 for (
unsigned int i=0; i<dim; ++i)
1126 std::vector<unsigned int> reps(dim, repetitions);
1132 template <
int dim,
int spacedim>
1136 const std::vector<unsigned int> &repetitions,
1139 const bool colorize)
1141 Assert(repetitions.size() == dim,
1148 for (
unsigned int i=0; i<dim; ++i)
1150 p1(i) = std::min(p_1(i), p_2(i));
1151 p2(i) = std::max(p_1(i), p_2(i));
1155 std::vector<Point<spacedim> > delta(dim);
1156 for (
unsigned int i=0; i<dim; ++i)
1160 delta[i][i] = (p2[i]-p1[i])/repetitions[i];
1162 ExcMessage(
"The first dim entries of coordinates of p1 and p2 need to be different."));
1166 std::vector<Point<spacedim> > points;
1170 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1171 points.push_back (p1+(
double)x*delta[0]);
1175 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1176 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1177 points.push_back (p1+(
double)x*delta[0]
1178 +(
double)y*delta[1]);
1182 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1183 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1184 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1185 points.push_back (p1+(
double)x*delta[0] +
1186 (
double)y*delta[1] + (
double)z*delta[2]);
1194 std::vector<CellData<dim> > cells;
1199 cells.resize (repetitions[0]);
1200 for (
unsigned int x=0; x<repetitions[0]; ++x)
1202 cells[x].vertices[0] = x;
1203 cells[x].vertices[1] = x+1;
1204 cells[x].material_id = 0;
1211 cells.resize (repetitions[1]*repetitions[0]);
1212 for (
unsigned int y=0; y<repetitions[1]; ++y)
1213 for (
unsigned int x=0; x<repetitions[0]; ++x)
1215 const unsigned int c = x+y*repetitions[0];
1216 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1217 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1218 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1219 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1220 cells[c].material_id = 0;
1227 const unsigned int n_x = (repetitions[0]+1);
1228 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1230 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1231 for (
unsigned int z=0; z<repetitions[2]; ++z)
1232 for (
unsigned int y=0; y<repetitions[1]; ++y)
1233 for (
unsigned int x=0; x<repetitions[0]; ++x)
1235 const unsigned int c = x+y*repetitions[0] +
1236 z*repetitions[0]*repetitions[1];
1237 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1238 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1239 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1240 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1241 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1242 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1243 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1244 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1245 cells[c].material_id = 0;
1267 double epsilon = 10;
1268 for (
unsigned int i=0; i<dim; ++i)
1269 epsilon = std::min(epsilon, 0.01*delta[i][i]);
1271 ExcMessage (
"The distance between corner points must be positive."))
1275 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1285 const std::vector<std::vector<double> > &step_sz,
1288 const bool colorize)
1290 Assert(step_sz.size() == dim,
1301 std::vector< std::vector<double> > step_sizes(step_sz);
1303 for (
unsigned int i=0; i<dim; ++i)
1308 std::reverse (step_sizes[i].begin(), step_sizes[i].end());
1312 for (
unsigned int j=0; j<step_sizes.at(i).size(); j++)
1313 x += step_sizes[i][j];
1314 Assert(std::fabs(x - (p2(i)-p1(i))) <= 1e-12*std::fabs(x),
1315 ExcMessage (
"The sequence of step sizes in coordinate direction " +
1317 " must be equal to the distance of the two given " 1318 "points in this coordinate direction."));
1324 std::vector<Point<dim> > points;
1330 for (
unsigned int i=0; ; ++i)
1339 if (i == step_sizes[0].size())
1342 x += step_sizes[0][i];
1350 for (
unsigned int j=0; ; ++j)
1353 for (
unsigned int i=0; ; ++i)
1357 if (i == step_sizes[0].size())
1360 x += step_sizes[0][i];
1363 if (j == step_sizes[1].size())
1366 y += step_sizes[1][j];
1374 for (
unsigned int k=0; ; ++k)
1377 for (
unsigned int j=0; ; ++j)
1380 for (
unsigned int i=0; ; ++i)
1385 if (i == step_sizes[0].size())
1388 x += step_sizes[0][i];
1391 if (j == step_sizes[1].size())
1394 y += step_sizes[1][j];
1397 if (k == step_sizes[2].size())
1400 z += step_sizes[2][k];
1411 std::vector<CellData<dim> > cells;
1416 cells.resize (step_sizes[0].size());
1417 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1419 cells[x].vertices[0] = x;
1420 cells[x].vertices[1] = x+1;
1421 cells[x].material_id = 0;
1428 cells.resize (step_sizes[1].size()*step_sizes[0].size());
1429 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1430 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1432 const unsigned int c = x+y*step_sizes[0].size();
1433 cells[c].vertices[0] = y*(step_sizes[0].size()+1)+x;
1434 cells[c].vertices[1] = y*(step_sizes[0].size()+1)+x+1;
1435 cells[c].vertices[2] = (y+1)*(step_sizes[0].size()+1)+x;
1436 cells[c].vertices[3] = (y+1)*(step_sizes[0].size()+1)+x+1;
1437 cells[c].material_id = 0;
1444 const unsigned int n_x = (step_sizes[0].size()+1);
1445 const unsigned int n_xy = (step_sizes[0].size()+1)*(step_sizes[1].size()+1);
1447 cells.resize (step_sizes[2].size()*step_sizes[1].size()*step_sizes[0].size());
1448 for (
unsigned int z=0; z<step_sizes[2].size(); ++z)
1449 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1450 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1452 const unsigned int c = x+y*step_sizes[0].size() +
1453 z*step_sizes[0].size()*step_sizes[1].size();
1454 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1455 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1456 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1457 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1458 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1459 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1460 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1461 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1462 cells[c].material_id = 0;
1484 double min_size = *std::min_element (step_sizes[0].begin(),
1485 step_sizes[0].end());
1486 for (
unsigned int i=1; i<dim; ++i)
1487 min_size = std::min (min_size,
1488 *std::min_element (step_sizes[i].begin(),
1489 step_sizes[i].end()));
1490 const double epsilon = 0.01 * min_size;
1494 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1504 const std::vector< std::vector<double> > &spacing,
1507 const bool colorize)
1509 Assert(spacing.size() == 1,
1512 const unsigned int n_cells = material_id.size(0);
1514 Assert(spacing[0].size() == n_cells,
1517 double delta = std::numeric_limits<double>::max();
1518 for (
unsigned int i=0; i<n_cells; i++)
1521 delta = std::min (delta, spacing[0][i]);
1525 std::vector<Point<1> > points;
1527 for (
unsigned int x=0; x<=n_cells; ++x)
1529 points.emplace_back(ax);
1531 ax += spacing[0][x];
1534 unsigned int n_val_cells = 0;
1535 for (
unsigned int i=0; i<n_cells; i++)
1538 std::vector<CellData<1> > cells(n_val_cells);
1539 unsigned int id = 0;
1540 for (
unsigned int x=0; x<n_cells; ++x)
1543 cells[id].vertices[0] = x;
1544 cells[id].vertices[1] = x+1;
1564 const std::vector< std::vector<double> > &spacing,
1567 const bool colorize)
1569 Assert(spacing.size() == 2,
1572 std::vector<unsigned int> repetitions(2);
1573 unsigned int n_cells = 1;
1574 double delta = std::numeric_limits<double>::max();
1575 for (
unsigned int i=0; i<2; i++)
1577 repetitions[i] = spacing[i].size();
1578 n_cells *= repetitions[i];
1579 for (
unsigned int j=0; j<repetitions[i]; j++)
1582 delta = std::min (delta, spacing[i][j]);
1589 std::vector<Point<2> > points;
1591 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1594 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1596 points.emplace_back(ax,ay);
1597 if (x<repetitions[0])
1598 ax += spacing[0][x];
1600 if (y<repetitions[1])
1601 ay += spacing[1][y];
1605 unsigned int n_val_cells = 0;
1606 for (
unsigned int i=0; i<
material_id.size(0); i++)
1607 for (
unsigned int j=0; j<
material_id.size(1); j++)
1611 std::vector<CellData<2> > cells(n_val_cells);
1612 unsigned int id = 0;
1613 for (
unsigned int y=0; y<repetitions[1]; ++y)
1614 for (
unsigned int x=0; x<repetitions[0]; ++x)
1617 cells[id].vertices[0] = y*(repetitions[0]+1)+x;
1618 cells[id].vertices[1] = y*(repetitions[0]+1)+x+1;
1619 cells[id].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1620 cells[id].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1634 double eps = 0.01 * delta;
1637 for (; cell !=endc; ++cell)
1639 Point<2> cell_center = cell->center();
1640 for (
unsigned int f=0; f<GeometryInfo<2>::faces_per_cell; ++f)
1641 if (cell->face(f)->boundary_id() == 0)
1643 Point<2> face_center = cell->face(f)->center();
1644 for (
unsigned int i=0; i<2; ++i)
1646 if (face_center[i]<cell_center[i]-eps)
1647 cell->face(f)->set_boundary_id(i*2);
1648 if (face_center[i]>cell_center[i]+eps)
1649 cell->face(f)->set_boundary_id(i*2+1);
1661 const std::vector< std::vector<double> > &spacing,
1664 const bool colorize)
1666 const unsigned int dim = 3;
1668 Assert(spacing.size() == dim,
1671 std::vector<unsigned int > repetitions(dim);
1672 unsigned int n_cells = 1;
1673 double delta = std::numeric_limits<double>::max();
1674 for (
unsigned int i=0; i<dim; i++)
1676 repetitions[i] = spacing[i].size();
1677 n_cells *= repetitions[i];
1678 for (
unsigned int j=0; j<repetitions[i]; j++)
1681 delta = std::min (delta, spacing[i][j]);
1688 std::vector<Point<dim> > points;
1690 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1693 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1696 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1698 points.emplace_back(ax,ay,az);
1699 if (x<repetitions[0])
1700 ax += spacing[0][x];
1702 if (y<repetitions[1])
1703 ay += spacing[1][y];
1705 if (z<repetitions[2])
1706 az += spacing[2][z];
1710 unsigned int n_val_cells = 0;
1711 for (
unsigned int i=0; i<
material_id.size(0); i++)
1712 for (
unsigned int j=0; j<
material_id.size(1); j++)
1713 for (
unsigned int k=0; k<
material_id.size(2); k++)
1717 std::vector<CellData<dim> > cells(n_val_cells);
1718 unsigned int id = 0;
1719 const unsigned int n_x = (repetitions[0]+1);
1720 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1721 for (
unsigned int z=0; z<repetitions[2]; ++z)
1722 for (
unsigned int y=0; y<repetitions[1]; ++y)
1723 for (
unsigned int x=0; x<repetitions[0]; ++x)
1726 cells[id].vertices[0] = z*n_xy + y*n_x + x;
1727 cells[id].vertices[1] = z*n_xy + y*n_x + x+1;
1728 cells[id].vertices[2] = z*n_xy + (y+1)*n_x + x;
1729 cells[id].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1730 cells[id].vertices[4] = (z+1)*n_xy + y*n_x + x;
1731 cells[id].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1732 cells[id].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1733 cells[id].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1747 double eps = 0.01 * delta;
1750 for (; cell !=endc; ++cell)
1753 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
1754 if (cell->face(f)->boundary_id() == 0)
1756 Point<dim> face_center = cell->face(f)->center();
1757 for (
unsigned int i=0; i<dim; ++i)
1759 if (face_center[i]<cell_center[i]-eps)
1760 cell->face(f)->set_boundary_id(i*2);
1761 if (face_center[i]>cell_center[i]+eps)
1762 cell->face(f)->set_boundary_id(i*2+1);
1769 template <
int dim,
int spacedim>
1773 const std::vector<unsigned int> &holes)
1782 for (
unsigned int d=0; d<dim; ++d)
1789 std::vector<Point<spacedim> > delta(dim);
1790 unsigned int repetitions[dim];
1791 for (
unsigned int i=0; i<dim; ++i)
1793 Assert (holes[i] >= 1,
ExcMessage(
"At least one hole needed in each direction"));
1794 repetitions[i] = 2*holes[i]+1;
1795 delta[i][i] = (p2[i]-p1[i]);
1800 std::vector<Point<spacedim> > points;
1804 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1805 points.push_back (p1+(
double)x*delta[0]);
1809 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1810 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1811 points.push_back (p1+(
double)x*delta[0]
1812 +(
double)y*delta[1]);
1816 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1817 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1818 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1819 points.push_back (p1+(
double)x*delta[0] +
1820 (
double)y*delta[1] + (
double)z*delta[2]);
1829 std::vector<CellData<dim> > cells;
1834 cells.resize (repetitions[1]*repetitions[0]-holes[1]*holes[0]);
1836 for (
unsigned int y=0; y<repetitions[1]; ++y)
1837 for (
unsigned int x=0; x<repetitions[0]; ++x)
1839 if ((x%2 == 1) && (y%2 ==1))
continue;
1841 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1842 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1843 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1844 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1845 cells[c].material_id = 0;
1853 const unsigned int n_x = (repetitions[0]+1);
1854 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1856 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1859 for (
unsigned int z=0; z<repetitions[2]; ++z)
1860 for (
unsigned int y=0; y<repetitions[1]; ++y)
1861 for (
unsigned int x=0; x<repetitions[0]; ++x)
1864 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1865 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1866 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1867 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1868 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1869 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1870 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1871 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1872 cells[c].material_id = 0;
1886 template <
int dim,
int spacedim>
1888 const std::vector<unsigned int> &sizes,
1889 const bool colorize)
1898 for (
unsigned int d=0; d<dim; ++d)
1901 std::vector<Point<spacedim> > points;
1902 unsigned int n_cells = 1;
1903 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
1904 n_cells += sizes[i];
1906 std::vector<CellData<dim> > cells(n_cells);
1908 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
1911 for (
unsigned int d=0; d<dim; ++d)
1912 p(d) = 0.5 * dimensions[d] *
1914 points.push_back(p);
1915 cells[0].vertices[i] = i;
1917 cells[0].material_id = 0;
1920 unsigned int cell_index = 1;
1922 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1928 for (
unsigned int j=0; j<sizes[face]; ++j,++cell_index)
1930 const unsigned int last_cell = (j==0) ? 0U : (cell_index-1);
1932 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
1937 cells[cell_index].vertices[ocellv] = cells[last_cell].vertices[cellv];
1940 cells[cell_index].vertices[cellv] = points.size();
1944 points.push_back(p);
1946 cells[cell_index].material_id = (colorize) ? (face+1U) : 0U;
2037 const unsigned int )
2090 const double thickness,
2091 const bool colorize)
2094 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
2096 std::vector<Point<2> > vertices(16);
2098 coords[0] = left-thickness;
2101 coords[3] = right+thickness;
2104 for (
unsigned int i0=0; i0<4; ++i0)
2105 for (
unsigned int i1=0; i1<4; ++i1)
2106 vertices[k++] =
Point<2>(coords[i1], coords[i0]);
2113 std::vector<CellData<2> > cells(9);
2115 for (
unsigned int i0=0; i0<3; ++i0)
2116 for (
unsigned int i1=0; i1<3; ++i1)
2118 cells[k].vertices[0] = i1+4*i0;
2119 cells[k].vertices[1] = i1+4*i0+1;
2120 cells[k].vertices[2] = i1+4*i0+4;
2121 cells[k].vertices[3] = i1+4*i0+5;
2123 cells[k].material_id = materials[k];
2139 const bool colorize)
2141 const double rl2=(right+left)/2;
2153 const int cell_vertices[4][4] = { { 0,1,3,2 },
2158 std::vector<CellData<2> > cells (4,
CellData<2>());
2159 for (
unsigned int i=0; i<4; ++i)
2161 for (
unsigned int j=0; j<4; ++j)
2162 cells[i].vertices[j] = cell_vertices[i][j];
2163 cells[i].material_id = 0;
2166 std::vector<
Point<2> >(std::begin(vertices), std::end(vertices)),
2173 cell->face(1)->set_boundary_id(1);
2175 cell->face(0)->set_boundary_id(2);
2183 const double radius_0,
2184 const double radius_1,
2185 const double half_length)
2189 vertices_tmp[0] =
Point<2> (-half_length, -radius_0);
2190 vertices_tmp[1] =
Point<2> (half_length, -radius_1);
2191 vertices_tmp[2] =
Point<2> (-half_length, radius_0);
2192 vertices_tmp[3] =
Point<2> (half_length, radius_1);
2194 const std::vector<Point<2> > vertices (std::begin(vertices_tmp), std::end(vertices_tmp));
2197 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2198 cell_vertices[0][i] = i;
2200 std::vector<CellData<2> > cells (1,
CellData<2> ());
2202 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2203 cells[0].vertices[i] = cell_vertices[0][i];
2205 cells[0].material_id = 0;
2206 triangulation.create_triangulation (vertices, cells,
SubCellData ());
2210 cell->face (0)->set_boundary_id (1);
2211 cell->face (1)->set_boundary_id (2);
2213 for (
unsigned int i = 2; i < 4; ++i)
2214 cell->face (i)->set_boundary_id (0);
2225 const bool colorize)
2236 const int cell_vertices[3][4] = {{0, 1, 3, 4},
2241 std::vector<CellData<2> > cells (3,
CellData<2>());
2243 for (
unsigned int i=0; i<3; ++i)
2245 for (
unsigned int j=0; j<4; ++j)
2246 cells[i].vertices[j] = cell_vertices[i][j];
2247 cells[i].material_id = 0;
2251 std::vector<
Point<2> >(std::begin(vertices), std::end(vertices)),
2259 cell->face(0)->set_boundary_id(0);
2260 cell->face(2)->set_boundary_id(1);
2263 cell->face(1)->set_boundary_id(2);
2264 cell->face(2)->set_boundary_id(1);
2265 cell->face(3)->set_boundary_id(3);
2268 cell->face(0)->set_boundary_id(0);
2269 cell->face(1)->set_boundary_id(4);
2270 cell->face(3)->set_boundary_id(5);
2282 const double radius,
2283 const bool internal_manifolds)
2288 const double a = 1./(1+std::sqrt(2.0));
2290 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2291 p+
Point<2>(-1,-1) *(radius/std::sqrt(2.0)*a),
2292 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2293 p+
Point<2>(-1,+1) *(radius/std::sqrt(2.0)*a),
2294 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2295 p+
Point<2>(-1,+1) *(radius/std::sqrt(2.0)),
2296 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2299 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2306 std::vector<CellData<2> > cells (5,
CellData<2>());
2308 for (
unsigned int i=0; i<5; ++i)
2310 for (
unsigned int j=0; j<4; ++j)
2311 cells[i].vertices[j] = cell_vertices[i][j];
2312 cells[i].material_id = 0;
2317 std::vector<
Point<2> >(std::begin(vertices), std::end(vertices)),
2322 if (internal_manifolds)
2331 const double inner_radius,
2332 const double outer_radius,
2333 const unsigned int n_cells,
2334 const bool colorize)
2336 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2350 const unsigned int N = (n_cells == 0 ?
2351 static_cast<unsigned int> 2352 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
2353 (outer_radius - inner_radius))) :
2362 std::vector<Point<2> > vertices(2*N);
2363 for (
unsigned int i=0; i<N; ++i)
2365 vertices[i] =
Point<2>( std::cos(2*pi * i/N),
2366 std::sin(2*pi * i/N)) * outer_radius;
2367 vertices[i+N] = vertices[i] * (inner_radius/outer_radius);
2369 vertices[i] += center;
2370 vertices[i+N] += center;
2373 std::vector<CellData<2> > cells (N,
CellData<2>());
2375 for (
unsigned int i=0; i<N; ++i)
2377 cells[i].vertices[0] = i;
2378 cells[i].vertices[1] = (i+1)%N;
2379 cells[i].vertices[2] = N+i;
2380 cells[i].vertices[3] = N+((i+1)%N);
2382 cells[i].material_id = 0;
2389 colorize_hyper_shell(tria, center, inner_radius, outer_radius);
2400 const double radius,
2401 const double half_length)
2403 Point<2> p1 (-half_length, -radius);
2412 switch (f->boundary_id())
2415 f->set_boundary_id(1);
2418 f->set_boundary_id(2);
2421 f->set_boundary_id(0);
2447 const double radius)
2449 const unsigned int dim = 2;
2464 const int cell_vertices[3][4]
2472 for (
unsigned int i=0; i<3; ++i)
2474 for (
unsigned int j=0; j<4; ++j)
2475 cells[i].vertices[j] = cell_vertices[i][j];
2476 cells[i].material_id = 0;
2480 std::vector<
Point<dim> >(std::begin(vertices), std::end(vertices)),
2491 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
2498 if (cell->face(i)->center()(0) < p(0)+1.e-5 * radius
2499 || cell->face(i)->center()(1) < p(1)+1.e-5 * radius)
2501 cell->face(i)->set_boundary_id(1);
2515 const double radius)
2520 const double a = 1./(1+std::sqrt(2.0));
2522 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2523 p+
Point<2>(0,-1) *(radius/std::sqrt(2.0)*a),
2524 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2525 p+
Point<2>(0,+1) *(radius/std::sqrt(2.0)*a),
2526 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2528 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2531 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2537 std::vector<CellData<2> > cells (4,
CellData<2>());
2539 for (
unsigned int i=0; i<4; ++i)
2541 for (
unsigned int j=0; j<4; ++j)
2542 cells[i].vertices[j] = cell_vertices[i][j];
2543 cells[i].material_id = 0;
2547 std::vector<
Point<2> >(std::begin(vertices), std::end(vertices)),
2558 for (
unsigned int i=0; i<GeometryInfo<2>::faces_per_cell; ++i)
2564 if (cell->face(i)->center()(0) < p(0)+1.e-5 * radius)
2566 cell->face(i)->set_boundary_id(1);
2582 const double inner_radius,
2583 const double outer_radius,
2584 const unsigned int n_cells,
2585 const bool colorize)
2587 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2600 const unsigned int N = (n_cells == 0 ?
2601 static_cast<unsigned int> 2602 (std::ceil((pi* (outer_radius + inner_radius)/2) /
2603 (outer_radius - inner_radius))) :
2612 std::vector<Point<2> > vertices(2*(N+1));
2613 for (
unsigned int i=0; i<=N; ++i)
2621 vertices[i] =
Point<2>( ( (i==0) || (i==N) ?
2623 std::cos(pi * i/N - pi/2) ),
2624 std::sin(pi * i/N - pi/2)) * outer_radius;
2625 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2627 vertices[i] += center;
2628 vertices[i+N+1] += center;
2632 std::vector<CellData<2> > cells (N,
CellData<2>());
2634 for (
unsigned int i=0; i<N; ++i)
2636 cells[i].vertices[0] = i;
2637 cells[i].vertices[1] = (i+1)%(N+1);
2638 cells[i].vertices[2] = N+1+i;
2639 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2641 cells[i].material_id = 0;
2649 for (; cell!=tria.
end(); ++cell)
2651 cell->face(2)->set_boundary_id(1);
2653 tria.
begin()->face(0)->set_boundary_id(3);
2655 tria.
last()->face(1)->set_boundary_id(2);
2665 const double inner_radius,
2666 const double outer_radius,
2667 const unsigned int n_cells,
2668 const bool colorize)
2670 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2683 const unsigned int N = (n_cells == 0 ?
2684 static_cast<unsigned int> 2685 (std::ceil((pi* (outer_radius + inner_radius)/4) /
2686 (outer_radius - inner_radius))) :
2695 std::vector<Point<2> > vertices(2*(N+1));
2696 for (
unsigned int i=0; i<=N; ++i)
2705 std::cos(pi * i/N/2) ),
2706 std::sin(pi * i/N/2)) * outer_radius;
2707 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2709 vertices[i] += center;
2710 vertices[i+N+1] += center;
2714 std::vector<CellData<2> > cells (N,
CellData<2>());
2716 for (
unsigned int i=0; i<N; ++i)
2718 cells[i].vertices[0] = i;
2719 cells[i].vertices[1] = (i+1)%(N+1);
2720 cells[i].vertices[2] = N+1+i;
2721 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2723 cells[i].material_id = 0;
2731 for (; cell!=tria.
end(); ++cell)
2733 cell->face(2)->set_boundary_id(1);
2735 tria.
begin()->face(0)->set_boundary_id(3);
2737 tria.
last()->face(1)->set_boundary_id(2);
2751 const bool colorize)
2753 const double rl2=(right+left)/2;
2754 const double len = (right-left)/2.;
2779 const int cell_vertices[4][8] = { { 0,1,3,2, 10, 11, 13, 12 },
2780 { 9,4,2,5, 19,14, 12, 15 },
2781 { 3,2,7,6,13,12,17,16 },
2782 { 2,5,6,8,12,15,16,18 }
2784 std::vector<CellData<3> > cells (4,
CellData<3>());
2785 for (
unsigned int i=0; i<4; ++i)
2787 for (
unsigned int j=0; j<8; ++j)
2788 cells[i].vertices[j] = cell_vertices[i][j];
2789 cells[i].material_id = 0;
2792 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
2799 cell->face(1)->set_boundary_id(1);
2801 cell->face(0)->set_boundary_id(2);
2812 const double thickness,
2813 const bool colorize)
2816 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
2818 std::vector<Point<3> > vertices(64);
2820 coords[0] = left-thickness;
2823 coords[3] = right+thickness;
2826 for (
unsigned int z=0; z<4; ++z)
2827 for (
unsigned int y=0; y<4; ++y)
2828 for (
unsigned int x=0; x<4; ++x)
2829 vertices[k++] =
Point<3>(coords[x], coords[y], coords[z]);
2844 std::vector<CellData<3> > cells(27);
2846 for (
unsigned int z=0; z<3; ++z)
2847 for (
unsigned int y=0; y<3; ++y)
2848 for (
unsigned int x=0; x<3; ++x)
2850 cells[k].vertices[0] = x+4*y+16*z;
2851 cells[k].vertices[1] = x+4*y+16*z+1;
2852 cells[k].vertices[2] = x+4*y+16*z+4;
2853 cells[k].vertices[3] = x+4*y+16*z+5;
2854 cells[k].vertices[4] = x+4*y+16*z+16;
2855 cells[k].vertices[5] = x+4*y+16*z+17;
2856 cells[k].vertices[6] = x+4*y+16*z+20;
2857 cells[k].vertices[7] = x+4*y+16*z+21;
2859 cells[k].material_id = materials[k];
2872 const double radius_0,
2873 const double radius_1,
2874 const double half_length)
2878 n_cells =
static_cast<unsigned int>(std::ceil (half_length /
2881 const unsigned int n_vertices = 4 * (n_cells + 1);
2882 std::vector<Point<3> > vertices_tmp(n_vertices);
2884 vertices_tmp[0] =
Point<3> (-half_length, 0, -radius_0);
2885 vertices_tmp[1] =
Point<3> (-half_length, radius_0, 0);
2886 vertices_tmp[2] =
Point<3> (-half_length, -radius_0, 0);
2887 vertices_tmp[3] =
Point<3> (-half_length, 0, radius_0);
2889 const double dx = 2 * half_length / n_cells;
2891 for (
unsigned int i = 0; i < n_cells; ++i)
2893 vertices_tmp[4 * (i + 1)]
2894 = vertices_tmp[4 * i] +
2895 Point<3> (dx, 0, 0.5 * (radius_0 - radius_1) *
dx / half_length);
2896 vertices_tmp[4 * i + 5]
2897 = vertices_tmp[4 * i + 1] +
2898 Point<3> (
dx, 0.5 * (radius_1 - radius_0) * dx / half_length, 0);
2899 vertices_tmp[4 * i + 6]
2900 = vertices_tmp[4 * i + 2] +
2901 Point<3> (
dx, 0.5 * (radius_0 - radius_1) * dx / half_length, 0);
2902 vertices_tmp[4 * i + 7]
2903 = vertices_tmp[4 * i + 3] +
2904 Point<3> (
dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length);
2907 const std::vector<Point<3> > vertices (vertices_tmp.begin(),
2908 vertices_tmp.end());
2911 for (
unsigned int i = 0; i < n_cells; ++i)
2912 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2913 cell_vertices[i][j] = 4 * i + j;
2915 std::vector<CellData<3> > cells (n_cells,
CellData<3> ());
2917 for (
unsigned int i = 0; i < n_cells; ++i)
2919 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2920 cells[i].vertices[j] = cell_vertices[i][j];
2922 cells[i].material_id = 0;
2925 triangulation.create_triangulation (vertices, cells,
SubCellData ());
2926 triangulation.set_all_manifold_ids_on_boundary(0);
2929 cell != triangulation.end (); ++cell)
2931 if (cell->vertex (0) (0) == -half_length)
2933 cell->face (4)->set_boundary_id (1);
2936 for (
unsigned int i = 0; i < 4; ++i)
2937 cell->line (i)->set_boundary_id (0);
2940 if (cell->vertex (4) (0) == half_length)
2942 cell->face (5)->set_boundary_id (2);
2945 for (
unsigned int i = 4; i < 8; ++i)
2946 cell->line (i)->set_boundary_id (0);
2949 for (
unsigned int i = 0; i < 4; ++i)
2950 cell->face (i)->set_boundary_id (0);
2963 const bool colorize)
3001 const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13},
3002 {1, 2, 10, 11, 4, 5, 13, 14},
3003 {3, 4, 12, 13, 6, 7, 15, 16},
3004 {4, 5, 13, 14, 7, 8, 16, 17},
3005 {9, 10, 18, 19, 12, 13, 21, 22},
3006 {10, 11, 19, 20, 13, 14, 22, 23},
3007 {12, 13, 21, 22, 15, 16, 24, 25}
3010 std::vector<CellData<3> > cells (7,
CellData<3>());
3012 for (
unsigned int i=0; i<7; ++i)
3014 for (
unsigned int j=0; j<8; ++j)
3015 cells[i].vertices[j] = cell_vertices[i][j];
3016 cells[i].material_id = 0;
3020 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
3037 const double radius,
3038 const bool internal_manifold)
3040 const double a = 1./(1+std::sqrt(3.0));
3043 const unsigned int n_vertices = 16;
3044 const Point<3> vertices[n_vertices]
3049 p+
Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)*a),
3050 p+
Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)*a),
3051 p+
Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)*a),
3052 p+
Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)*a),
3053 p+
Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)*a),
3054 p+
Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)*a),
3055 p+
Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)*a),
3056 p+
Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)*a),
3059 p+
Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)),
3060 p+
Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)),
3061 p+
Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)),
3062 p+
Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)),
3063 p+
Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)),
3064 p+
Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)),
3065 p+
Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)),
3066 p+
Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)),
3071 const unsigned int n_cells = 7;
3072 const int cell_vertices[n_cells][8] = {{0, 1, 4, 5, 3, 2, 7, 6},
3073 {8, 9, 12, 13, 0, 1, 4, 5},
3074 {9, 13, 1, 5, 10, 14, 2, 6},
3075 {11, 10, 3, 2, 15, 14, 7, 6},
3076 {8, 0, 12, 4, 11, 3, 15, 7},
3077 {8, 9, 0, 1, 11, 10, 3, 2},
3078 {12, 4, 13, 5, 15, 7, 14, 6}
3081 std::vector<CellData<3> > cells (n_cells,
CellData<3>());
3083 for (
unsigned int i=0; i<n_cells; ++i)
3085 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
3086 cells[i].vertices[j] = cell_vertices[i][j];
3087 cells[i].material_id = 0;
3092 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
3097 if (internal_manifold)
3103 template <
int spacedim>
3107 const double radius)
3111 std::set<types::boundary_id> boundary_ids;
3112 boundary_ids.insert (0);
3125 const double radius,
3126 const double half_length)
3130 const double d = radius/std::sqrt(2.0);
3131 const double a = d/(1+std::sqrt(2.0));
3160 for (
unsigned int i=0; i<24; ++i)
3162 const double h = vertices[i](1);
3163 vertices[i](1) = -vertices[i](0);
3167 int cell_vertices[10][8] =
3169 {0, 1, 8, 9, 2, 3, 10, 11},
3170 {0, 2, 8, 10, 6, 4, 14, 12},
3171 {2, 3, 10, 11, 4, 5, 12, 13},
3172 {1, 7, 9, 15, 3, 5, 11, 13},
3173 {6, 4, 14, 12, 7, 5, 15, 13}
3175 for (
unsigned int i=0; i<5; ++i)
3176 for (
unsigned int j=0; j<8; ++j)
3177 cell_vertices[i+5][j] = cell_vertices[i][j]+8;
3179 std::vector<CellData<3> > cells (10,
CellData<3>());
3181 for (
unsigned int i=0; i<10; ++i)
3183 for (
unsigned int j=0; j<8; ++j)
3184 cells[i].vertices[j] = cell_vertices[i][j];
3185 cells[i].material_id = 0;
3189 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
3208 for (; cell != end; ++cell)
3209 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3210 if (cell->at_boundary(i))
3212 if (cell->face(i)->center()(0) > half_length-1.e-5)
3214 cell->face(i)->set_boundary_id(2);
3217 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++
e)
3218 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
3219 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
3220 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
3221 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
3223 cell->face(i)->line(e)->set_boundary_id(2);
3227 else if (cell->face(i)->center()(0) < -half_length+1.e-5)
3229 cell->face(i)->set_boundary_id(1);
3232 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++
e)
3233 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
3234 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
3235 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
3236 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
3238 cell->face(i)->line(e)->set_boundary_id(1);
3251 const double radius)
3253 const unsigned int dim = 3;
3263 center+
Point<dim>(+1,+1,0) *(radius/(2*sqrt(2.0))),
3265 center+
Point<dim>(+1,+1,0) *(radius/std::sqrt(2.0)),
3267 center+
Point<dim>(+1,0,1) *radius/std::sqrt(2.0),
3268 center+
Point<dim>(+1,0,1) *(radius/(2*std::sqrt(2.0))),
3269 center+
Point<dim>(0,+1,1) *(radius/(2*std::sqrt(2.0))),
3270 center+
Point<dim>(+1,+1,1) *(radius/(2*std::sqrt(3.0))),
3271 center+
Point<dim>(0,+1,1) *radius/std::sqrt(2.0),
3272 center+
Point<dim>(+1,+1,1) *(radius/(std::sqrt(3.0))),
3275 const int cell_vertices[4][8]
3276 = {{0, 2, 3, 4, 7, 9, 10, 11},
3277 {1, 6, 2, 4, 8, 13, 9, 11},
3278 {5, 3, 6, 4, 12, 10, 13, 11},
3279 {7,9,10,11,14,8,12,13}
3284 for (
unsigned int i=0; i<4; ++i)
3286 for (
unsigned int j=0; j<8; ++j)
3287 cells[i].vertices[j] = cell_vertices[i][j];
3288 cells[i].material_id = 0;
3292 std::vector<
Point<dim> >(std::begin(vertices), std::end(vertices)),
3302 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
3308 if (cell->face(i)->center()(0) < center(0)+1.e-5 * radius
3309 || cell->face(i)->center()(1) < center(1)+1.e-5 * radius
3310 || cell->face(i)->center()(2) < center(2)+1.e-5 * radius)
3312 cell->face(i)->set_boundary_id(1);
3316 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
3319 = { cell->face(i)->line(j)->vertex(0),
3320 cell->face(i)->line(j)->vertex(1)
3322 if ((std::fabs(line_vertices[0].distance(center)-radius) >
3325 (std::fabs(line_vertices[1].distance(center)-radius) >
3328 cell->face(i)->line(j)->set_boundary_id(1);
3346 const double radius)
3349 const double d = radius/std::sqrt(2.0);
3350 const double a =
d/(1+std::sqrt(2.0));
3352 const double b = a/2.0;
3353 const double c =
d/2.0;
3355 const double hb = radius*std::sqrt(3.0)/4.0;
3356 const double hc = radius*std::sqrt(3.0)/2.0;
3379 int cell_vertices[6][8] =
3381 {0, 1, 8, 9, 2, 3, 10, 11},
3382 {0, 2, 8, 10, 6, 4, 14, 12},
3383 {2, 3, 10, 11, 4, 5, 12, 13},
3384 {1, 7, 9, 15, 3, 5, 11, 13},
3385 {6, 4, 14, 12, 7, 5, 15, 13},
3386 {8, 10, 9, 11, 14, 12, 15, 13}
3389 std::vector<CellData<3> > cells (6,
CellData<3>());
3391 for (
unsigned int i=0; i<6; ++i)
3393 for (
unsigned int j=0; j<8; ++j)
3394 cells[i].vertices[j] = cell_vertices[i][j];
3395 cells[i].material_id = 0;
3399 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
3415 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3417 if (!cell->at_boundary(i))
3423 if (cell->face(i)->center()(0) < center(0)+1.e-5*radius)
3425 cell->face(i)->set_boundary_id(1);
3427 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
3430 = { cell->face(i)->line(j)->vertex(0),
3431 cell->face(i)->line(j)->vertex(1)
3433 if ((std::fabs(line_vertices[0].distance(center)-radius) >
3436 (std::fabs(line_vertices[1].distance(center)-radius) >
3439 cell->face(i)->line(j)->set_boundary_id(1);
3455 const double inner_radius,
3456 const double outer_radius,
3457 const unsigned int n_cells,
3458 const bool colorize)
3460 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3463 const unsigned int n = (n_cells==0) ? 6 : n_cells;
3465 const double irad = inner_radius/std::sqrt(3.0);
3466 const double orad = outer_radius/std::sqrt(3.0);
3467 std::vector<Point<3> > vertices;
3468 std::vector<CellData<3> > cells;
3474 for (
unsigned int i=0; i<8; ++i)
3475 vertices.push_back(p+hexahedron[i]*irad);
3476 for (
unsigned int i=0; i<8; ++i)
3477 vertices.push_back(p+hexahedron[i]*orad);
3479 const unsigned int n_cells = 6;
3480 const int cell_vertices[n_cells][8] =
3482 {8, 9, 10, 11, 0, 1, 2, 3},
3483 {9, 11, 1, 3, 13, 15, 5, 7},
3484 {12, 13, 4, 5, 14, 15, 6, 7},
3485 {8, 0, 10, 2, 12, 4, 14, 6},
3486 {8, 9, 0, 1, 12, 13, 4, 5},
3487 {10, 2, 11, 3, 14, 6, 15, 7}
3492 for (
unsigned int i=0; i<n_cells; ++i)
3494 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
3495 cells[i].vertices[j] = cell_vertices[i][j];
3496 cells[i].material_id = 0;
3506 for (
unsigned int i=0; i<8; ++i)
3507 vertices.push_back(p+hexahedron[i]*irad);
3508 for (
unsigned int i=0; i<6; ++i)
3509 vertices.push_back(p+octahedron[i]*inner_radius);
3510 for (
unsigned int i=0; i<8; ++i)
3511 vertices.push_back(p+hexahedron[i]*orad);
3512 for (
unsigned int i=0; i<6; ++i)
3513 vertices.push_back(p+octahedron[i]*outer_radius);
3515 const unsigned int n_cells = 12;
3516 const unsigned int rhombi[n_cells][4] =
3534 for (
unsigned int i=0; i<n_cells; ++i)
3536 for (
unsigned int j=0; j<4; ++j)
3538 cells[i].vertices[j ] = rhombi[i][j];
3539 cells[i].vertices[j+4] = rhombi[i][j] + 14;
3541 cells[i].material_id = 0;
3553 hyper_shell (tmp, p, inner_radius, outer_radius, 12);
3559 cell != tmp.
end(); ++cell)
3561 const unsigned int cell_index = cell->active_cell_index();
3562 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
3563 cells[cell_index].vertices[v] = cell->vertex_index(v);
3564 cells[cell_index].material_id = 0;
3575 colorize_hyper_shell(tria, p, inner_radius, outer_radius);
3588 const double inner_radius,
3589 const double outer_radius,
3590 const unsigned int n,
3591 const bool colorize)
3593 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3599 const double d = outer_radius/std::sqrt(2.0);
3600 const double a = inner_radius/std::sqrt(2.0);
3602 const double b = a/2.0;
3603 const double c =
d/2.0;
3605 const double hb = inner_radius*std::sqrt(3.0)/2.0;
3606 const double hc = outer_radius*std::sqrt(3.0)/2.0;
3629 int cell_vertices[5][8] =
3631 {0, 1, 8, 9, 2, 3, 10, 11},
3632 {0, 2, 8, 10, 6, 4, 14, 12},
3633 {1, 7, 9, 15, 3, 5, 11, 13},
3634 {6, 4, 14, 12, 7, 5, 15, 13},
3635 {8, 10, 9, 11, 14, 12, 15, 13}
3638 std::vector<CellData<3> > cells (5,
CellData<3>());
3640 for (
unsigned int i=0; i<5; ++i)
3642 for (
unsigned int j=0; j<8; ++j)
3643 cells[i].vertices[j] = cell_vertices[i][j];
3644 cells[i].material_id = 0;
3648 std::vector<
Point<3> >(std::begin(vertices), std::end(vertices)),
3662 for (; cell!=tria.
end(); ++cell)
3663 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3664 if (cell->at_boundary(i))
3665 cell->face(i)->set_all_boundary_ids(2);
3671 for (cell=tria.
begin(); cell!=tria.
end(); ++cell)
3672 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3673 if (cell->at_boundary(i))
3678 const Point<3> face_center (face->center());
3679 if (std::abs(face_center(0)-center(0)) > 1.e-6 * face_center.
norm())
3681 if (std::abs((face_center-center).
norm()-inner_radius) <
3682 std::abs((face_center-center).
norm()-outer_radius))
3683 face->set_all_boundary_ids(0);
3685 face->set_all_boundary_ids(1);
3698 const double inner_radius,
3699 const double outer_radius,
3700 const unsigned int n,
3701 const bool colorize)
3703 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3705 if (n == 0 || n == 3)
3707 const double a = inner_radius*std::sqrt(2.0)/2e0;
3708 const double b = outer_radius*std::sqrt(2.0)/2e0;
3709 const double c = a*std::sqrt(3.0)/2e0;
3710 const double d =
b*std::sqrt(3.0)/2e0;
3711 const double e = outer_radius/2e0;
3712 const double h = inner_radius/2e0;
3714 std::vector<Point<3> > vertices;
3716 vertices.push_back (center+
Point<3>( 0, inner_radius, 0));
3717 vertices.push_back (center+
Point<3>( a, a, 0));
3718 vertices.push_back (center+
Point<3>( b, b, 0));
3719 vertices.push_back (center+
Point<3>( 0, outer_radius, 0));
3720 vertices.push_back (center+
Point<3>( 0, a, a));
3721 vertices.push_back (center+
Point<3>( c, c, h));
3722 vertices.push_back (center+
Point<3>( d, d, e));
3723 vertices.push_back (center+
Point<3>( 0, b, b));
3724 vertices.push_back (center+
Point<3>( inner_radius, 0, 0));
3725 vertices.push_back (center+
Point<3>( outer_radius, 0, 0));
3726 vertices.push_back (center+
Point<3>( a, 0, a));
3727 vertices.push_back (center+
Point<3>( b, 0, b));
3728 vertices.push_back (center+
Point<3>( 0, 0, inner_radius));
3729 vertices.push_back (center+
Point<3>( 0, 0, outer_radius));
3731 const int cell_vertices[3][8] =
3733 {0, 1, 3, 2, 4, 5, 7, 6},
3734 {1, 8, 2, 9, 5, 10, 6, 11},
3735 {4, 5, 7, 6, 12, 10, 13, 11},
3737 std::vector<CellData<3> > cells(3);
3739 for (
unsigned int i=0; i<3; ++i)
3741 for (
unsigned int j=0; j<8; ++j)
3742 cells[i].vertices[j] = cell_vertices[i][j];
3743 cells[i].material_id = 0;
3754 colorize_quarter_hyper_shell(tria, center, inner_radius, outer_radius);
3764 const double length,
3765 const double inner_radius,
3766 const double outer_radius,
3767 const unsigned int n_radial_cells,
3768 const unsigned int n_axial_cells)
3770 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3784 const unsigned int N_r = (n_radial_cells == 0 ?
3785 static_cast<unsigned int> 3786 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
3787 (outer_radius - inner_radius))) :
3789 const unsigned int N_z = (n_axial_cells == 0 ?
3790 static_cast<unsigned int> 3791 (std::ceil (length /
3792 (2*pi*(outer_radius + inner_radius)/2/N_r))) :
3801 std::vector<Point<2> > vertices_2d(2*N_r);
3802 for (
unsigned int i=0; i<N_r; ++i)
3804 vertices_2d[i] =
Point<2>( std::cos(2*pi * i/N_r),
3805 std::sin(2*pi * i/N_r)) * outer_radius;
3806 vertices_2d[i+N_r] = vertices_2d[i] * (inner_radius/outer_radius);
3809 std::vector<Point<3> > vertices_3d;
3810 vertices_3d.reserve (2*N_r*(N_z+1));
3811 for (
unsigned int j=0; j<=N_z; ++j)
3812 for (
unsigned int i=0; i<2*N_r; ++i)
3814 const Point<3> v (vertices_2d[i][0],
3817 vertices_3d.push_back (v);
3820 std::vector<CellData<3> > cells (N_r*N_z,
CellData<3>());
3822 for (
unsigned int j=0; j<N_z; ++j)
3823 for (
unsigned int i=0; i<N_r; ++i)
3825 cells[i+j*N_r].vertices[0] = i + (j+1)*2*N_r;
3826 cells[i+j*N_r].vertices[1] = (i+1)%N_r + (j+1)*2*N_r;
3827 cells[i+j*N_r].vertices[2] = i + j*2*N_r;
3828 cells[i+j*N_r].vertices[3] = (i+1)%N_r + j*2*N_r;
3830 cells[i+j*N_r].vertices[4] = N_r+i + (j+1)*2*N_r;
3831 cells[i+j*N_r].vertices[5] = N_r+((i+1)%N_r) + (j+1)*2*N_r;
3832 cells[i+j*N_r].vertices[6] = N_r+i + j*2*N_r;
3833 cells[i+j*N_r].vertices[7] = N_r+((i+1)%N_r) + j*2*N_r;
3835 cells[i+j*N_r].material_id = 0;
3846 template <
int dim,
int spacedim>
3853 ExcMessage (
"The input triangulations must be coarse meshes."));
3855 ExcMessage (
"The input triangulations must be coarse meshes."));
3858 std::vector<Point<spacedim> > vertices = triangulation_1.
get_vertices();
3859 vertices.insert (vertices.end(),
3864 std::vector<CellData<dim> > cells;
3865 cells.reserve (triangulation_1.
n_cells() + triangulation_2.
n_cells());
3867 cell = triangulation_1.
begin(); cell != triangulation_1.
end(); ++cell)
3870 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3871 this_cell.
vertices[v] = cell->vertex_index(v);
3873 cells.push_back (this_cell);
3879 cell = triangulation_2.
begin(); cell != triangulation_2.
end(); ++cell)
3882 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3885 cells.push_back (this_cell);
3891 std::vector<unsigned int> considered_vertices;
3894 considered_vertices);
3904 template <
int dim,
int spacedim>
3911 ExcMessage (
"The two input triangulations are not derived from " 3912 "the same coarse mesh as required."));
3916 ExcMessage (
"The source triangulations for this function must both " 3917 "be available entirely locally, and not be distributed " 3918 "triangulations."));
3935 for (
unsigned int iteration=0; iteration<triangulation_2.
n_levels();
3941 bool any_cell_flagged =
false;
3944 result_cell != result.
end(); ++result_cell)
3945 if (intergrid_map[result_cell]->has_children())
3947 any_cell_flagged =
true;
3948 result_cell->set_refine_flag ();
3951 if (any_cell_flagged ==
false)
3960 template <
int dim,
int spacedim>
3968 std::vector<Point<spacedim> > vertices = input_triangulation.
get_vertices();
3972 std::vector<CellData<dim> > cells;
3974 cell = input_triangulation.
begin_active(); cell != input_triangulation.
end(); ++cell)
3975 if (cells_to_remove.find(cell) == cells_to_remove.end())
3977 Assert (static_cast<unsigned int>(cell->level()) == input_triangulation.
n_levels()-1,
3978 ExcMessage (
"Your input triangulation appears to have " 3979 "adaptively refined cells. This is not allowed. You can " 3980 "only call this function on a triangulation in which " 3981 "all cells are on the same refinement level."));
3984 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3985 this_cell.
vertices[v] = cell->vertex_index(v);
3986 this_cell.material_id = cell->material_id();
3987 cells.push_back (this_cell);
3993 std::vector<unsigned int> considered_vertices;
3996 considered_vertices);
4007 const unsigned int n_slices,
4008 const double height,
4012 ExcMessage (
"The input triangulation must be a coarse mesh, i.e., it must " 4013 "not have been refined."));
4015 ExcMessage(
"The output triangulation object needs to be empty."));
4017 ExcMessage(
"The given height for extrusion must be positive."));
4019 ExcMessage(
"The number of slices for extrusion must be at least 2."));
4021 const double delta_h = height / (n_slices-1);
4022 std::vector<double> slices_z_values;
4023 for (
unsigned int i=0; i<n_slices; ++i)
4024 slices_z_values.push_back(i*delta_h);
4030 const std::vector<double> &slice_coordinates,
4034 ExcMessage (
"The input triangulation must be a coarse mesh, i.e., it must " 4035 "not have been refined."));
4037 ExcMessage(
"The output triangulation object needs to be empty."));
4038 Assert(slice_coordinates.size()>=2,
4039 ExcMessage(
"The number of slices for extrusion must be at least 2."));
4040 const unsigned int n_slices = slice_coordinates.size();
4041 Assert(std::is_sorted(slice_coordinates.begin(), slice_coordinates.end()),
4042 ExcMessage(
"Slice z-coordinates should be in ascending order"));
4043 std::vector<Point<3> > points(n_slices*input.
n_vertices());
4044 std::vector<CellData<3> > cells;
4049 for (
unsigned int slice=0; slice<n_slices; ++slice)
4051 for (
unsigned int i=0; i<input.
n_vertices(); ++i)
4054 points[slice*input.
n_vertices()+i](0) = v(0);
4055 points[slice*input.
n_vertices()+i](1) = v(1);
4056 points[slice*input.
n_vertices()+i](2) = slice_coordinates[slice];
4063 cell = input.
begin(); cell != input.
end(); ++cell)
4065 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
4068 for (
unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
4071 = cell->vertex_index(v)+slice*input.
n_vertices();
4073 = cell->vertex_index(v)+(slice+1)*input.
n_vertices();
4077 cells.push_back(this_cell);
4089 cell = input.
begin(); cell != input.
end(); ++cell)
4092 for (
unsigned int f=0; f<4; ++f)
4093 if (cell->at_boundary(f)
4095 (cell->face(f)->boundary_id() != 0))
4098 max_boundary_id = std::max(max_boundary_id, quad.
boundary_id);
4099 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
4116 ExcMessage (
"The input triangulation to this function is using boundary " 4117 "indicators in a range that do not allow using " 4118 "max_boundary_id+1 and max_boundary_id+2 as boundary " 4119 "indicators for the bottom and top faces of the " 4120 "extruded triangulation."));
4122 cell = input.
begin(); cell != input.
end(); ++cell)
4126 quad.
vertices[0] = cell->vertex_index(0);
4127 quad.
vertices[1] = cell->vertex_index(1);
4128 quad.
vertices[2] = cell->vertex_index(2);
4129 quad.
vertices[3] = cell->vertex_index(3);
4133 for (
int i=0; i<4; ++i)
4168 const double inner_radius,
4169 const double outer_radius,
4172 const bool colorize)
4176 Assert(inner_radius < outer_radius,
4177 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
4182 center, inner_radius, outer_radius,
4186 cell = triangulation.begin_active(),
4187 endc = triangulation.end();
4188 std::vector<bool> treated_vertices(triangulation.n_vertices(),
false);
4189 for (; cell != endc; ++cell)
4191 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4192 if (cell->face(f)->at_boundary())
4194 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
4196 unsigned int vv = cell->face(f)->vertex_index(v);
4197 if (treated_vertices[vv] ==
false)
4199 treated_vertices[vv] =
true;
4203 cell->face(f)->vertex(v) = center+
Point<dim>(outer_radius,outer_radius);
4206 cell->face(f)->vertex(v) = center+
Point<dim>(-outer_radius,outer_radius);
4209 cell->face(f)->vertex(v) = center+
Point<dim>(-outer_radius,-outer_radius);
4212 cell->face(f)->vertex(v) = center+
Point<dim>(outer_radius,-outer_radius);
4221 double eps = 1
e-3 * outer_radius;
4222 cell = triangulation.begin_active();
4223 for (; cell != endc; ++cell)
4225 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4226 if (cell->face(f)->at_boundary())
4228 double dx = cell->face(f)->center()(0) - center(0);
4229 double dy = cell->face(f)->center()(1) - center(1);
4232 if (std::abs(dx + outer_radius) <
eps)
4233 cell->face(f)->set_boundary_id(0);
4234 else if (std::abs(dx - outer_radius) < eps)
4235 cell->face(f)->set_boundary_id(1);
4236 else if (std::abs(dy + outer_radius) < eps)
4237 cell->face(f)->set_boundary_id(2);
4238 else if (std::abs(dy - outer_radius) < eps)
4239 cell->face(f)->set_boundary_id(3);
4242 cell->face(f)->set_boundary_id(4);
4243 cell->face(f)->set_manifold_id(0);
4248 double d = (cell->face(f)->center() - center).
norm();
4249 if (d-inner_radius < 0)
4251 cell->face(f)->set_boundary_id(1);
4252 cell->face(f)->set_manifold_id(0);
4255 cell->face(f)->set_boundary_id(0);
4266 const double inner_radius,
4267 const double outer_radius,
4269 const unsigned int Nz,
4270 const bool colorize)
4274 Assert(inner_radius < outer_radius,
4275 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
4277 ExcMessage(
"Must give positive extension L"));
4281 L, inner_radius, outer_radius,
4287 cell = triangulation.begin_active(),
4288 endc = triangulation.end();
4289 std::vector<bool> treated_vertices(triangulation.n_vertices(),
false);
4290 for (; cell != endc; ++cell)
4292 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4293 if (cell->face(f)->at_boundary())
4295 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
4297 unsigned int vv = cell->face(f)->vertex_index(v);
4298 if (treated_vertices[vv] ==
false)
4300 treated_vertices[vv] =
true;
4301 for (
unsigned int i=0; i<=Nz; ++i)
4303 double d = ((double) i)*L/((double) Nz);
4307 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,outer_radius,
d);
4310 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,outer_radius,
d);
4313 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,-outer_radius,
d);
4316 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,-outer_radius,
d);
4326 double eps = 1
e-3 * outer_radius;
4327 cell = triangulation.begin_active();
4328 for (; cell != endc; ++cell)
4330 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4331 if (cell->face(f)->at_boundary())
4333 double dx = cell->face(f)->center()(0);
4334 double dy = cell->face(f)->center()(1);
4335 double dz = cell->face(f)->center()(2);
4339 if (std::abs(dx + outer_radius) <
eps)
4340 cell->face(f)->set_boundary_id(0);
4342 else if (std::abs(dx - outer_radius) < eps)
4343 cell->face(f)->set_boundary_id(1);
4345 else if (std::abs(dy + outer_radius) < eps)
4346 cell->face(f)->set_boundary_id(2);
4348 else if (std::abs(dy - outer_radius) < eps)
4349 cell->face(f)->set_boundary_id(3);
4351 else if (std::abs(dz) < eps)
4352 cell->face(f)->set_boundary_id(4);
4354 else if (std::abs(dz - L) < eps)
4355 cell->face(f)->set_boundary_id(5);
4359 cell->face(f)->set_all_boundary_ids(6);
4368 double d = c.
norm();
4369 if (d-inner_radius < 0)
4371 cell->face(f)->set_all_boundary_ids(1);
4375 cell->face(f)->set_boundary_id(0);
4382 template <
int dim,
int spacedim1,
int spacedim2>
4391 ExcMessage(
"Cannot use this function on parallel::distributed::Triangulation."));
4393 std::vector<Point<spacedim2> > v;
4394 std::vector<CellData<dim> > cells;
4397 const unsigned int spacedim = std::min(spacedim1,spacedim2);
4398 const std::vector<Point<spacedim1> > &in_vertices = in_tria.
get_vertices();
4400 v.resize(in_vertices.size());
4401 for (
unsigned int i=0; i<in_vertices.size(); ++i)
4402 for (
unsigned int d=0; d<spacedim; ++d)
4403 v[i][d] = in_vertices[i][d];
4408 endc = in_tria.
end();
4410 for (
unsigned int id=0; cell != endc; ++cell, ++id)
4412 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
4413 cells[
id].vertices[i] = cell->vertex_index(i);
4414 cells[id].material_id = cell->material_id();
4415 cells[id].manifold_id = cell->manifold_id();
4431 for (; face != endf; ++face)
4432 if (face->at_boundary())
4434 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4435 subcelldata.
boundary_lines[f].vertices[i] = face->vertex_index(i);
4446 for (; face != endf; ++face)
4447 if (face->at_boundary())
4449 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4450 subcelldata.
boundary_quads[f].vertices[i] = face->vertex_index(i);
4467 template <
template <
int,
int>
class MeshType,
int dim,
int spacedim>
4469 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4470 typename MeshType<dim,spacedim>::face_iterator>
4472 typename ExtractBoundaryMesh<MeshType,dim,spacedim>::return_type
4475 MeshType<dim-1,spacedim> &surface_mesh,
4476 const std::set<types::boundary_id> &boundary_ids)
4479 (&volume_mesh.get_triangulation())
4488 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4489 typename MeshType<dim,spacedim>::face_iterator>
4490 surface_to_volume_mapping;
4492 const unsigned int boundary_dim = dim-1;
4496 std::vector<typename MeshType<dim,spacedim>::face_iterator>
4500 std::vector< bool > touched (volume_mesh.get_triangulation().n_vertices(),
false);
4501 std::vector< CellData< boundary_dim > > cells;
4503 std::vector< Point<spacedim> > vertices;
4505 std::map<unsigned int,unsigned int> map_vert_index;
4507 for (
typename MeshType<dim,spacedim>::cell_iterator
4508 cell = volume_mesh.
begin(0);
4509 cell != volume_mesh.
end(0);
4511 for (
unsigned int i=0; i < GeometryInfo<dim>::faces_per_cell; ++i)
4513 const typename MeshType<dim,spacedim>::face_iterator
4514 face = cell->face(i);
4516 if ( face->at_boundary()
4518 (boundary_ids.empty() ||
4519 ( boundary_ids.find(face->boundary_id()) != boundary_ids.end())) )
4523 for (
unsigned int j=0;
4524 j<GeometryInfo<boundary_dim>::vertices_per_cell; ++j)
4526 const unsigned int v_index = face->vertex_index(j);
4528 if ( !touched[v_index] )
4530 vertices.push_back(face->vertex(j));
4531 map_vert_index[v_index] = vertices.size() - 1;
4532 touched[v_index] =
true;
4535 c_data.
vertices[j] = map_vert_index[v_index];
4567 for (
unsigned int e=0; e<4; ++e)
4573 bool edge_found =
false;
4574 for (
unsigned int i=0; i<subcell_data.
boundary_lines.size(); ++i)
4576 == map_vert_index[face->line(e)->vertex_index(0)])
4579 == map_vert_index[face->line(e)->vertex_index(1)]))
4582 == map_vert_index[face->line(e)->vertex_index(1)])
4585 == map_vert_index[face->line(e)->vertex_index(0)])))
4590 if (edge_found ==
true)
4595 edge.
vertices[0] = map_vert_index[face->line(e)->vertex_index(0)];
4596 edge.
vertices[1] = map_vert_index[face->line(e)->vertex_index(1)];
4604 cells.push_back(c_data);
4605 mapping.push_back(face);
4611 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4612 .create_triangulation (vertices, cells, subcell_data);
4615 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4616 cell = surface_mesh.
begin(0);
4617 cell!=surface_mesh.
end(0); ++cell)
4618 surface_to_volume_mapping[cell] = mapping.at(cell->index());
4622 bool changed =
false;
4624 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4626 if (surface_to_volume_mapping[cell]->has_children() == true )
4628 cell->set_refine_flag ();
4634 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4635 .execute_coarsening_and_refinement();
4637 for (
typename MeshType<dim-1,spacedim>::cell_iterator
4638 surface_cell = surface_mesh.begin(); surface_cell!=surface_mesh.end(); ++surface_cell)
4639 for (
unsigned int c=0; c<surface_cell->n_children(); c++)
4640 if (surface_to_volume_mapping.find(surface_cell->child(c)) == surface_to_volume_mapping.end())
4641 surface_to_volume_mapping[surface_cell->child(c)]
4642 = surface_to_volume_mapping[surface_cell]->child(c);
4649 return surface_to_volume_mapping;
4655 #include "grid_generator.inst" 4657 DEAL_II_NAMESPACE_CLOSE
std::vector< CellData< 1 > > boundary_lines
unsigned int n_active_cells() const
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
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
const types::manifold_id flat_manifold_id
#define AssertDimension(dim1, dim2)
active_face_iterator begin_active_face() const
Number determinant(const SymmetricTensor< 2, dim, Number > &)
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)
cell_iterator last() const
unsigned int n_cells() const
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
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)
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)
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)
static ::ExceptionBase & ExcInvalidRepetitionsDimension(int arg1)
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
types::boundary_id boundary_id
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)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void hyper_sphere(Triangulation< spacedim-1, spacedim > &tria, const Point< spacedim > ¢er=Point< spacedim >(), const double radius=1.)
static ::ExceptionBase & ExcInvalidInputOrientation()
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)
SymmetricTensor< 2, dim, Number > epsilon(const Tensor< 2, dim, Number > &Grad_u)
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.
void set_manifold(const types::manifold_id number, const Manifold< dim, spacedim > &manifold_object)
void general_cell(Triangulation< dim > &tria, const std::vector< Point< dim > > &vertices, const bool colorize=false)
void hyper_L(Triangulation< dim > &tria, const double left=-1., const double right=1., const bool colorize=false)
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 ::ExceptionBase & ExcMessage(std::string arg1)
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)
void set_all_manifold_ids(const types::manifold_id number)
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)
void quarter_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
types::material_id material_id
const std::vector< Point< spacedim > > & get_vertices() const
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 >())
static void reorder_cells(std::vector< CellData< dim > > &original_cells, const bool use_new_style_ordering=false)
face_iterator begin_face() const
void hyper_cube_slit(Triangulation< dim > &tria, const double left=0., const double right=1., const bool colorize=false)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
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
static ::ExceptionBase & ExcInvalidRadii()
void swap(Vector< Number > &u, Vector< Number > &v)
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
double norm(const FEValuesBase< dim > &fe, const VectorSlice< const std::vector< std::vector< Tensor< 1, dim > > > > &Du)
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)
void hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1., const bool attach_spherical_manifold_on_boundary_cells=false)
static ::ExceptionBase & ExcNotImplemented()
face_iterator end_face() const
void set_all_manifold_ids_on_boundary(const types::manifold_id number)
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 parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners) [dim], const bool colorize=false)
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]
static ::ExceptionBase & ExcInvalidRepetitions(int arg1)
static ::ExceptionBase & ExcInternalError()