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)
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);
435 Assert(determinant(vector_matrix) > 0.,
ExcMessage(
"Vertices of simplex must form a right handed system"));
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;
748 tria.set_all_manifold_ids(1);
749 tria.set_all_manifold_ids_on_boundary(0);
767 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
768 cell->vertex(i) = vertices[i];
773 ExcMessage(
"The volume of the cell is not greater than zero. " 774 "This could be due to the wrong ordering of the vertices."));
805 std_cxx11::array<Tensor<1,2>,2> edges;
806 edges[0] = corners[0];
807 edges[1] = corners[1];
808 std::vector<unsigned int> subdivisions;
809 subdivided_parallelepiped<2,2>(tria, origin, edges, subdivisions, colorize);
820 unsigned int n_subdivisions [dim];
821 for (
unsigned int i=0; i<dim; ++i)
822 n_subdivisions[i] = 1;
833 const unsigned int n_subdivisions,
839 unsigned int n_subdivisions_ [dim];
840 for (
unsigned int i=0; i<dim; ++i)
841 n_subdivisions_[i] = n_subdivisions;
853 const unsigned int(&n_subdivisions)[dim],
855 const unsigned int *n_subdivisions,
861 std::vector<unsigned int> subdivisions;
862 std_cxx11::array<Tensor<1,dim>,dim> edges;
863 for (
unsigned int i=0; i<dim; ++i)
865 subdivisions.push_back(n_subdivisions[i]);
866 edges[i] = corners[i];
869 subdivided_parallelepiped<dim,dim> (tria, origin, edges, subdivisions, colorize);
880 template <
int dim,
int spacedim>
885 const std::vector<unsigned int> &subdivisions,
888 std::vector<unsigned int> compute_subdivisions = subdivisions;
889 if (compute_subdivisions.size() == 0)
891 compute_subdivisions.resize(dim, 1);
894 Assert(compute_subdivisions.size()==dim,
895 ExcMessage(
"One subdivision must be provided for each dimension."));
897 for (
unsigned int i=0; i<dim; ++i)
900 Assert (edges[i].norm()>0,
901 ExcMessage(
"Edges in subdivided_parallelepiped() must not be degenerate."));
909 bool twisted_data =
false;
914 twisted_data = (edges[0][0] < 0);
921 const double plane_normal = edges[0][0]*edges[1][1] - edges[0][1]*edges[1][0];
922 twisted_data = (plane_normal < 0.0);
930 Assert(std::abs(edges[0]*edges[1]
931 /(edges[0].norm()*edges[1].norm())
933 ExcMessage(
"Edges in subdivided_parallelepiped() must point in" 934 " different directions."));
936 (edges[0], edges[1]);
950 twisted_data = (plane_normal*edges[2] < 0.0);
959 (
"The triangulation you are trying to create will consist of cells" 960 " with negative measures. This is usually the result of input data" 961 " that does not define a right-handed coordinate system. The usual" 962 " fix for this is to ensure that in 1D the given point is to the" 963 " right of the origin (or the given edge tensor is positive), in 2D" 964 " that the two edges (and their cross product) obey the right-hand" 965 " rule (which may usually be done by switching the order of the" 966 " points or edge tensors), or in 3D that the edges form a" 967 " right-handed coordinate system (which may also be accomplished by" 968 " switching the order of the first two points or edge tensors)."));
971 for (
unsigned int i=0; i<dim; ++i)
972 for (
unsigned int j=i+1; j<dim; ++j)
973 Assert ((edges[i]!=edges[j]),
974 ExcMessage (
"Degenerate edges of subdivided_parallelepiped encountered."));
977 std::vector<Point<spacedim> > points;
982 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
983 points.push_back (origin + edges[0]/compute_subdivisions[0]*x);
987 for (
unsigned int y=0; y<=compute_subdivisions[1]; ++y)
988 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
989 points.push_back (origin
990 + edges[0]/compute_subdivisions[0]*x
991 + edges[1]/compute_subdivisions[1]*y);
995 for (
unsigned int z=0; z<=compute_subdivisions[2]; ++z)
996 for (
unsigned int y=0; y<=compute_subdivisions[1]; ++y)
997 for (
unsigned int x=0; x<=compute_subdivisions[0]; ++x)
1000 + edges[0]/compute_subdivisions[0]*x
1001 + edges[1]/compute_subdivisions[1]*y
1002 + edges[2]/compute_subdivisions[2]*z);
1010 unsigned int n_cells = 1;
1011 for (
unsigned int i=0; i<dim; ++i)
1012 n_cells *= compute_subdivisions[i];
1013 std::vector<CellData<dim> > cells (n_cells);
1019 for (
unsigned int x=0; x<compute_subdivisions[0]; ++x)
1021 cells[x].vertices[0] = x;
1022 cells[x].vertices[1] = x+1;
1025 cells[x].material_id = 0;
1032 const unsigned int n_dy = compute_subdivisions[1];
1033 const unsigned int n_dx = compute_subdivisions[0];
1035 for (
unsigned int y=0; y<n_dy; ++y)
1036 for (
unsigned int x=0; x<n_dx; ++x)
1038 const unsigned int c = y*n_dx + x;
1039 cells[c].vertices[0] = y*(n_dx+1) + x;
1040 cells[c].vertices[1] = y*(n_dx+1) + x+1;
1041 cells[c].vertices[2] = (y+1)*(n_dx+1) + x;
1042 cells[c].vertices[3] = (y+1)*(n_dx+1) + x+1;
1045 cells[c].material_id = 0;
1053 const unsigned int n_dz = compute_subdivisions[2];
1054 const unsigned int n_dy = compute_subdivisions[1];
1055 const unsigned int n_dx = compute_subdivisions[0];
1057 for (
unsigned int z=0; z<n_dz; ++z)
1058 for (
unsigned int y=0; y<n_dy; ++y)
1059 for (
unsigned int x=0; x<n_dx; ++x)
1061 const unsigned int c = z*n_dy*n_dx + y*n_dx + x;
1063 cells[c].vertices[0] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
1064 cells[c].vertices[1] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
1065 cells[c].vertices[2] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
1066 cells[c].vertices[3] = z*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
1067 cells[c].vertices[4] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x;
1068 cells[c].vertices[5] = (z+1)*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1;
1069 cells[c].vertices[6] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x;
1070 cells[c].vertices[7] = (z+1)*(n_dy+1)*(n_dx+1) + (y+1)*(n_dx+1) + x+1;
1073 cells[c].material_id = 0;
1094 for (; cell!=endc; ++cell)
1096 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1098 if (cell->face(face)->at_boundary())
1099 cell->face(face)->set_boundary_id(face);
1106 template <
int dim,
int spacedim>
1109 const unsigned int repetitions,
1115 ExcMessage (
"Invalid left-to-right bounds of hypercube"));
1118 for (
unsigned int i=0; i<dim; ++i)
1124 std::vector<unsigned int> reps(dim, repetitions);
1130 template <
int dim,
int spacedim>
1134 const std::vector<unsigned int> &repetitions,
1137 const bool colorize)
1139 Assert(repetitions.size() == dim,
1146 for (
unsigned int i=0; i<dim; ++i)
1148 p1(i) = std::min(p_1(i), p_2(i));
1149 p2(i) = std::max(p_1(i), p_2(i));
1153 std::vector<Point<spacedim> > delta(dim);
1154 for (
unsigned int i=0; i<dim; ++i)
1158 delta[i][i] = (p2[i]-p1[i])/repetitions[i];
1160 ExcMessage(
"The first dim entries of coordinates of p1 and p2 need to be different."));
1164 std::vector<Point<spacedim> > points;
1168 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1169 points.push_back (p1+(
double)x*delta[0]);
1173 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1174 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1175 points.push_back (p1+(
double)x*delta[0]
1176 +(
double)y*delta[1]);
1180 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1181 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1182 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1183 points.push_back (p1+(
double)x*delta[0] +
1184 (
double)y*delta[1] + (
double)z*delta[2]);
1192 std::vector<CellData<dim> > cells;
1197 cells.resize (repetitions[0]);
1198 for (
unsigned int x=0; x<repetitions[0]; ++x)
1200 cells[x].vertices[0] = x;
1201 cells[x].vertices[1] = x+1;
1202 cells[x].material_id = 0;
1209 cells.resize (repetitions[1]*repetitions[0]);
1210 for (
unsigned int y=0; y<repetitions[1]; ++y)
1211 for (
unsigned int x=0; x<repetitions[0]; ++x)
1213 const unsigned int c = x+y*repetitions[0];
1214 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1215 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1216 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1217 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1218 cells[c].material_id = 0;
1225 const unsigned int n_x = (repetitions[0]+1);
1226 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1228 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1229 for (
unsigned int z=0; z<repetitions[2]; ++z)
1230 for (
unsigned int y=0; y<repetitions[1]; ++y)
1231 for (
unsigned int x=0; x<repetitions[0]; ++x)
1233 const unsigned int c = x+y*repetitions[0] +
1234 z*repetitions[0]*repetitions[1];
1235 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1236 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1237 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1238 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1239 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1240 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1241 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1242 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1243 cells[c].material_id = 0;
1265 double epsilon = 10;
1266 for (
unsigned int i=0; i<dim; ++i)
1267 epsilon = std::min(epsilon, 0.01*delta[i][i]);
1269 ExcMessage (
"The distance between corner points must be positive."))
1273 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1283 const std::vector<std::vector<double> > &step_sz,
1286 const bool colorize)
1288 Assert(step_sz.size() == dim,
1299 std::vector< std::vector<double> > step_sizes(step_sz);
1301 for (
unsigned int i=0; i<dim; ++i)
1305 std::swap (p1(i), p2(i));
1306 std::reverse (step_sizes[i].begin(), step_sizes[i].end());
1310 for (
unsigned int j=0; j<step_sizes.at(i).size(); j++)
1311 x += step_sizes[i][j];
1312 Assert(std::fabs(x - (p2(i)-p1(i))) <= 1e-12*std::fabs(x),
1313 ExcMessage (
"The sequence of step sizes in coordinate direction " +
1315 " must be equal to the distance of the two given " 1316 "points in this coordinate direction."));
1322 std::vector<Point<dim> > points;
1328 for (
unsigned int i=0; ; ++i)
1337 if (i == step_sizes[0].size())
1340 x += step_sizes[0][i];
1348 for (
unsigned int j=0; ; ++j)
1351 for (
unsigned int i=0; ; ++i)
1355 if (i == step_sizes[0].size())
1358 x += step_sizes[0][i];
1361 if (j == step_sizes[1].size())
1364 y += step_sizes[1][j];
1372 for (
unsigned int k=0; ; ++k)
1375 for (
unsigned int j=0; ; ++j)
1378 for (
unsigned int i=0; ; ++i)
1383 if (i == step_sizes[0].size())
1386 x += step_sizes[0][i];
1389 if (j == step_sizes[1].size())
1392 y += step_sizes[1][j];
1395 if (k == step_sizes[2].size())
1398 z += step_sizes[2][k];
1409 std::vector<CellData<dim> > cells;
1414 cells.resize (step_sizes[0].size());
1415 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1417 cells[x].vertices[0] = x;
1418 cells[x].vertices[1] = x+1;
1419 cells[x].material_id = 0;
1426 cells.resize (step_sizes[1].size()*step_sizes[0].size());
1427 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1428 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1430 const unsigned int c = x+y*step_sizes[0].size();
1431 cells[c].vertices[0] = y*(step_sizes[0].size()+1)+x;
1432 cells[c].vertices[1] = y*(step_sizes[0].size()+1)+x+1;
1433 cells[c].vertices[2] = (y+1)*(step_sizes[0].size()+1)+x;
1434 cells[c].vertices[3] = (y+1)*(step_sizes[0].size()+1)+x+1;
1435 cells[c].material_id = 0;
1442 const unsigned int n_x = (step_sizes[0].size()+1);
1443 const unsigned int n_xy = (step_sizes[0].size()+1)*(step_sizes[1].size()+1);
1445 cells.resize (step_sizes[2].size()*step_sizes[1].size()*step_sizes[0].size());
1446 for (
unsigned int z=0; z<step_sizes[2].size(); ++z)
1447 for (
unsigned int y=0; y<step_sizes[1].size(); ++y)
1448 for (
unsigned int x=0; x<step_sizes[0].size(); ++x)
1450 const unsigned int c = x+y*step_sizes[0].size() +
1451 z*step_sizes[0].size()*step_sizes[1].size();
1452 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1453 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1454 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1455 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1456 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1457 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1458 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1459 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1460 cells[c].material_id = 0;
1482 double min_size = *std::min_element (step_sizes[0].begin(),
1483 step_sizes[0].end());
1484 for (
unsigned int i=1; i<dim; ++i)
1485 min_size = std::min (min_size,
1486 *std::min_element (step_sizes[i].begin(),
1487 step_sizes[i].end()));
1488 const double epsilon = 0.01 * min_size;
1492 colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon);
1502 const std::vector< std::vector<double> > &spacing,
1505 const bool colorize)
1507 Assert(spacing.size() == 1,
1510 const unsigned int n_cells = material_id.size(0);
1512 Assert(spacing[0].size() == n_cells,
1515 double delta = std::numeric_limits<double>::max();
1516 for (
unsigned int i=0; i<n_cells; i++)
1519 delta = std::min (delta, spacing[0][i]);
1523 std::vector<Point<1> > points;
1525 for (
unsigned int x=0; x<=n_cells; ++x)
1529 ax += spacing[0][x];
1532 unsigned int n_val_cells = 0;
1533 for (
unsigned int i=0; i<n_cells; i++)
1536 std::vector<CellData<1> > cells(n_val_cells);
1537 unsigned int id = 0;
1538 for (
unsigned int x=0; x<n_cells; ++x)
1541 cells[id].vertices[0] = x;
1542 cells[id].vertices[1] = x+1;
1562 const std::vector< std::vector<double> > &spacing,
1565 const bool colorize)
1567 Assert(spacing.size() == 2,
1570 std::vector<unsigned int> repetitions(2);
1571 unsigned int n_cells = 1;
1572 double delta = std::numeric_limits<double>::max();
1573 for (
unsigned int i=0; i<2; i++)
1575 repetitions[i] = spacing[i].size();
1576 n_cells *= repetitions[i];
1577 for (
unsigned int j=0; j<repetitions[i]; j++)
1580 delta = std::min (delta, spacing[i][j]);
1587 std::vector<Point<2> > points;
1589 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1592 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1594 points.push_back (
Point<2> (ax,ay));
1595 if (x<repetitions[0])
1596 ax += spacing[0][x];
1598 if (y<repetitions[1])
1599 ay += spacing[1][y];
1603 unsigned int n_val_cells = 0;
1604 for (
unsigned int i=0; i<
material_id.size(0); i++)
1605 for (
unsigned int j=0; j<
material_id.size(1); j++)
1609 std::vector<CellData<2> > cells(n_val_cells);
1610 unsigned int id = 0;
1611 for (
unsigned int y=0; y<repetitions[1]; ++y)
1612 for (
unsigned int x=0; x<repetitions[0]; ++x)
1615 cells[id].vertices[0] = y*(repetitions[0]+1)+x;
1616 cells[id].vertices[1] = y*(repetitions[0]+1)+x+1;
1617 cells[id].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1618 cells[id].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1632 double eps = 0.01 * delta;
1635 for (; cell !=endc; ++cell)
1637 Point<2> cell_center = cell->center();
1638 for (
unsigned int f=0; f<GeometryInfo<2>::faces_per_cell; ++f)
1639 if (cell->face(f)->boundary_id() == 0)
1641 Point<2> face_center = cell->face(f)->center();
1642 for (
unsigned int i=0; i<2; ++i)
1644 if (face_center[i]<cell_center[i]-eps)
1645 cell->face(f)->set_boundary_id(i*2);
1646 if (face_center[i]>cell_center[i]+eps)
1647 cell->face(f)->set_boundary_id(i*2+1);
1659 const std::vector< std::vector<double> > &spacing,
1662 const bool colorize)
1664 const unsigned int dim = 3;
1666 Assert(spacing.size() == dim,
1669 std::vector<unsigned int > repetitions(dim);
1670 unsigned int n_cells = 1;
1671 double delta = std::numeric_limits<double>::max();
1672 for (
unsigned int i=0; i<dim; i++)
1674 repetitions[i] = spacing[i].size();
1675 n_cells *= repetitions[i];
1676 for (
unsigned int j=0; j<repetitions[i]; j++)
1679 delta = std::min (delta, spacing[i][j]);
1686 std::vector<Point<dim> > points;
1688 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1691 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1694 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1697 if (x<repetitions[0])
1698 ax += spacing[0][x];
1700 if (y<repetitions[1])
1701 ay += spacing[1][y];
1703 if (z<repetitions[2])
1704 az += spacing[2][z];
1708 unsigned int n_val_cells = 0;
1709 for (
unsigned int i=0; i<
material_id.size(0); i++)
1710 for (
unsigned int j=0; j<
material_id.size(1); j++)
1711 for (
unsigned int k=0; k<
material_id.size(2); k++)
1715 std::vector<CellData<dim> > cells(n_val_cells);
1716 unsigned int id = 0;
1717 const unsigned int n_x = (repetitions[0]+1);
1718 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1719 for (
unsigned int z=0; z<repetitions[2]; ++z)
1720 for (
unsigned int y=0; y<repetitions[1]; ++y)
1721 for (
unsigned int x=0; x<repetitions[0]; ++x)
1724 cells[id].vertices[0] = z*n_xy + y*n_x + x;
1725 cells[id].vertices[1] = z*n_xy + y*n_x + x+1;
1726 cells[id].vertices[2] = z*n_xy + (y+1)*n_x + x;
1727 cells[id].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1728 cells[id].vertices[4] = (z+1)*n_xy + y*n_x + x;
1729 cells[id].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1730 cells[id].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1731 cells[id].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1745 double eps = 0.01 * delta;
1748 for (; cell !=endc; ++cell)
1751 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
1752 if (cell->face(f)->boundary_id() == 0)
1754 Point<dim> face_center = cell->face(f)->center();
1755 for (
unsigned int i=0; i<dim; ++i)
1757 if (face_center[i]<cell_center[i]-eps)
1758 cell->face(f)->set_boundary_id(i*2);
1759 if (face_center[i]>cell_center[i]+eps)
1760 cell->face(f)->set_boundary_id(i*2+1);
1767 template <
int dim,
int spacedim>
1771 const std::vector<unsigned int> &holes)
1780 for (
unsigned int d=0; d<dim; ++d)
1787 std::vector<Point<spacedim> > delta(dim);
1788 unsigned int repetitions[dim];
1789 for (
unsigned int i=0; i<dim; ++i)
1791 Assert (holes[i] >= 1,
ExcMessage(
"At least one hole needed in each direction"));
1792 repetitions[i] = 2*holes[i]+1;
1793 delta[i][i] = (p2[i]-p1[i]);
1798 std::vector<Point<spacedim> > points;
1802 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1803 points.push_back (p1+(
double)x*delta[0]);
1807 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1808 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1809 points.push_back (p1+(
double)x*delta[0]
1810 +(
double)y*delta[1]);
1814 for (
unsigned int z=0; z<=repetitions[2]; ++z)
1815 for (
unsigned int y=0; y<=repetitions[1]; ++y)
1816 for (
unsigned int x=0; x<=repetitions[0]; ++x)
1817 points.push_back (p1+(
double)x*delta[0] +
1818 (
double)y*delta[1] + (
double)z*delta[2]);
1827 std::vector<CellData<dim> > cells;
1832 cells.resize (repetitions[1]*repetitions[0]-holes[1]*holes[0]);
1834 for (
unsigned int y=0; y<repetitions[1]; ++y)
1835 for (
unsigned int x=0; x<repetitions[0]; ++x)
1837 if ((x%2 == 1) && (y%2 ==1))
continue;
1839 cells[c].vertices[0] = y*(repetitions[0]+1)+x;
1840 cells[c].vertices[1] = y*(repetitions[0]+1)+x+1;
1841 cells[c].vertices[2] = (y+1)*(repetitions[0]+1)+x;
1842 cells[c].vertices[3] = (y+1)*(repetitions[0]+1)+x+1;
1843 cells[c].material_id = 0;
1851 const unsigned int n_x = (repetitions[0]+1);
1852 const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1);
1854 cells.resize (repetitions[2]*repetitions[1]*repetitions[0]);
1857 for (
unsigned int z=0; z<repetitions[2]; ++z)
1858 for (
unsigned int y=0; y<repetitions[1]; ++y)
1859 for (
unsigned int x=0; x<repetitions[0]; ++x)
1862 cells[c].vertices[0] = z*n_xy + y*n_x + x;
1863 cells[c].vertices[1] = z*n_xy + y*n_x + x+1;
1864 cells[c].vertices[2] = z*n_xy + (y+1)*n_x + x;
1865 cells[c].vertices[3] = z*n_xy + (y+1)*n_x + x+1;
1866 cells[c].vertices[4] = (z+1)*n_xy + y*n_x + x;
1867 cells[c].vertices[5] = (z+1)*n_xy + y*n_x + x+1;
1868 cells[c].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x;
1869 cells[c].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1;
1870 cells[c].material_id = 0;
1884 template <
int dim,
int spacedim>
1886 const std::vector<unsigned int> &sizes,
1887 const bool colorize)
1896 for (
unsigned int d=0; d<dim; ++d)
1899 std::vector<Point<spacedim> > points;
1900 unsigned int n_cells = 1;
1901 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
1902 n_cells += sizes[i];
1904 std::vector<CellData<dim> > cells(n_cells);
1906 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
1909 for (
unsigned int d=0; d<dim; ++d)
1910 p(d) = 0.5 * dimensions[d] *
1912 points.push_back(p);
1913 cells[0].vertices[i] = i;
1915 cells[0].material_id = 0;
1918 unsigned int cell_index = 1;
1920 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1926 for (
unsigned int j=0; j<sizes[face]; ++j,++cell_index)
1928 const unsigned int last_cell = (j==0) ? 0U : (cell_index-1);
1930 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
1935 cells[cell_index].vertices[ocellv] = cells[last_cell].vertices[cellv];
1938 cells[cell_index].vertices[cellv] = points.size();
1942 points.push_back(p);
1944 cells[cell_index].material_id = (colorize) ? (face+1U) : 0U;
2021 const unsigned int ,
2033 const unsigned int ,
2034 const unsigned int )
2066 const unsigned int ,
2077 const unsigned int ,
2087 const double thickness,
2088 const bool colorize)
2091 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
2093 std::vector<Point<2> > vertices(16);
2095 coords[0] = left-thickness;
2098 coords[3] = right+thickness;
2101 for (
unsigned int i0=0; i0<4; ++i0)
2102 for (
unsigned int i1=0; i1<4; ++i1)
2103 vertices[k++] =
Point<2>(coords[i1], coords[i0]);
2110 std::vector<CellData<2> > cells(9);
2112 for (
unsigned int i0=0; i0<3; ++i0)
2113 for (
unsigned int i1=0; i1<3; ++i1)
2115 cells[k].vertices[0] = i1+4*i0;
2116 cells[k].vertices[1] = i1+4*i0+1;
2117 cells[k].vertices[2] = i1+4*i0+4;
2118 cells[k].vertices[3] = i1+4*i0+5;
2120 cells[k].material_id = materials[k];
2136 const bool colorize)
2138 const double rl2=(right+left)/2;
2150 const int cell_vertices[4][4] = { { 0,1,3,2 },
2155 std::vector<CellData<2> > cells (4,
CellData<2>());
2156 for (
unsigned int i=0; i<4; ++i)
2158 for (
unsigned int j=0; j<4; ++j)
2159 cells[i].vertices[j] = cell_vertices[i][j];
2160 cells[i].material_id = 0;
2163 std::vector<
Point<2> >(&vertices[0], &vertices[10]),
2170 cell->face(1)->set_boundary_id(1);
2172 cell->face(0)->set_boundary_id(2);
2180 const double radius_0,
2181 const double radius_1,
2182 const double half_length)
2186 vertices_tmp[0] =
Point<2> (-half_length, -radius_0);
2187 vertices_tmp[1] =
Point<2> (half_length, -radius_1);
2188 vertices_tmp[2] =
Point<2> (-half_length, radius_0);
2189 vertices_tmp[3] =
Point<2> (half_length, radius_1);
2191 const std::vector<Point<2> > vertices (&vertices_tmp[0], &vertices_tmp[4]);
2194 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2195 cell_vertices[0][i] = i;
2197 std::vector<CellData<2> > cells (1,
CellData<2> ());
2199 for (
unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
2200 cells[0].vertices[i] = cell_vertices[0][i];
2202 cells[0].material_id = 0;
2207 cell->face (0)->set_boundary_id (1);
2208 cell->face (1)->set_boundary_id (2);
2210 for (
unsigned int i = 2; i < 4; ++i)
2211 cell->face (i)->set_boundary_id (0);
2222 const bool colorize)
2233 const int cell_vertices[3][4] = {{0, 1, 3, 4},
2238 std::vector<CellData<2> > cells (3,
CellData<2>());
2240 for (
unsigned int i=0; i<3; ++i)
2242 for (
unsigned int j=0; j<4; ++j)
2243 cells[i].vertices[j] = cell_vertices[i][j];
2244 cells[i].material_id = 0;
2248 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2256 cell->face(0)->set_boundary_id(0);
2257 cell->face(2)->set_boundary_id(1);
2260 cell->face(1)->set_boundary_id(2);
2261 cell->face(2)->set_boundary_id(1);
2262 cell->face(3)->set_boundary_id(3);
2265 cell->face(0)->set_boundary_id(0);
2266 cell->face(1)->set_boundary_id(4);
2267 cell->face(3)->set_boundary_id(5);
2280 const double radius)
2285 const double a = 1./(1+std::sqrt(2.0));
2287 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2288 p+
Point<2>(-1,-1) *(radius/std::sqrt(2.0)*a),
2289 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2290 p+
Point<2>(-1,+1) *(radius/std::sqrt(2.0)*a),
2291 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2292 p+
Point<2>(-1,+1) *(radius/std::sqrt(2.0)),
2293 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2296 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2303 std::vector<CellData<2> > cells (5,
CellData<2>());
2305 for (
unsigned int i=0; i<5; ++i)
2307 for (
unsigned int j=0; j<4; ++j)
2308 cells[i].vertices[j] = cell_vertices[i][j];
2309 cells[i].material_id = 0;
2313 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2323 const double inner_radius,
2324 const double outer_radius,
2325 const unsigned int n_cells,
2326 const bool colorize)
2328 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2342 const unsigned int N = (n_cells == 0 ?
2343 static_cast<unsigned int> 2344 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
2345 (outer_radius - inner_radius))) :
2354 std::vector<Point<2> > vertices(2*N);
2355 for (
unsigned int i=0; i<N; ++i)
2357 vertices[i] =
Point<2>( std::cos(2*pi * i/N),
2358 std::sin(2*pi * i/N)) * outer_radius;
2359 vertices[i+N] = vertices[i] * (inner_radius/outer_radius);
2361 vertices[i] += center;
2362 vertices[i+N] += center;
2365 std::vector<CellData<2> > cells (N,
CellData<2>());
2367 for (
unsigned int i=0; i<N; ++i)
2369 cells[i].vertices[0] = i;
2370 cells[i].vertices[1] = (i+1)%N;
2371 cells[i].vertices[2] = N+i;
2372 cells[i].vertices[3] = N+((i+1)%N);
2374 cells[i].material_id = 0;
2381 colorize_hyper_shell(tria, center, inner_radius, outer_radius);
2389 const double radius,
2390 const double half_length)
2392 Point<2> p1 (-half_length, -radius);
2401 switch (f->boundary_id())
2404 f->set_boundary_id(1);
2407 f->set_boundary_id(2);
2410 f->set_boundary_id(0);
2436 const double radius)
2438 const unsigned int dim = 2;
2453 const int cell_vertices[3][4]
2461 for (
unsigned int i=0; i<3; ++i)
2463 for (
unsigned int j=0; j<4; ++j)
2464 cells[i].vertices[j] = cell_vertices[i][j];
2465 cells[i].material_id = 0;
2469 std::vector<
Point<dim> >(&vertices[0], &vertices[7]),
2478 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
2485 if (cell->face(i)->center()(0) < p(0)+1.e-5 * radius
2486 || cell->face(i)->center()(1) < p(1)+1.e-5 * radius)
2487 cell->face(i)->set_boundary_id(1);
2498 const double radius)
2503 const double a = 1./(1+std::sqrt(2.0));
2505 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)),
2506 p+
Point<2>(0,-1) *(radius/std::sqrt(2.0)*a),
2507 p+
Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a),
2508 p+
Point<2>(0,+1) *(radius/std::sqrt(2.0)*a),
2509 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a),
2511 p+
Point<2>(+1,+1) *(radius/std::sqrt(2.0))
2514 const int cell_vertices[5][4] = {{0, 1, 2, 3},
2520 std::vector<CellData<2> > cells (4,
CellData<2>());
2522 for (
unsigned int i=0; i<4; ++i)
2524 for (
unsigned int j=0; j<4; ++j)
2525 cells[i].vertices[j] = cell_vertices[i][j];
2526 cells[i].material_id = 0;
2530 std::vector<
Point<2> >(&vertices[0], &vertices[8]),
2540 for (
unsigned int i=0; i<GeometryInfo<2>::faces_per_cell; ++i)
2546 if (cell->face(i)->center()(0) < p(0)+1.e-5 * radius)
2547 cell->face(i)->set_boundary_id(1);
2560 const double inner_radius,
2561 const double outer_radius,
2562 const unsigned int n_cells,
2563 const bool colorize)
2565 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2578 const unsigned int N = (n_cells == 0 ?
2579 static_cast<unsigned int> 2580 (std::ceil((pi* (outer_radius + inner_radius)/2) /
2581 (outer_radius - inner_radius))) :
2590 std::vector<Point<2> > vertices(2*(N+1));
2591 for (
unsigned int i=0; i<=N; ++i)
2599 vertices[i] =
Point<2>( ( (i==0) || (i==N) ?
2601 std::cos(pi * i/N - pi/2) ),
2602 std::sin(pi * i/N - pi/2)) * outer_radius;
2603 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2605 vertices[i] += center;
2606 vertices[i+N+1] += center;
2610 std::vector<CellData<2> > cells (N,
CellData<2>());
2612 for (
unsigned int i=0; i<N; ++i)
2614 cells[i].vertices[0] = i;
2615 cells[i].vertices[1] = (i+1)%(N+1);
2616 cells[i].vertices[2] = N+1+i;
2617 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2619 cells[i].material_id = 0;
2627 for (; cell!=tria.
end(); ++cell)
2629 cell->face(2)->set_boundary_id(1);
2631 tria.
begin()->face(0)->set_boundary_id(3);
2633 tria.
last()->face(1)->set_boundary_id(2);
2641 const double inner_radius,
2642 const double outer_radius,
2643 const unsigned int n_cells,
2644 const bool colorize)
2646 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
2659 const unsigned int N = (n_cells == 0 ?
2660 static_cast<unsigned int> 2661 (std::ceil((pi* (outer_radius + inner_radius)/4) /
2662 (outer_radius - inner_radius))) :
2671 std::vector<Point<2> > vertices(2*(N+1));
2672 for (
unsigned int i=0; i<=N; ++i)
2681 std::cos(pi * i/N/2) ),
2682 std::sin(pi * i/N/2)) * outer_radius;
2683 vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius);
2685 vertices[i] += center;
2686 vertices[i+N+1] += center;
2690 std::vector<CellData<2> > cells (N,
CellData<2>());
2692 for (
unsigned int i=0; i<N; ++i)
2694 cells[i].vertices[0] = i;
2695 cells[i].vertices[1] = (i+1)%(N+1);
2696 cells[i].vertices[2] = N+1+i;
2697 cells[i].vertices[3] = N+1+((i+1)%(N+1));
2699 cells[i].material_id = 0;
2707 for (; cell!=tria.
end(); ++cell)
2709 cell->face(2)->set_boundary_id(1);
2711 tria.
begin()->face(0)->set_boundary_id(3);
2713 tria.
last()->face(1)->set_boundary_id(2);
2724 const bool colorize)
2726 const double rl2=(right+left)/2;
2727 const double len = (right-left)/2.;
2752 const int cell_vertices[4][8] = { { 0,1,3,2, 10, 11, 13, 12 },
2753 { 9,4,2,5, 19,14, 12, 15 },
2754 { 3,2,7,6,13,12,17,16 },
2755 { 2,5,6,8,12,15,16,18 }
2757 std::vector<CellData<3> > cells (4,
CellData<3>());
2758 for (
unsigned int i=0; i<4; ++i)
2760 for (
unsigned int j=0; j<8; ++j)
2761 cells[i].vertices[j] = cell_vertices[i][j];
2762 cells[i].material_id = 0;
2765 std::vector<
Point<3> >(&vertices[0], &vertices[20]),
2772 cell->face(1)->set_boundary_id(1);
2774 cell->face(0)->set_boundary_id(2);
2785 const double thickness,
2786 const bool colorize)
2789 ExcMessage (
"Invalid left-to-right bounds of enclosed hypercube"));
2791 std::vector<Point<3> > vertices(64);
2793 coords[0] = left-thickness;
2796 coords[3] = right+thickness;
2799 for (
unsigned int z=0; z<4; ++z)
2800 for (
unsigned int y=0; y<4; ++y)
2801 for (
unsigned int x=0; x<4; ++x)
2802 vertices[k++] =
Point<3>(coords[x], coords[y], coords[z]);
2817 std::vector<CellData<3> > cells(27);
2819 for (
unsigned int z=0; z<3; ++z)
2820 for (
unsigned int y=0; y<3; ++y)
2821 for (
unsigned int x=0; x<3; ++x)
2823 cells[k].vertices[0] = x+4*y+16*z;
2824 cells[k].vertices[1] = x+4*y+16*z+1;
2825 cells[k].vertices[2] = x+4*y+16*z+4;
2826 cells[k].vertices[3] = x+4*y+16*z+5;
2827 cells[k].vertices[4] = x+4*y+16*z+16;
2828 cells[k].vertices[5] = x+4*y+16*z+17;
2829 cells[k].vertices[6] = x+4*y+16*z+20;
2830 cells[k].vertices[7] = x+4*y+16*z+21;
2832 cells[k].material_id = materials[k];
2845 const double radius_0,
2846 const double radius_1,
2847 const double half_length)
2851 n_cells =
static_cast<unsigned int>(std::ceil (half_length /
2854 const unsigned int n_vertices = 4 * (n_cells + 1);
2855 std::vector<Point<3> > vertices_tmp(n_vertices);
2857 vertices_tmp[0] =
Point<3> (-half_length, 0, -radius_0);
2858 vertices_tmp[1] =
Point<3> (-half_length, radius_0, 0);
2859 vertices_tmp[2] =
Point<3> (-half_length, -radius_0, 0);
2860 vertices_tmp[3] =
Point<3> (-half_length, 0, radius_0);
2862 const double dx = 2 * half_length / n_cells;
2864 for (
unsigned int i = 0; i < n_cells; ++i)
2866 vertices_tmp[4 * (i + 1)]
2867 = vertices_tmp[4 * i] +
2868 Point<3> (dx, 0, 0.5 * (radius_0 - radius_1) *
dx / half_length);
2869 vertices_tmp[4 * i + 5]
2870 = vertices_tmp[4 * i + 1] +
2871 Point<3> (
dx, 0.5 * (radius_1 - radius_0) * dx / half_length, 0);
2872 vertices_tmp[4 * i + 6]
2873 = vertices_tmp[4 * i + 2] +
2874 Point<3> (
dx, 0.5 * (radius_0 - radius_1) * dx / half_length, 0);
2875 vertices_tmp[4 * i + 7]
2876 = vertices_tmp[4 * i + 3] +
2877 Point<3> (
dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length);
2880 const std::vector<Point<3> > vertices (vertices_tmp.begin(),
2881 vertices_tmp.end());
2884 for (
unsigned int i = 0; i < n_cells; ++i)
2885 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2886 cell_vertices[i][j] = 4 * i + j;
2888 std::vector<CellData<3> > cells (n_cells,
CellData<3> ());
2890 for (
unsigned int i = 0; i < n_cells; ++i)
2892 for (
unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
2893 cells[i].vertices[j] = cell_vertices[i][j];
2895 cells[i].material_id = 0;
2901 cell != triangulation.
end (); ++cell)
2903 if (cell->vertex (0) (0) == -half_length)
2905 cell->face (4)->set_boundary_id (1);
2907 for (
unsigned int i = 0; i < 4; ++i)
2908 cell->line (i)->set_boundary_id (0);
2911 if (cell->vertex (4) (0) == half_length)
2913 cell->face (5)->set_boundary_id (2);
2915 for (
unsigned int i = 4; i < 8; ++i)
2916 cell->line (i)->set_boundary_id (0);
2919 for (
unsigned int i = 0; i < 4; ++i)
2920 cell->face (i)->set_boundary_id (0);
2931 const bool colorize)
2969 const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13},
2970 {1, 2, 10, 11, 4, 5, 13, 14},
2971 {3, 4, 12, 13, 6, 7, 15, 16},
2972 {4, 5, 13, 14, 7, 8, 16, 17},
2973 {9, 10, 18, 19, 12, 13, 21, 22},
2974 {10, 11, 19, 20, 13, 14, 22, 23},
2975 {12, 13, 21, 22, 15, 16, 24, 25}
2978 std::vector<CellData<3> > cells (7,
CellData<3>());
2980 for (
unsigned int i=0; i<7; ++i)
2982 for (
unsigned int j=0; j<8; ++j)
2983 cells[i].vertices[j] = cell_vertices[i][j];
2984 cells[i].material_id = 0;
2988 std::vector<
Point<3> >(&vertices[0], &vertices[26]),
3005 const double radius)
3007 const double a = 1./(1+std::sqrt(3.0));
3010 const unsigned int n_vertices = 16;
3011 const Point<3> vertices[n_vertices]
3016 p+
Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)*a),
3017 p+
Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)*a),
3018 p+
Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)*a),
3019 p+
Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)*a),
3020 p+
Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)*a),
3021 p+
Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)*a),
3022 p+
Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)*a),
3023 p+
Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)*a),
3026 p+
Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)),
3027 p+
Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)),
3028 p+
Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)),
3029 p+
Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)),
3030 p+
Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)),
3031 p+
Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)),
3032 p+
Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)),
3033 p+
Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)),
3038 const unsigned int n_cells = 7;
3039 const int cell_vertices[n_cells][8] = {{0, 1, 4, 5, 3, 2, 7, 6},
3040 {8, 9, 12, 13, 0, 1, 4, 5},
3041 {9, 13, 1, 5, 10, 14, 2, 6},
3042 {11, 10, 3, 2, 15, 14, 7, 6},
3043 {8, 0, 12, 4, 11, 3, 15, 7},
3044 {8, 9, 0, 1, 11, 10, 3, 2},
3045 {12, 4, 13, 5, 15, 7, 14, 6}
3048 std::vector<CellData<3> > cells (n_cells,
CellData<3>());
3050 for (
unsigned int i=0; i<n_cells; ++i)
3052 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
3053 cells[i].vertices[j] = cell_vertices[i][j];
3054 cells[i].material_id = 0;
3058 std::vector<
Point<3> >(&vertices[0], &vertices[n_vertices]),
3063 template <
int dim,
int spacedim>
3067 const double radius)
3071 std::set<types::boundary_id> boundary_ids;
3072 boundary_ids.insert (0);
3083 const double radius,
3084 const double half_length)
3088 const double d = radius/std::sqrt(2.0);
3089 const double a = d/(1+std::sqrt(2.0));
3118 for (
unsigned int i=0; i<24; ++i)
3120 const double h = vertices[i](1);
3121 vertices[i](1) = -vertices[i](0);
3125 int cell_vertices[10][8] =
3127 {0, 1, 8, 9, 2, 3, 10, 11},
3128 {0, 2, 8, 10, 6, 4, 14, 12},
3129 {2, 3, 10, 11, 4, 5, 12, 13},
3130 {1, 7, 9, 15, 3, 5, 11, 13},
3131 {6, 4, 14, 12, 7, 5, 15, 13}
3133 for (
unsigned int i=0; i<5; ++i)
3134 for (
unsigned int j=0; j<8; ++j)
3135 cell_vertices[i+5][j] = cell_vertices[i][j]+8;
3137 std::vector<CellData<3> > cells (10,
CellData<3>());
3139 for (
unsigned int i=0; i<10; ++i)
3141 for (
unsigned int j=0; j<8; ++j)
3142 cells[i].vertices[j] = cell_vertices[i][j];
3143 cells[i].material_id = 0;
3147 std::vector<
Point<3> >(&vertices[0], &vertices[24]),
3164 for (; cell != end; ++cell)
3165 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3166 if (cell->at_boundary(i))
3168 if (cell->face(i)->center()(0) > half_length-1.e-5)
3170 cell->face(i)->set_boundary_id(2);
3172 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++
e)
3173 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
3174 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
3175 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
3176 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
3177 cell->face(i)->line(e)->set_boundary_id(2);
3179 else if (cell->face(i)->center()(0) < -half_length+1.e-5)
3181 cell->face(i)->set_boundary_id(1);
3183 for (
unsigned int e=0; e<GeometryInfo<3>::lines_per_face; ++
e)
3184 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
3185 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
3186 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
3187 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
3188 cell->face(i)->line(e)->set_boundary_id(1);
3198 const double radius)
3200 const unsigned int dim = 3;
3210 center+
Point<dim>(+1,+1,0) *(radius/(2*sqrt(2.0))),
3212 center+
Point<dim>(+1,+1,0) *(radius/std::sqrt(2.0)),
3214 center+
Point<dim>(+1,0,1) *radius/std::sqrt(2.0),
3215 center+
Point<dim>(+1,0,1) *(radius/(2*std::sqrt(2.0))),
3216 center+
Point<dim>(0,+1,1) *(radius/(2*std::sqrt(2.0))),
3217 center+
Point<dim>(+1,+1,1) *(radius/(2*std::sqrt(3.0))),
3218 center+
Point<dim>(0,+1,1) *radius/std::sqrt(2.0),
3219 center+
Point<dim>(+1,+1,1) *(radius/(std::sqrt(3.0))),
3222 const int cell_vertices[4][8]
3223 = {{0, 2, 3, 4, 7, 9, 10, 11},
3224 {1, 6, 2, 4, 8, 13, 9, 11},
3225 {5, 3, 6, 4, 12, 10, 13, 11},
3226 {7,9,10,11,14,8,12,13}
3231 for (
unsigned int i=0; i<4; ++i)
3233 for (
unsigned int j=0; j<8; ++j)
3234 cells[i].vertices[j] = cell_vertices[i][j];
3235 cells[i].material_id = 0;
3239 std::vector<
Point<dim> >(&vertices[0], &vertices[15]),
3248 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
3254 if (cell->face(i)->center()(0) < center(0)+1.e-5 * radius
3255 || cell->face(i)->center()(1) < center(1)+1.e-5 * radius
3256 || cell->face(i)->center()(2) < center(2)+1.e-5 * radius)
3258 cell->face(i)->set_boundary_id(1);
3261 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
3264 = { cell->face(i)->line(j)->vertex(0),
3265 cell->face(i)->line(j)->vertex(1)
3267 if ((std::fabs(line_vertices[0].distance(center)-radius) >
3270 (std::fabs(line_vertices[1].distance(center)-radius) >
3272 cell->face(i)->line(j)->set_boundary_id(1);
3287 const double radius)
3290 const double d = radius/std::sqrt(2.0);
3291 const double a =
d/(1+std::sqrt(2.0));
3293 const double b = a/2.0;
3294 const double c =
d/2.0;
3296 const double hb = radius*std::sqrt(3.0)/4.0;
3297 const double hc = radius*std::sqrt(3.0)/2.0;
3320 int cell_vertices[6][8] =
3322 {0, 1, 8, 9, 2, 3, 10, 11},
3323 {0, 2, 8, 10, 6, 4, 14, 12},
3324 {2, 3, 10, 11, 4, 5, 12, 13},
3325 {1, 7, 9, 15, 3, 5, 11, 13},
3326 {6, 4, 14, 12, 7, 5, 15, 13},
3327 {8, 10, 9, 11, 14, 12, 15, 13}
3330 std::vector<CellData<3> > cells (6,
CellData<3>());
3332 for (
unsigned int i=0; i<6; ++i)
3334 for (
unsigned int j=0; j<8; ++j)
3335 cells[i].vertices[j] = cell_vertices[i][j];
3336 cells[i].material_id = 0;
3340 std::vector<
Point<3> >(&vertices[0], &vertices[16]),
3354 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3356 if (!cell->at_boundary(i))
3362 if (cell->face(i)->center()(0) < center(0)+1.e-5*radius)
3364 cell->face(i)->set_boundary_id(1);
3365 for (
unsigned int j=0; j<GeometryInfo<3>::lines_per_face; ++j)
3368 = { cell->face(i)->line(j)->vertex(0),
3369 cell->face(i)->line(j)->vertex(1)
3371 if ((std::fabs(line_vertices[0].distance(center)-radius) >
3374 (std::fabs(line_vertices[1].distance(center)-radius) >
3376 cell->face(i)->line(j)->set_boundary_id(1);
3389 const double inner_radius,
3390 const double outer_radius,
3391 const unsigned int n_cells,
3392 const bool colorize)
3394 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3397 const unsigned int n = (n_cells==0) ? 6 : n_cells;
3399 const double irad = inner_radius/std::sqrt(3.0);
3400 const double orad = outer_radius/std::sqrt(3.0);
3401 std::vector<Point<3> > vertices;
3402 std::vector<CellData<3> > cells;
3408 for (
unsigned int i=0; i<8; ++i)
3409 vertices.push_back(p+hexahedron[i]*irad);
3410 for (
unsigned int i=0; i<8; ++i)
3411 vertices.push_back(p+hexahedron[i]*orad);
3413 const unsigned int n_cells = 6;
3414 const int cell_vertices[n_cells][8] =
3416 {8, 9, 10, 11, 0, 1, 2, 3},
3417 {9, 11, 1, 3, 13, 15, 5, 7},
3418 {12, 13, 4, 5, 14, 15, 6, 7},
3419 {8, 0, 10, 2, 12, 4, 14, 6},
3420 {8, 9, 0, 1, 12, 13, 4, 5},
3421 {10, 2, 11, 3, 14, 6, 15, 7}
3426 for (
unsigned int i=0; i<n_cells; ++i)
3428 for (
unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
3429 cells[i].vertices[j] = cell_vertices[i][j];
3430 cells[i].material_id = 0;
3440 for (
unsigned int i=0; i<8; ++i)
3441 vertices.push_back(p+hexahedron[i]*irad);
3442 for (
unsigned int i=0; i<6; ++i)
3443 vertices.push_back(p+octahedron[i]*inner_radius);
3444 for (
unsigned int i=0; i<8; ++i)
3445 vertices.push_back(p+hexahedron[i]*orad);
3446 for (
unsigned int i=0; i<6; ++i)
3447 vertices.push_back(p+octahedron[i]*outer_radius);
3449 const unsigned int n_cells = 12;
3450 const unsigned int rhombi[n_cells][4] =
3468 for (
unsigned int i=0; i<n_cells; ++i)
3470 for (
unsigned int j=0; j<4; ++j)
3472 cells[i].vertices[j ] = rhombi[i][j];
3473 cells[i].vertices[j+4] = rhombi[i][j] + 14;
3475 cells[i].material_id = 0;
3489 hyper_shell (tmp, p, inner_radius, outer_radius, 12);
3547 const double r = inner_radius / outer_radius;
3548 const double rho = 2*r/(1+r);
3552 const double middle_radius = rho * outer_radius;
3558 std::vector<bool> vertex_already_treated (tmp.
n_vertices(),
false);
3560 cell != tmp.
end(); ++cell)
3561 for (
unsigned int f=0; f<GeometryInfo<3>::faces_per_cell; ++f)
3562 if (cell->at_boundary(f))
3563 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_face; ++v)
3564 vertex_already_treated[cell->face(f)->vertex_index(v)] =
true;
3568 cell != tmp.
end(); ++cell)
3569 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
3570 if (vertex_already_treated[cell->vertex_index(v)] ==
false)
3581 const Tensor<1,3> old_distance = cell->vertex(v) - p;
3582 const double old_radius = cell->vertex(v).distance(p);
3583 cell->vertex(v) = p + old_distance * (middle_radius / old_radius);
3585 vertex_already_treated[cell->vertex_index(v)] =
true;
3592 cell != tmp.
end(); ++cell)
3594 const unsigned int cell_index = cell->active_cell_index();
3595 for (
unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
3596 cells[cell_index].vertices[v] = cell->vertex_index(v);
3597 cells[cell_index].material_id = 0;
3608 colorize_hyper_shell(tria, p, inner_radius, outer_radius);
3619 const double inner_radius,
3620 const double outer_radius,
3621 const unsigned int n,
3622 const bool colorize)
3624 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3630 const double d = outer_radius/std::sqrt(2.0);
3631 const double a = inner_radius/std::sqrt(2.0);
3633 const double b = a/2.0;
3634 const double c =
d/2.0;
3636 const double hb = inner_radius*std::sqrt(3.0)/2.0;
3637 const double hc = outer_radius*std::sqrt(3.0)/2.0;
3660 int cell_vertices[5][8] =
3662 {0, 1, 8, 9, 2, 3, 10, 11},
3663 {0, 2, 8, 10, 6, 4, 14, 12},
3664 {1, 7, 9, 15, 3, 5, 11, 13},
3665 {6, 4, 14, 12, 7, 5, 15, 13},
3666 {8, 10, 9, 11, 14, 12, 15, 13}
3669 std::vector<CellData<3> > cells (5,
CellData<3>());
3671 for (
unsigned int i=0; i<5; ++i)
3673 for (
unsigned int j=0; j<8; ++j)
3674 cells[i].vertices[j] = cell_vertices[i][j];
3675 cells[i].material_id = 0;
3679 std::vector<
Point<3> >(&vertices[0], &vertices[16]),
3693 for (; cell!=tria.
end(); ++cell)
3694 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3695 if (cell->at_boundary(i))
3696 cell->face(i)->set_all_boundary_ids(2);
3702 for (cell=tria.
begin(); cell!=tria.
end(); ++cell)
3703 for (
unsigned int i=0; i<GeometryInfo<3>::faces_per_cell; ++i)
3704 if (cell->at_boundary(i))
3709 const Point<3> face_center (face->center());
3710 if (std::abs(face_center(0)-center(0)) > 1.e-6 * face_center.
norm())
3712 if (std::abs((face_center-center).
norm()-inner_radius) <
3713 std::abs((face_center-center).
norm()-outer_radius))
3714 face->set_all_boundary_ids(0);
3716 face->set_all_boundary_ids(1);
3727 const double inner_radius,
3728 const double outer_radius,
3729 const unsigned int n,
3730 const bool colorize)
3732 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3734 if (n == 0 || n == 3)
3736 const double a = inner_radius*std::sqrt(2.0)/2e0;
3737 const double b = outer_radius*std::sqrt(2.0)/2e0;
3738 const double c = a*std::sqrt(3.0)/2e0;
3739 const double d =
b*std::sqrt(3.0)/2e0;
3740 const double e = outer_radius/2e0;
3741 const double h = inner_radius/2e0;
3743 std::vector<Point<3> > vertices;
3745 vertices.push_back (center+
Point<3>( 0, inner_radius, 0));
3746 vertices.push_back (center+
Point<3>( a, a, 0));
3747 vertices.push_back (center+
Point<3>( b, b, 0));
3748 vertices.push_back (center+
Point<3>( 0, outer_radius, 0));
3749 vertices.push_back (center+
Point<3>( 0, a , a));
3750 vertices.push_back (center+
Point<3>( c, c , h));
3751 vertices.push_back (center+
Point<3>( d, d , e));
3752 vertices.push_back (center+
Point<3>( 0, b , b));
3753 vertices.push_back (center+
Point<3>( inner_radius, 0 , 0));
3754 vertices.push_back (center+
Point<3>( outer_radius, 0 , 0));
3755 vertices.push_back (center+
Point<3>( a, 0 , a));
3756 vertices.push_back (center+
Point<3>( b, 0 , b));
3757 vertices.push_back (center+
Point<3>( 0, 0 , inner_radius));
3758 vertices.push_back (center+
Point<3>( 0, 0 , outer_radius));
3760 const int cell_vertices[3][8] =
3762 {0, 1, 3, 2, 4, 5, 7, 6},
3763 {1, 8, 2, 9, 5, 10, 6, 11},
3764 {4, 5, 7, 6, 12, 10, 13, 11},
3766 std::vector<CellData<3> > cells(3);
3768 for (
unsigned int i=0; i<3; ++i)
3770 for (
unsigned int j=0; j<8; ++j)
3771 cells[i].vertices[j] = cell_vertices[i][j];
3772 cells[i].material_id = 0;
3783 colorize_quarter_hyper_shell(tria, center, inner_radius, outer_radius);
3790 const double length,
3791 const double inner_radius,
3792 const double outer_radius,
3793 const unsigned int n_radial_cells,
3794 const unsigned int n_axial_cells)
3796 Assert ((inner_radius > 0) && (inner_radius < outer_radius),
3810 const unsigned int N_r = (n_radial_cells == 0 ?
3811 static_cast<unsigned int> 3812 (std::ceil((2*pi* (outer_radius + inner_radius)/2) /
3813 (outer_radius - inner_radius))) :
3815 const unsigned int N_z = (n_axial_cells == 0 ?
3816 static_cast<unsigned int> 3817 (std::ceil (length /
3818 (2*pi*(outer_radius + inner_radius)/2/N_r))) :
3827 std::vector<Point<2> > vertices_2d(2*N_r);
3828 for (
unsigned int i=0; i<N_r; ++i)
3830 vertices_2d[i] =
Point<2>( std::cos(2*pi * i/N_r),
3831 std::sin(2*pi * i/N_r)) * outer_radius;
3832 vertices_2d[i+N_r] = vertices_2d[i] * (inner_radius/outer_radius);
3835 std::vector<Point<3> > vertices_3d;
3836 vertices_3d.reserve (2*N_r*(N_z+1));
3837 for (
unsigned int j=0; j<=N_z; ++j)
3838 for (
unsigned int i=0; i<2*N_r; ++i)
3840 const Point<3> v (vertices_2d[i][0],
3843 vertices_3d.push_back (v);
3846 std::vector<CellData<3> > cells (N_r*N_z,
CellData<3>());
3848 for (
unsigned int j=0; j<N_z; ++j)
3849 for (
unsigned int i=0; i<N_r; ++i)
3851 cells[i+j*N_r].vertices[0] = i + (j+1)*2*N_r;
3852 cells[i+j*N_r].vertices[1] = (i+1)%N_r + (j+1)*2*N_r;
3853 cells[i+j*N_r].vertices[2] = i + j*2*N_r;
3854 cells[i+j*N_r].vertices[3] = (i+1)%N_r + j*2*N_r;
3856 cells[i+j*N_r].vertices[4] = N_r+i + (j+1)*2*N_r;
3857 cells[i+j*N_r].vertices[5] = N_r+((i+1)%N_r) + (j+1)*2*N_r;
3858 cells[i+j*N_r].vertices[6] = N_r+i + j*2*N_r;
3859 cells[i+j*N_r].vertices[7] = N_r+((i+1)%N_r) + j*2*N_r;
3861 cells[i+j*N_r].material_id = 0;
3870 template <
int dim,
int spacedim>
3877 ExcMessage (
"The input triangulations must be coarse meshes."));
3879 ExcMessage (
"The input triangulations must be coarse meshes."));
3882 std::vector<Point<spacedim> > vertices = triangulation_1.
get_vertices();
3883 vertices.insert (vertices.end(),
3888 std::vector<CellData<dim> > cells;
3889 cells.reserve (triangulation_1.
n_cells() + triangulation_2.
n_cells());
3891 cell = triangulation_1.
begin(); cell != triangulation_1.
end(); ++cell)
3894 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3895 this_cell.
vertices[v] = cell->vertex_index(v);
3897 cells.push_back (this_cell);
3903 cell = triangulation_2.
begin(); cell != triangulation_2.
end(); ++cell)
3906 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
3909 cells.push_back (this_cell);
3915 std::vector<unsigned int> considered_vertices;
3918 considered_vertices);
3928 template <
int dim,
int spacedim>
3935 ExcMessage (
"The two input triangulations are not derived from " 3936 "the same coarse mesh as required."));
3940 ExcMessage (
"The source triangulations for this function must both " 3941 "be available entirely locally, and not be distributed " 3942 "triangulations."));
3959 for (
unsigned int iteration=0; iteration<triangulation_2.
n_levels();
3965 bool any_cell_flagged =
false;
3968 result_cell != result.
end(); ++result_cell)
3969 if (intergrid_map[result_cell]->has_children())
3971 any_cell_flagged =
true;
3972 result_cell->set_refine_flag ();
3975 if (any_cell_flagged ==
false)
3984 template <
int dim,
int spacedim>
3992 std::vector<Point<spacedim> > vertices = input_triangulation.
get_vertices();
3996 std::vector<CellData<dim> > cells;
3998 cell = input_triangulation.
begin_active(); cell != input_triangulation.
end(); ++cell)
3999 if (cells_to_remove.find(cell) == cells_to_remove.end())
4001 Assert (static_cast<unsigned int>(cell->level()) == input_triangulation.
n_levels()-1,
4002 ExcMessage (
"Your input triangulation appears to have " 4003 "adaptively refined cells. This is not allowed. You can " 4004 "only call this function on a triangulation in which " 4005 "all cells are on the same refinement level."));
4008 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
4009 this_cell.
vertices[v] = cell->vertex_index(v);
4010 this_cell.material_id = cell->material_id();
4011 cells.push_back (this_cell);
4017 std::vector<unsigned int> considered_vertices;
4020 considered_vertices);
4031 const unsigned int n_slices,
4032 const double height,
4036 ExcMessage (
"The input triangulation must be a coarse mesh, i.e., it must " 4037 "not have been refined."));
4039 ExcMessage(
"The output triangulation object needs to be empty."));
4041 ExcMessage(
"The given height for extrusion must be positive."));
4043 ExcMessage(
"The number of slices for extrusion must be at least 2."));
4045 std::vector<Point<3> > points(n_slices*input.
n_vertices());
4046 std::vector<CellData<3> > cells;
4051 for (
unsigned int slice=0; slice<n_slices; ++slice)
4053 for (
unsigned int i=0; i<input.
n_vertices(); ++i)
4056 points[slice*input.
n_vertices()+i](0) = v(0);
4057 points[slice*input.
n_vertices()+i](1) = v(1);
4058 points[slice*input.
n_vertices()+i](2) = height * slice / (n_slices-1);
4065 cell = input.
begin(); cell != input.
end(); ++cell)
4067 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
4070 for (
unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v)
4073 = cell->vertex_index(v)+slice*input.
n_vertices();
4075 = cell->vertex_index(v)+(slice+1)*input.
n_vertices();
4079 cells.push_back(this_cell);
4091 cell = input.
begin(); cell != input.
end(); ++cell)
4094 for (
unsigned int f=0; f<4; ++f)
4095 if (cell->at_boundary(f)
4097 (cell->face(f)->boundary_id() != 0))
4100 max_boundary_id = std::max(max_boundary_id, quad.
boundary_id);
4101 for (
unsigned int slice=0; slice<n_slices-1; ++slice)
4118 ExcMessage (
"The input triangulation to this function is using boundary " 4119 "indicators in a range that do not allow using " 4120 "max_boundary_id+1 and max_boundary_id+2 as boundary " 4121 "indicators for the bottom and top faces of the " 4122 "extruded triangulation."));
4124 cell = input.
begin(); cell != input.
end(); ++cell)
4128 quad.
vertices[0] = cell->vertex_index(0);
4129 quad.
vertices[1] = cell->vertex_index(1);
4130 quad.
vertices[2] = cell->vertex_index(2);
4131 quad.
vertices[3] = cell->vertex_index(3);
4135 for (
int i=0; i<4; ++i)
4170 const double inner_radius,
4171 const double outer_radius,
4178 Assert(inner_radius < outer_radius,
4179 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
4184 center, inner_radius, outer_radius,
4188 endc = triangulation.
end();
4189 std::vector<bool> treated_vertices(triangulation.
n_vertices(),
false);
4190 for (; cell != endc; ++cell)
4192 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4193 if (cell->face(f)->at_boundary())
4195 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
4197 unsigned int vv = cell->face(f)->vertex_index(v);
4198 if (treated_vertices[vv] ==
false)
4200 treated_vertices[vv] =
true;
4204 cell->face(f)->vertex(v) = center+
Point<dim>(outer_radius,outer_radius);
4207 cell->face(f)->vertex(v) = center+
Point<dim>(-outer_radius,outer_radius);
4210 cell->face(f)->vertex(v) = center+
Point<dim>(-outer_radius,-outer_radius);
4213 cell->face(f)->vertex(v) = center+
Point<dim>(outer_radius,-outer_radius);
4221 double eps = 1
e-3 * outer_radius;
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);
4241 cell->face(f)->set_boundary_id(4);
4245 double d = (cell->face(f)->center() - center).
norm();
4246 if (d-inner_radius < 0)
4247 cell->face(f)->set_boundary_id(1);
4249 cell->face(f)->set_boundary_id(0);
4259 const double inner_radius,
4260 const double outer_radius,
4262 const unsigned int Nz,
4267 Assert(inner_radius < outer_radius,
4268 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
4270 ExcMessage(
"Must give positive extension L"));
4274 L, inner_radius, outer_radius,
4280 endc = triangulation.
end();
4281 std::vector<bool> treated_vertices(triangulation.
n_vertices(),
false);
4282 for (; cell != endc; ++cell)
4284 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4285 if (cell->face(f)->at_boundary())
4287 for (
unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v)
4289 unsigned int vv = cell->face(f)->vertex_index(v);
4290 if (treated_vertices[vv] ==
false)
4292 treated_vertices[vv] =
true;
4293 for (
unsigned int i=0; i<=Nz; ++i)
4295 double d = ((double) i)*L/((double) Nz);
4299 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,outer_radius,
d);
4302 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,outer_radius,
d);
4305 cell->face(f)->vertex(v) =
Point<dim>(-outer_radius,-outer_radius,
d);
4308 cell->face(f)->vertex(v) =
Point<dim>(outer_radius,-outer_radius,
d);
4318 double eps = 1
e-3 * outer_radius;
4320 for (; cell != endc; ++cell)
4322 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
4323 if (cell->face(f)->at_boundary())
4325 double dx = cell->face(f)->center()(0);
4326 double dy = cell->face(f)->center()(1);
4327 double dz = cell->face(f)->center()(2);
4331 if (std::abs(dx + outer_radius) <
eps)
4332 cell->face(f)->set_boundary_id(0);
4334 else if (std::abs(dx - outer_radius) < eps)
4335 cell->face(f)->set_boundary_id(1);
4337 else if (std::abs(dy + outer_radius) < eps)
4338 cell->face(f)->set_boundary_id(2);
4340 else if (std::abs(dy - outer_radius) < eps)
4341 cell->face(f)->set_boundary_id(3);
4343 else if (std::abs(dz) < eps)
4344 cell->face(f)->set_boundary_id(4);
4346 else if (std::abs(dz - L) < eps)
4347 cell->face(f)->set_boundary_id(5);
4351 cell->face(f)->set_boundary_id(6);
4352 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_face; ++
l)
4353 cell->face(f)->line(l)->set_boundary_id(6);
4361 double d = c.
norm();
4362 if (d-inner_radius < 0)
4364 cell->face(f)->set_boundary_id(1);
4365 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_face; ++
l)
4366 cell->face(f)->line(l)->set_boundary_id(1);
4369 cell->face(f)->set_boundary_id(0);
4375 template <
int dim,
int spacedim1,
int spacedim2>
4384 ExcMessage(
"Cannot use this function on parallel::distributed::Triangulation."));
4386 std::vector<Point<spacedim2> > v;
4387 std::vector<CellData<dim> > cells;
4390 const unsigned int spacedim = std::min(spacedim1,spacedim2);
4391 const std::vector<Point<spacedim1> > &in_vertices = in_tria.
get_vertices();
4393 v.resize(in_vertices.size());
4394 for (
unsigned int i=0; i<in_vertices.size(); ++i)
4395 for (
unsigned int d=0; d<spacedim; ++d)
4396 v[i][d] = in_vertices[i][d];
4401 endc = in_tria.
end();
4403 for (
unsigned int id=0; cell != endc; ++cell, ++id)
4405 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
4406 cells[
id].vertices[i] = cell->vertex_index(i);
4407 cells[id].material_id = cell->material_id();
4408 cells[id].manifold_id = cell->manifold_id();
4424 for (; face != endf; ++face)
4425 if (face->at_boundary())
4427 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4428 subcelldata.
boundary_lines[f].vertices[i] = face->vertex_index(i);
4439 for (; face != endf; ++face)
4440 if (face->at_boundary())
4442 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_face; ++i)
4443 subcelldata.
boundary_quads[f].vertices[i] = face->vertex_index(i);
4460 template <
template <
int,
int>
class MeshType,
int dim,
int spacedim>
4462 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4463 typename MeshType<dim,spacedim>::face_iterator>
4465 typename ExtractBoundaryMesh<MeshType,dim,spacedim>::return_type
4468 MeshType<dim-1,spacedim> &surface_mesh,
4469 const std::set<types::boundary_id> &boundary_ids)
4472 (&volume_mesh.get_triangulation())
4481 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
4482 typename MeshType<dim,spacedim>::face_iterator>
4483 surface_to_volume_mapping;
4485 const unsigned int boundary_dim = dim-1;
4489 std::vector<typename MeshType<dim,spacedim>::face_iterator>
4493 std::vector< bool > touched (volume_mesh.get_triangulation().n_vertices(),
false);
4494 std::vector< CellData< boundary_dim > > cells;
4496 std::vector< Point<spacedim> > vertices;
4498 std::map<unsigned int,unsigned int> map_vert_index;
4500 for (
typename MeshType<dim,spacedim>::cell_iterator
4501 cell = volume_mesh.
begin(0);
4502 cell != volume_mesh.
end(0);
4504 for (
unsigned int i=0; i < GeometryInfo<dim>::faces_per_cell; ++i)
4506 const typename MeshType<dim,spacedim>::face_iterator
4507 face = cell->face(i);
4509 if ( face->at_boundary()
4511 (boundary_ids.empty() ||
4512 ( boundary_ids.find(face->boundary_id()) != boundary_ids.end())) )
4516 for (
unsigned int j=0;
4517 j<GeometryInfo<boundary_dim>::vertices_per_cell; ++j)
4519 const unsigned int v_index = face->vertex_index(j);
4521 if ( !touched[v_index] )
4523 vertices.push_back(face->vertex(j));
4524 map_vert_index[v_index] = vertices.size() - 1;
4525 touched[v_index] =
true;
4528 c_data.
vertices[j] = map_vert_index[v_index];
4559 for (
unsigned int e=0; e<4; ++e)
4565 bool edge_found =
false;
4566 for (
unsigned int i=0; i<subcell_data.
boundary_lines.size(); ++i)
4568 == map_vert_index[face->line(e)->vertex_index(0)])
4571 == map_vert_index[face->line(e)->vertex_index(1)]))
4574 == map_vert_index[face->line(e)->vertex_index(1)])
4577 == map_vert_index[face->line(e)->vertex_index(0)])))
4582 if (edge_found ==
true)
4587 edge.
vertices[0] = map_vert_index[face->line(e)->vertex_index(0)];
4588 edge.
vertices[1] = map_vert_index[face->line(e)->vertex_index(1)];
4596 cells.push_back(c_data);
4597 mapping.push_back(face);
4603 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4604 .create_triangulation (vertices, cells, subcell_data);
4607 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4608 cell = surface_mesh.
begin(0);
4609 cell!=surface_mesh.
end(0); ++cell)
4610 surface_to_volume_mapping[cell] = mapping.at(cell->index());
4614 bool changed =
false;
4616 for (
typename MeshType<dim-1,spacedim>::active_cell_iterator
4618 if (surface_to_volume_mapping[cell]->has_children() == true )
4620 cell->set_refine_flag ();
4626 const_cast<Triangulation<dim-1,spacedim
>&>(surface_mesh.get_triangulation())
4627 .execute_coarsening_and_refinement();
4629 for (
typename MeshType<dim-1,spacedim>::cell_iterator
4630 surface_cell = surface_mesh.begin(); surface_cell!=surface_mesh.end(); ++surface_cell)
4631 for (
unsigned int c=0; c<surface_cell->n_children(); c++)
4632 if (surface_to_volume_mapping.find(surface_cell->child(c)) == surface_to_volume_mapping.end())
4633 surface_to_volume_mapping[surface_cell->child(c)]
4634 = surface_to_volume_mapping[surface_cell]->child(c);
4641 return surface_to_volume_mapping;
4653 const double radius);
4657 const double radius);
4659 #include "grid_generator.inst" 4661 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)
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
#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
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
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)
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)
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 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 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)
static ::ExceptionBase & ExcNotImplemented()
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)
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)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
unsigned int vertices[GeometryInfo< structdim >::vertices_per_cell]
static ::ExceptionBase & ExcInvalidRepetitions(int arg1)
static ::ExceptionBase & ExcInternalError()