Reference documentation for deal.II version Git adf7f9fdfe 2021-01-28 13:54:50 +0100
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
connectivity.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_tria_connectivity_h
17 #define dealii_tria_connectivity_h
18 
19 #include <deal.II/base/config.h>
20 
22 
25 
26 
28 
29 
30 namespace internal
31 {
32  namespace TriangulationImplementation
33  {
38  struct CellTypeBase
39  {
43  virtual ~CellTypeBase() = default;
44 
48  virtual unsigned int
49  n_entities(const unsigned int d) const
50  {
51  Assert(false, ExcNotImplemented());
52  (void)d;
53 
54  return 0;
55  }
56 
60  virtual ::ArrayView<const unsigned int>
61  vertices_of_entity(const unsigned int d, const unsigned int e) const
62  {
63  Assert(false, ExcNotImplemented());
64  (void)d;
65  (void)e;
66 
67  return {};
68  }
69 
73  virtual ReferenceCell::Type
74  type_of_entity(const unsigned int d, const unsigned int e) const
75  {
76  Assert(false, ExcNotImplemented());
77  (void)d;
78  (void)e;
79 
81  }
82 
86  virtual unsigned int
87  n_lines_of_surface(const unsigned int face) const
88  {
89  Assert(false, ExcNotImplemented());
90  (void)face;
91 
92  return 0;
93  }
94 
98  virtual unsigned int
99  nth_line_of_surface(const unsigned int line,
100  const unsigned int face) const
101  {
102  Assert(false, ExcNotImplemented());
103  (void)line;
104  (void)face;
105 
106  return 0;
107  }
108 
112  virtual const std::array<unsigned int, 2> &
113  vertices_of_nth_line_of_surface(const unsigned int line,
114  const unsigned int face) const
115  {
116  Assert(false, ExcNotImplemented());
117  (void)line;
118  (void)face;
119 
120  const static std::array<unsigned int, 2> table = {};
121 
122  return table;
123  }
124  };
125 
126 
127 
131  struct CellTypeLine : public CellTypeBase
132  {
134  vertices_of_entity(const unsigned int d,
135  const unsigned int e) const override
136  {
137  (void)e;
138 
139  if (d == 1)
140  {
141  static const std::array<unsigned int, 2> table = {{0, 1}};
142 
143  AssertDimension(e, 0);
144 
145  return {table};
146  }
147 
148  Assert(false, ExcNotImplemented());
149 
150  return {};
151  }
152 
154  type_of_entity(const unsigned int d, const unsigned int e) const override
155  {
156  (void)e;
157 
158  if (d == 1)
160 
161  Assert(false, ExcNotImplemented());
162 
164  }
165 
166  unsigned int
167  n_entities(const unsigned int d) const override
168  {
169  static std::array<unsigned int, 2> table = {{2, 1}};
170  return table[d];
171  }
172  };
173 
174 
175 
179  struct CellTypeTri : public CellTypeBase
180  {
182  vertices_of_entity(const unsigned int d,
183  const unsigned int e) const override
184  {
185  if (d == 2)
186  {
187  static const std::array<unsigned int, 3> table = {{0, 1, 2}};
188 
189  AssertDimension(e, 0);
190 
191  return {table};
192  }
193 
194  if (d == 1)
195  {
196  static const std::array<std::array<unsigned int, 2>, 3> table = {
197  {{{0, 1}}, {{1, 2}}, {{2, 0}}}};
198 
199  return {table[e]};
200  }
201 
202  Assert(false, ExcNotImplemented());
203 
204  return {};
205  }
206 
207  virtual ReferenceCell::Type
208  type_of_entity(const unsigned int d, const unsigned int e) const override
209  {
210  (void)e;
211 
212  if (d == 2)
214 
215  if (d == 1)
217 
218  Assert(false, ExcNotImplemented());
219 
221  }
222 
223  unsigned int
224  n_entities(const unsigned int d) const override
225  {
226  static std::array<unsigned int, 3> table = {{3, 3, 1}};
227  return table[d];
228  }
229  };
230 
231 
232 
236  struct CellTypeQuad : public CellTypeBase
237  {
239  vertices_of_entity(const unsigned int d,
240  const unsigned int e) const override
241  {
242  if (d == 2)
243  {
244  static const std::array<unsigned int, 4> table = {{0, 1, 2, 3}};
245 
246  AssertDimension(e, 0);
247 
248  return {table};
249  }
250 
251  if (d == 1)
252  {
253  static const std::array<std::array<unsigned int, 2>, 4> table = {
254  {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
255 
256  return {table[e]};
257  }
258 
259  Assert(false, ExcNotImplemented());
260 
261  return {};
262  }
263 
264  virtual ReferenceCell::Type
265  type_of_entity(const unsigned int d, const unsigned int e) const override
266  {
267  (void)e;
268 
269  if (d == 2)
271 
272  if (d == 1)
274 
275  Assert(false, ExcNotImplemented());
276 
278  }
279 
280  unsigned int
281  n_entities(const unsigned int d) const override
282  {
283  static std::array<unsigned int, 3> table = {{4, 4, 1}};
284  return table[d];
285  }
286  };
287 
288 
289 
293  struct CellTypeTet : public CellTypeBase
294  {
296  vertices_of_entity(const unsigned int d,
297  const unsigned int e) const override
298  {
299  if (d == 3)
300  {
301  static const std::array<unsigned int, 4> table = {{0, 1, 2, 3}};
302 
303  AssertDimension(e, 0);
304 
305  return {table};
306  }
307 
308  if (d == 2)
309  {
310  static const std::array<std::array<unsigned int, 3>, 4> table = {
311  {{{0, 1, 2}}, {{1, 0, 3}}, {{0, 2, 3}}, {{2, 1, 3}}}};
312 
313  return {table[e]};
314  }
315 
316  if (d == 1)
317  {
318  static const std::array<std::array<unsigned int, 2>, 6> table = {
319  {{{0, 1}}, {{1, 2}}, {{2, 0}}, {{0, 3}}, {{1, 3}}, {{2, 3}}}};
320 
321  return {table[e]};
322  }
323 
324  Assert(false, ExcNotImplemented());
325 
326  return {};
327  }
328 
329  virtual ReferenceCell::Type
330  type_of_entity(const unsigned int d, const unsigned int e) const override
331  {
332  (void)e;
333 
334  if (d == 3)
336 
337  if (d == 2)
339 
340  if (d == 1)
342 
343  Assert(false, ExcNotImplemented());
344 
346  }
347 
348  unsigned int
349  n_entities(const unsigned int d) const override
350  {
351  static std::array<unsigned int, 4> table = {{4, 6, 4, 1}};
352  return table[d];
353  }
354 
355  unsigned int
356  n_lines_of_surface(const unsigned int line) const override
357  {
358  (void)line;
359  return 3;
360  }
361 
362  unsigned int
363  nth_line_of_surface(const unsigned int line,
364  const unsigned int face) const override
365  {
366  const static std::array<std::array<unsigned int, 3>, 4> table = {
367  {{{0, 1, 2}}, {{0, 3, 4}}, {{2, 5, 3}}, {{1, 4, 5}}}};
368 
369  return table[face][line];
370  }
371 
372  const std::array<unsigned int, 2> &
373  vertices_of_nth_line_of_surface(const unsigned int line,
374  const unsigned int face) const override
375  {
376  const static std::array<std::array<std::array<unsigned int, 2>, 3>, 4>
377  table = {{{{{{0, 1}}, {{1, 2}}, {{2, 0}}}},
378  {{{{1, 0}}, {{0, 3}}, {{3, 1}}}},
379  {{{{0, 2}}, {{2, 3}}, {{3, 0}}}},
380  {{{{2, 1}}, {{1, 3}}, {{3, 2}}}}}};
381 
382  return table[face][line];
383  }
384  };
385 
386 
392  {
394  vertices_of_entity(const unsigned int d,
395  const unsigned int e) const override
396  {
397  if (d == 3)
398  {
399  static const std::array<unsigned int, 5> table = {{0, 1, 2, 3, 4}};
400 
401  AssertDimension(e, 0);
402 
403  return {table};
404  }
405 
406  if (d == 2)
407  {
408  if (e == 0)
409  {
410  static const std::array<unsigned int, 4> table = {{0, 1, 2, 3}};
411  return {table};
412  }
413 
414  static const std::array<std::array<unsigned int, 3>, 4> table = {
415  {{{0, 2, 4}}, {{3, 1, 4}}, {{1, 0, 4}}, {{2, 3, 4}}}};
416 
417  return {table[e - 1]};
418  }
419 
420  if (d == 1)
421  {
422  static const std::array<std::array<unsigned int, 2>, 8> table = {
423  {{{0, 2}},
424  {{1, 3}},
425  {{0, 1}},
426  {{2, 3}},
427  {{0, 4}},
428  {{1, 4}},
429  {{2, 4}},
430  {{3, 4}}}};
431 
432  return {table[e]};
433  }
434 
435  Assert(false, ExcNotImplemented());
436 
437  return {};
438  }
439 
440  virtual ReferenceCell::Type
441  type_of_entity(const unsigned int d, const unsigned int e) const override
442  {
443  (void)e;
444 
445  if (d == 3)
447 
448  if (d == 2 && e == 0)
450  else if (d == 2)
452 
453  if (d == 1)
455 
456  Assert(false, ExcNotImplemented());
457 
459  }
460 
461  unsigned int
462  n_entities(const unsigned int d) const override
463  {
464  static std::array<unsigned int, 4> table = {{5, 8, 5, 1}};
465  return table[d];
466  }
467 
468  unsigned int
469  n_lines_of_surface(const unsigned int surface) const override
470  {
471  if (surface == 0)
472  return 4;
473 
474  return 3;
475  }
476 
477  unsigned int
478  nth_line_of_surface(const unsigned int line,
479  const unsigned int face) const override
480  {
481  const static std::array<std::array<unsigned int, 4>, 5> table = {
482  {{{0, 1, 2, 3}},
483  {{0, 6, 4, numbers::invalid_unsigned_int}},
484  {{1, 5, 7, numbers::invalid_unsigned_int}},
485  {{2, 4, 5, numbers::invalid_unsigned_int}},
486  {{3, 7, 6, numbers::invalid_unsigned_int}}}};
487 
488  return table[face][line];
489  }
490 
491  const std::array<unsigned int, 2> &
492  vertices_of_nth_line_of_surface(const unsigned int line,
493  const unsigned int face) const override
494  {
495  static const unsigned int X = static_cast<unsigned int>(-1);
496 
497  const static std::array<std::array<std::array<unsigned int, 2>, 4>, 5>
498  table = {{{{{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}},
499  {{{{0, 2}}, {{2, 4}}, {{4, 0}}, {{X, X}}}},
500  {{{{3, 1}}, {{1, 4}}, {{4, 3}}, {{X, X}}}},
501  {{{{1, 0}}, {{0, 4}}, {{4, 1}}, {{X, X}}}},
502  {{{{2, 3}}, {{3, 4}}, {{4, 2}}, {{X, X}}}}}};
503 
504  return table[face][line];
505  }
506  };
507 
508 
509 
513  struct CellTypeWedge : public CellTypeBase
514  {
516  vertices_of_entity(const unsigned int d,
517  const unsigned int e) const override
518  {
519  if (d == 3)
520  {
521  static const std::array<unsigned int, 6> table = {
522  {0, 1, 2, 3, 4, 5}};
523 
524  AssertDimension(e, 0);
525 
526  return {table};
527  }
528 
529  if (d == 2)
530  {
531  if (e == 0 || e == 1)
532  {
533  static const std::array<std::array<unsigned int, 3>, 2> table =
534  {{{{1, 0, 2}}, {{3, 4, 5}}}};
535 
536  return {table[e]};
537  }
538 
539  static const std::array<std::array<unsigned int, 4>, 3> table = {
540  {{{0, 1, 3, 4}}, {{1, 2, 4, 5}}, {{2, 0, 5, 3}}}};
541 
542  return {table[e - 2]};
543  }
544 
545  if (d == 1)
546  {
547  static const std::array<std::array<unsigned int, 2>, 9> table = {
548  {{{0, 1}},
549  {{1, 2}},
550  {{2, 0}},
551  {{3, 4}},
552  {{4, 5}},
553  {{5, 3}},
554  {{0, 3}},
555  {{1, 4}},
556  {{2, 5}}}};
557 
558  return {table[e]};
559  }
560 
561  Assert(false, ExcNotImplemented());
562 
563  return {};
564  }
565 
566  virtual ReferenceCell::Type
567  type_of_entity(const unsigned int d, const unsigned int e) const override
568  {
569  (void)e;
570 
571  if (d == 3)
573 
574  if (d == 2 && e > 1)
576  else if (d == 2)
578 
579  if (d == 1)
581 
582  Assert(false, ExcNotImplemented());
583 
585  }
586 
587  unsigned int
588  n_entities(const unsigned int d) const override
589  {
590  static std::array<unsigned int, 4> table = {{6, 9, 5, 1}};
591  return table[d];
592  }
593 
594  unsigned int
595  n_lines_of_surface(const unsigned int surface) const override
596  {
597  if (surface > 1)
598  return 4;
599 
600  return 3;
601  }
602 
603  unsigned int
604  nth_line_of_surface(const unsigned int line,
605  const unsigned int face) const override
606  {
607  static const unsigned int X = static_cast<unsigned int>(-1);
608 
609  const static std::array<std::array<unsigned int, 4>, 5> table = {
610  {{{0, 2, 1, X}},
611  {{3, 4, 5, X}},
612  {{6, 7, 0, 3}},
613  {{7, 8, 1, 4}},
614  {{8, 6, 5, 2}}}};
615 
616  return table[face][line];
617  }
618 
619  const std::array<unsigned int, 2> &
620  vertices_of_nth_line_of_surface(const unsigned int line,
621  const unsigned int face) const override
622  {
623  static const unsigned int X = static_cast<unsigned int>(-1);
624 
625  const static std::array<std::array<std::array<unsigned int, 2>, 4>, 5>
626  table = {{{{{{1, 0}}, {{0, 2}}, {{2, 1}}, {{X, X}}}},
627  {{{{3, 4}}, {{4, 5}}, {{5, 3}}, {{X, X}}}},
628  {{{{0, 3}}, {{1, 4}}, {{0, 1}}, {{3, 4}}}},
629  {{{{1, 4}}, {{2, 5}}, {{1, 2}}, {{4, 5}}}},
630  {{{{2, 5}}, {{0, 3}}, {{2, 0}}, {{5, 3}}}}}};
631 
632  return table[face][line];
633  }
634  };
635 
636 
637 
641  struct CellTypeHex : public CellTypeBase
642  {
644  vertices_of_entity(const unsigned int d,
645  const unsigned int e) const override
646  {
647  if (d == 3)
648  {
649  static const std::array<unsigned int, 8> table = {
650  {0, 1, 2, 3, 4, 5, 6, 7}};
651 
652  AssertDimension(e, 0);
653 
654  return {table};
655  }
656 
657  if (d == 2)
658  {
659  static const std::array<std::array<unsigned int, 4>, 6> table = {
660  {{{0, 2, 4, 6}},
661  {{1, 3, 5, 7}},
662  {{0, 4, 1, 5}},
663  {{2, 6, 3, 7}},
664  {{0, 1, 2, 3}},
665  {{4, 5, 6, 7}}}};
666 
667  return {table[e]};
668  }
669 
670  if (d == 1)
671  {
672  static const std::array<std::array<unsigned int, 2>, 12> table = {
673  {{{0, 2}},
674  {{1, 3}},
675  {{0, 1}},
676  {{2, 3}},
677  {{4, 6}},
678  {{5, 7}},
679  {{4, 5}},
680  {{6, 7}},
681  {{0, 4}},
682  {{1, 5}},
683  {{2, 6}},
684  {{3, 7}}}};
685 
686  return {table[e]};
687  }
688 
689  Assert(false, ExcNotImplemented());
690 
691  return {};
692  }
693 
694  virtual ReferenceCell::Type
695  type_of_entity(const unsigned int d, const unsigned int e) const override
696  {
697  (void)e;
698 
699  if (d == 3)
701 
702  if (d == 2)
704 
705  if (d == 1)
707 
708  Assert(false, ExcNotImplemented());
709 
711  }
712 
713  unsigned int
714  n_entities(const unsigned int d) const override
715  {
716  static std::array<unsigned int, 4> table = {{8, 12, 6, 1}};
717  return table[d];
718  }
719 
720  unsigned int
721  n_lines_of_surface(const unsigned int surface) const override
722  {
723  (void)surface;
724  return 4;
725  }
726 
727  unsigned int
728  nth_line_of_surface(const unsigned int line,
729  const unsigned int face) const override
730  {
731  const static std::array<std::array<unsigned int, 4>, 6> table = {
732  {{{8, 10, 0, 4}},
733  {{9, 11, 1, 5}},
734  {{2, 6, 8, 9}},
735  {{3, 7, 10, 11}},
736  {{0, 1, 2, 3}},
737  {{4, 5, 6, 7}}}};
738 
739  return table[face][line];
740  }
741 
742  const std::array<unsigned int, 2> &
743  vertices_of_nth_line_of_surface(const unsigned int line,
744  const unsigned int face) const override
745  {
746  const static std::array<std::array<std::array<unsigned int, 2>, 4>, 6>
747  table = {{{{{{0, 4}}, {{2, 6}}, {{0, 2}}, {{4, 6}}}},
748  {{{{1, 5}}, {{3, 7}}, {{1, 3}}, {{5, 7}}}},
749  {{{{0, 1}}, {{4, 5}}, {{0, 4}}, {{1, 5}}}},
750  {{{{2, 3}}, {{6, 7}}, {{2, 6}}, {{3, 7}}}},
751  {{{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}},
752  {{{{4, 6}}, {{5, 7}}, {{4, 5}}, {{6, 7}}}}}};
753 
754  return table[face][line];
755  }
756  };
757 
758 
759 
766  template <typename T = unsigned int>
767  struct CRS
768  {
772  CRS()
773  : ptr{0} {};
774 
778  CRS(const std::vector<std::size_t> &ptr, const std::vector<T> &col)
779  : ptr(ptr)
780  , col(col)
781  {}
782 
783  // row index
784  std::vector<std::size_t> ptr;
785 
786  // column index
787  std::vector<T> col;
788  };
789 
790 
791 
820  template <typename T = unsigned int>
822  {
823  Connectivity(const unsigned int dim,
824  const std::vector<ReferenceCell::Type> &cell_types)
825  : dim(dim)
826  , cell_types(cell_types)
827  {}
828 
829  inline std::vector<unsigned char> &
830  entity_orientations(const unsigned int structdim)
831  {
832  if (structdim == 1)
833  return line_orientation;
834 
835  AssertDimension(structdim, 2);
836 
837  return quad_orientation;
838  }
839 
840  inline const std::vector<unsigned char> &
841  entity_orientations(const unsigned int structdim) const
842  {
843  if (structdim == 1)
844  return line_orientation;
845 
846  AssertDimension(structdim, 2);
847 
848  return quad_orientation;
849  }
850 
851  inline std::vector<ReferenceCell::Type> &
852  entity_types(const unsigned int structdim)
853  {
854  if (structdim == dim)
855  return cell_types;
856 
857  // for vertices/lines the entity types are clear (0/1)
858  AssertDimension(structdim, 2);
859  AssertDimension(dim, 3);
860 
861  return quad_types;
862  }
863 
864  inline const std::vector<ReferenceCell::Type> &
865  entity_types(const unsigned int structdim) const
866  {
867  if (structdim == dim)
868  return cell_types;
869 
870  // for vertices/lines the entity types are clear (0/1)
871  AssertDimension(structdim, 2);
872  AssertDimension(dim, 3);
873 
874  return quad_types;
875  }
876 
877  inline CRS<T> &
878  entity_to_entities(const unsigned int from, const unsigned int to)
879  {
880  if (from == dim && to == dim)
881  return neighbors;
882  else if (from == dim && to == dim - 1)
883  return cell_entities;
884  else if (dim == 3 && from == 2 && to == 0)
885  return quad_vertices;
886  else if (dim == 3 && from == 2 && to == 1)
887  return quad_lines;
888  else if (from == 1 && to == 0)
889  return line_vertices;
890 
891  Assert(false, ExcNotImplemented());
892 
893  return cell_entities;
894  }
895 
896  inline const CRS<T> &
897  entity_to_entities(const unsigned int from, const unsigned int to) const
898  {
899  if (from == dim && to == dim)
900  return neighbors;
901  else if (from == dim && to == dim - 1)
902  return cell_entities;
903  else if (dim == 3 && from == 2 && to == 0)
904  return quad_vertices;
905  else if (dim == 3 && from == 2 && to == 1)
906  return quad_lines;
907  else if (from == 1 && to == 0)
908  return line_vertices;
909 
910  Assert(false, ExcNotImplemented());
911 
912  return cell_entities;
913  }
914 
915  private:
916  const unsigned int dim;
917  std::vector<ReferenceCell::Type> cell_types;
918 
920 
921  std::vector<unsigned char> line_orientation;
922 
925 
926  std::vector<unsigned char> quad_orientation;
927 
930 
931  std::vector<ReferenceCell::Type> quad_types;
932  };
933 
934 
935 
943  template <typename T>
944  void
945  determine_neighbors(const CRS<T> &con_cf, CRS<T> &con_cc)
946  {
947  const auto &col_cf = con_cf.col;
948  const auto &ptr_cf = con_cf.ptr;
949 
950  auto &col_cc = con_cc.col;
951  auto &ptr_cc = con_cc.ptr;
952 
953  const unsigned int n_faces =
954  *std::max_element(col_cf.begin(), col_cf.end()) + 1;
955 
956  // clear and initialize with -1 (assume that all faces are at the
957  // boundary)
958  col_cc = std::vector<T>(col_cf.size(), -1);
959  ptr_cc = ptr_cf;
960 
961  std::vector<std::pair<T, unsigned int>> neighbors(n_faces, {-1, -1});
962 
963  // loop over all cells
964  for (unsigned int i_0 = 0; i_0 < ptr_cf.size() - 1; i_0++)
965  {
966  // ... and all its faces
967  for (std::size_t j_0 = ptr_cf[i_0]; j_0 < ptr_cf[i_0 + 1]; j_0++)
968  {
969  if (neighbors[col_cf[j_0]].first == static_cast<unsigned int>(-1))
970  {
971  // face is visited the first time -> save the visiting cell
972  // and the face pointer
973  neighbors[col_cf[j_0]] = std::pair<T, unsigned int>(i_0, j_0);
974  }
975  else
976  {
977  // face is visited the second time -> now we know the cells
978  // on both sides of the face and we can determine for both
979  // cells the neigbor
980  col_cc[j_0] = neighbors[col_cf[j_0]].first;
981  col_cc[neighbors[col_cf[j_0]].second] = i_0;
982  }
983  }
984  }
985  }
986 
987 
988 
996  template <int key_length, typename FU>
997  void
999  const unsigned int d,
1000  const std::vector<std::shared_ptr<CellTypeBase>> &cell_types,
1001  const std::vector<ReferenceCell::Type> & cell_types_index,
1002  const CRS<unsigned int> & crs,
1003  CRS<unsigned int> & crs_d, // result
1004  CRS<unsigned int> & crs_0, // result
1005  std::vector<unsigned char> & orientations, // result
1006  const FU & second_key_function)
1007  {
1008  const bool compatibility_mode = true;
1009 
1010  const std::vector<std::size_t> & cell_ptr = crs.ptr;
1011  const std::vector<unsigned int> &cell_vertices = crs.col;
1012  std::vector<std::size_t> & ptr_d = crs_d.ptr;
1013  std::vector<unsigned int> & col_d = crs_d.col;
1014 
1015  // note: we do not pre-allocate memory for these arrays because it turned
1016  // out that counting unique entities is more expensive than push_back().
1017  std::vector<std::size_t> & ptr_0 = crs_0.ptr;
1018  std::vector<unsigned int> &col_0 = crs_0.col;
1019 
1020  // clear
1021  ptr_0 = {};
1022  col_0 = {};
1023 
1024  unsigned int n_entities = 0;
1025 
1026  for (const auto &c : cell_types_index)
1027  n_entities +=
1028  cell_types[static_cast<types::geometric_entity_type>(c)]->n_entities(
1029  d);
1030 
1031  // step 1: store each d-dimensional entity of a cell (described by their
1032  // vertices) into a vector and create a key for them
1033  //
1034  // note: it turned out to be more efficient to have a vector of tuples
1035  // than to have two vectors (sorting becomes inefficient)
1036  std::vector<
1037  std::tuple<std::array<unsigned int, key_length>, unsigned int>>
1038  keys; // key (sorted vertices), cell-entity index
1039 
1040  std::vector<std::array<unsigned int, key_length>> ad_entity_vertices;
1041  std::vector<ReferenceCell::Type> ad_entity_types;
1042  std::vector<std::array<unsigned int, key_length>> ad_compatibility;
1043 
1044  keys.reserve(n_entities);
1045  ad_entity_vertices.reserve(n_entities);
1046  ad_entity_types.reserve(n_entities);
1047  ad_compatibility.reserve(n_entities);
1048 
1049  ptr_d.resize(cell_types_index.size() + 1);
1050  ptr_d[0] = 0;
1051 
1052  static const unsigned int offset = 1;
1053 
1054  // loop over all cells
1055  for (unsigned int c = 0, counter = 0; c < cell_types_index.size(); c++)
1056  {
1057  const auto &cell_type =
1058  cell_types[static_cast<types::geometric_entity_type>(
1059  cell_types_index[c])];
1060  ptr_d[c + 1] = ptr_d[c] + cell_type->n_entities(d);
1061 
1062  // ... collect vertices of cell
1063  const ::ArrayView<const unsigned int> cell_vertice(
1064  cell_vertices.data() + cell_ptr[c], cell_ptr[c + 1] - cell_ptr[c]);
1065 
1066  // ... loop over all its entities
1067  for (unsigned int e = 0; e < cell_type->n_entities(d); e++)
1068  {
1069  // ... determine global entity vertices
1070  const auto &local_entity_vertices =
1071  cell_type->vertices_of_entity(d, e);
1072 
1073  std::array<unsigned int, key_length> entity_vertices;
1074  std::fill(entity_vertices.begin(), entity_vertices.end(), 0);
1075 
1076  for (unsigned int i = 0; i < local_entity_vertices.size(); i++)
1077  entity_vertices[i] =
1078  cell_vertice[local_entity_vertices[i]] + offset;
1079 
1080  // ... create key
1081  std::array<unsigned int, key_length> key = entity_vertices;
1082  std::sort(key.begin(), key.end());
1083  keys.emplace_back(key, counter++);
1084 
1085  ad_entity_vertices.emplace_back(entity_vertices);
1086 
1087  ad_entity_types.emplace_back(cell_type->type_of_entity(d, e));
1088 
1089  if (compatibility_mode)
1090  ad_compatibility.emplace_back(
1091  second_key_function(entity_vertices, cell_type, c, e));
1092  }
1093  }
1094 
1095  col_d.resize(keys.size());
1096  orientations.resize(keys.size());
1097 
1098  // step 2: sort according to key so that entities with same key can be
1099  // merged
1100  std::sort(keys.begin(), keys.end());
1101 
1102 
1103  if (compatibility_mode)
1104  {
1105  unsigned int n_unique_entities = 0;
1106  unsigned int n_unique_entity_vertices = 0;
1107 
1108  std::array<unsigned int, key_length> ref_key, new_key;
1109  std::fill(ref_key.begin(), ref_key.end(), 0);
1110  for (unsigned int i = 0; i < keys.size(); ++i)
1111  {
1112  const auto offset_i = std::get<1>(keys[i]);
1113 
1114  if (ref_key != std::get<0>(keys[i]))
1115  {
1116  ref_key = std::get<0>(keys[i]);
1117 
1118  n_unique_entities++;
1119  n_unique_entity_vertices +=
1120  cell_types[static_cast<types::geometric_entity_type>(
1121  ad_entity_types[offset_i])]
1122  ->n_entities(0);
1123 
1124  new_key = ad_compatibility[offset_i];
1125  }
1126 
1127  std::get<0>(keys[i]) = new_key;
1128  }
1129 
1130  std::sort(keys.begin(), keys.end());
1131 
1132  ptr_0.reserve(n_unique_entities);
1133  col_0.reserve(n_unique_entity_vertices);
1134  }
1135 
1136 
1137  std::array<unsigned int, key_length> ref_key;
1138  std::array<unsigned int, key_length> ref_indices;
1139  std::fill(ref_key.begin(), ref_key.end(), 0);
1140 
1141  for (unsigned int i = 0, counter = ::numbers::invalid_unsigned_int;
1142  i < keys.size();
1143  i++)
1144  {
1145  const auto offset_i = std::get<1>(keys[i]);
1146 
1147  if (ref_key != std::get<0>(keys[i]))
1148  {
1149  // new key
1150  counter++;
1151  ref_key = std::get<0>(keys[i]);
1152  ref_indices = ad_entity_vertices[offset_i];
1153 
1154  ptr_0.push_back(col_0.size());
1155  for (const auto j : ad_entity_vertices[offset_i])
1156  if (j != 0)
1157  col_0.push_back(j - offset);
1158 
1159  // take its orientation as default
1160  col_d[offset_i] = counter;
1161  orientations[offset_i] = 1;
1162  }
1163  else
1164  {
1165  col_d[offset_i] = counter;
1166  orientations[offset_i] =
1167  ad_entity_types[offset_i].compute_orientation(
1168  ad_entity_vertices[offset_i], ref_indices);
1169  }
1170  }
1171  ptr_0.push_back(col_0.size());
1172  }
1173 
1174 
1175 
1180  template <typename FU>
1181  void
1182  build_entity(const unsigned int d,
1183  const std::vector<std::shared_ptr<CellTypeBase>> &cell_types,
1184  const std::vector<ReferenceCell::Type> &cell_types_index,
1185  const CRS<unsigned int> & crs,
1186  CRS<unsigned int> & crs_d,
1187  CRS<unsigned int> & crs_0,
1188  std::vector<unsigned char> & orientations,
1189  const FU & second_key_function)
1190  {
1191  std::size_t key_length = 0;
1192 
1193  for (const auto &c : cell_types_index)
1194  {
1195  const auto &cell_type =
1196  cell_types[static_cast<types::geometric_entity_type>(c)];
1197  for (unsigned int e = 0; e < cell_type->n_entities(d); e++)
1198  key_length =
1199  std::max(key_length, cell_type->vertices_of_entity(d, e).size());
1200  }
1201 
1202  if (key_length == 2)
1203  build_entity_templated<2>(d,
1204  cell_types,
1205  cell_types_index,
1206  crs,
1207  crs_d,
1208  crs_0,
1209  orientations,
1210  second_key_function);
1211  else if (key_length == 3)
1212  build_entity_templated<3>(d,
1213  cell_types,
1214  cell_types_index,
1215  crs,
1216  crs_d,
1217  crs_0,
1218  orientations,
1219  second_key_function);
1220  else if (key_length == 4)
1221  build_entity_templated<4>(d,
1222  cell_types,
1223  cell_types_index,
1224  crs,
1225  crs_d,
1226  crs_0,
1227  orientations,
1228  second_key_function);
1229  else
1231  }
1232 
1233 
1234 
1242  void
1244  const std::vector<std::shared_ptr<CellTypeBase>> &cell_types,
1245  const std::vector<ReferenceCell::Type> & cell_types_index,
1246  const CRS<unsigned int> & con_cv,
1247  const CRS<unsigned int> & con_cl,
1248  const CRS<unsigned int> & con_lv,
1249  const CRS<unsigned int> & con_cq,
1250  const CRS<unsigned int> & con_qv,
1251  const std::vector<unsigned char> & ori_cq,
1252  CRS<unsigned int> & con_ql, // result
1253  std::vector<unsigned char> & ori_ql, // result
1254  std::vector<ReferenceCell::Type> & quad_t_id // result
1255  )
1256  {
1257  // reset output
1258  ori_ql = {};
1259  con_ql.ptr = {};
1260  con_ql.col = {};
1261 
1262  con_ql.ptr.resize(con_qv.ptr.size());
1263  con_ql.ptr[0] = 0;
1264 
1265  quad_t_id.resize(con_qv.ptr.size() - 1);
1266 
1267  // count the number of lines of each face
1268  for (unsigned int c = 0; c < con_cq.ptr.size() - 1; ++c)
1269  {
1270  const auto &cell_type =
1271  cell_types[static_cast<types::geometric_entity_type>(
1272  cell_types_index[c])];
1273 
1274  // loop over faces
1275  for (unsigned int f_ = con_cq.ptr[c], f_index = 0;
1276  f_ < con_cq.ptr[c + 1];
1277  ++f_, ++f_index)
1278  {
1279  const unsigned int f = con_cq.col[f_];
1280 
1281  con_ql.ptr[f + 1] = cell_type->n_lines_of_surface(f_index);
1282  }
1283  }
1284 
1285  // use the counts to determine the offsets -> prefix sum
1286  for (unsigned int i = 0; i < con_ql.ptr.size() - 1; ++i)
1287  con_ql.ptr[i + 1] += con_ql.ptr[i];
1288 
1289  // allocate memory
1290  con_ql.col.resize(con_ql.ptr.back());
1291  ori_ql.resize(con_ql.ptr.back());
1292 
1293  // loop over cells
1294  for (unsigned int c = 0; c < con_cq.ptr.size() - 1; ++c)
1295  {
1296  const auto &cell_type =
1297  cell_types[static_cast<types::geometric_entity_type>(
1298  cell_types_index[c])];
1299 
1300  // loop over faces
1301  for (unsigned int f_ = con_cq.ptr[c], f_index = 0;
1302  f_ < con_cq.ptr[c + 1];
1303  ++f_, ++f_index)
1304  {
1305  const unsigned int f = con_cq.col[f_];
1306 
1307  // only faces with default orientation have to do something
1308  if (ori_cq[f_] != 1)
1309  continue;
1310 
1311  // determine entity type of face
1312  quad_t_id[f] = cell_type->type_of_entity(2, f_index);
1313 
1314  // loop over lines
1315  for (unsigned int l = 0;
1316  l < cell_type->n_lines_of_surface(f_index);
1317  ++l)
1318  {
1319  // determine global index of line
1320  const unsigned int local_line_index =
1321  cell_type->nth_line_of_surface(l, f_index);
1322  const unsigned int global_line_index =
1323  con_cl.col[con_cl.ptr[c] + local_line_index];
1324  con_ql.col[con_ql.ptr[f] + l] = global_line_index;
1325 
1326  // determine orientation of line
1327  const auto line_vertices_1_ref =
1328  cell_type->vertices_of_nth_line_of_surface(l, f_index);
1329 
1330  bool same = true;
1331  for (unsigned int v = 0; v < line_vertices_1_ref.size(); ++v)
1332  if (con_cv.col[con_cv.ptr[c] + line_vertices_1_ref[v]] !=
1333  con_lv.col[con_lv.ptr[global_line_index] + v])
1334  {
1335  same = false;
1336  break;
1337  }
1338 
1339  // ... comparison gives orientation
1340  ori_ql[con_ql.ptr[f] + l] = (same ? 1 : 0);
1341  }
1342  }
1343  }
1344  }
1345 
1346 
1347 
1356  template <typename T>
1358  build_connectivity(const unsigned int dim,
1359  const std::vector<std::shared_ptr<CellTypeBase>> &cell_t,
1360  const std::vector<ReferenceCell::Type> &cell_t_id,
1361  const CRS<T> & con_cv)
1362  {
1363  Connectivity<T> connectivity(dim, cell_t_id);
1364 
1365  CRS<T> temp1; // needed for 3D
1366 
1367  if (dim == 1)
1368  connectivity.entity_to_entities(1, 0) = con_cv;
1369 
1370  if (dim == 2 || dim == 3) // build lines
1371  {
1372  std::vector<unsigned char> dummy;
1373 
1374  build_entity(1,
1375  cell_t,
1376  connectivity.entity_types(dim),
1377  con_cv,
1378  dim == 2 ? connectivity.entity_to_entities(2, 1) : temp1,
1379  connectivity.entity_to_entities(1, 0),
1380  dim == 2 ? connectivity.entity_orientations(1) : dummy,
1381  [](auto key, const auto &, const auto &, const auto &) {
1382  // to ensure same enumeration as in deal.II
1383  return key;
1384  });
1385  }
1386 
1387  if (dim == 3) // build quads
1388  {
1389  build_entity(
1390  2,
1391  cell_t,
1392  connectivity.entity_types(3),
1393  con_cv,
1394  connectivity.entity_to_entities(3, 2),
1395  connectivity.entity_to_entities(2, 0),
1396  connectivity.entity_orientations(2),
1397  [&](auto key, const auto &cell_type, const auto &c, const auto &f) {
1398  // to ensure same enumeration as in deal.II
1399  AssertIndexRange(cell_type->n_lines_of_surface(f),
1400  key.size() + 1);
1401 
1402  unsigned int l = 0;
1403 
1404  for (; l < cell_type->n_lines_of_surface(f); ++l)
1405  key[l] =
1406  temp1
1407  .col[temp1.ptr[c] + cell_type->nth_line_of_surface(l, f)] +
1408  1 /*offset!*/;
1409 
1410  for (; l < key.size(); ++l)
1411  key[l] = 0;
1412 
1413  return key;
1414  });
1415 
1416  // create connectivity: quad -> line
1417  build_intersection(cell_t,
1418  connectivity.entity_types(3),
1419  con_cv,
1420  temp1,
1421  connectivity.entity_to_entities(1, 0),
1422  connectivity.entity_to_entities(3, 2),
1423  connectivity.entity_to_entities(2, 0),
1424  connectivity.entity_orientations(2),
1425  connectivity.entity_to_entities(2, 1),
1426  connectivity.entity_orientations(1),
1427  connectivity.entity_types(2));
1428  }
1429 
1430  // determine neighbors
1431  determine_neighbors(connectivity.entity_to_entities(dim, dim - 1),
1432  connectivity.entity_to_entities(dim, dim));
1433 
1434  return connectivity;
1435  }
1436 
1437 
1438 
1442  template <typename T, int dim>
1444  build_connectivity(const std::vector<CellData<dim>> &cells)
1445  {
1446  AssertThrow(cells.size() > 0, ExcMessage("No cells have been provided!"));
1447 
1448  // vector of possible cell entity types
1449  std::vector<std::shared_ptr<CellTypeBase>> cell_types_impl(8);
1450 
1451  cell_types_impl[static_cast<types::geometric_entity_type>(
1453  .reset(new CellTypeLine());
1454  cell_types_impl[static_cast<types::geometric_entity_type>(
1456  .reset(new CellTypeTri());
1457  cell_types_impl[static_cast<types::geometric_entity_type>(
1459  .reset(new CellTypeQuad());
1460  cell_types_impl[static_cast<types::geometric_entity_type>(
1462  .reset(new CellTypeTet());
1463  cell_types_impl[static_cast<types::geometric_entity_type>(
1465  .reset(new CellTypePyramid());
1466  cell_types_impl[static_cast<types::geometric_entity_type>(
1468  .reset(new CellTypeWedge());
1469  cell_types_impl[static_cast<types::geometric_entity_type>(
1471  .reset(new CellTypeHex());
1472 
1473  // determine cell types and process vertices
1474  std::vector<T> cell_vertices;
1475  cell_vertices.reserve(
1476  std::accumulate(cells.begin(),
1477  cells.end(),
1478  0,
1479  [](const auto &result, const auto &cell) {
1480  return result + cell.vertices.size();
1481  }));
1482 
1483  std::vector<std::size_t> cell_vertices_ptr;
1484  cell_vertices_ptr.reserve(cells.size() + 1);
1485  cell_vertices_ptr.push_back(0);
1486 
1487  std::vector<ReferenceCell::Type> cell_types_indices;
1488  cell_types_indices.reserve(cells.size());
1489 
1490  // loop over cells and create CRS
1491  for (const auto &cell : cells)
1492  {
1493  const ReferenceCell::Type cell_type =
1494  ReferenceCell::n_vertices_to_type(dim, cell.vertices.size());
1495 
1496  Assert(cell_type != ReferenceCell::Type::Invalid,
1497  ExcNotImplemented());
1498  AssertIndexRange(static_cast<types::geometric_entity_type>(cell_type),
1499  cell_types_impl.size());
1500  Assert(cell_types_impl[static_cast<types::geometric_entity_type>(
1501  cell_type)]
1502  .get() != nullptr,
1503  ExcNotImplemented());
1504 
1505  cell_types_indices.push_back(cell_type);
1506 
1507  // create CRS of vertices (to remove template argument dim)
1508  for (const auto &vertex : cell.vertices)
1509  cell_vertices.push_back(vertex);
1510 
1511  cell_vertices_ptr.push_back(cell_vertices.size());
1512  }
1513 
1514  // do the actual work
1515  return build_connectivity<T>(dim,
1516  cell_types_impl,
1517  cell_types_indices,
1518  {cell_vertices_ptr, cell_vertices});
1519  }
1520  } // namespace TriangulationImplementation
1521 } // namespace internal
1522 
1523 
1525 
1526 #endif
virtual unsigned int n_entities(const unsigned int d) const
Definition: connectivity.h:49
unsigned int nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:478
virtual const std::array< unsigned int, 2 > & vertices_of_nth_line_of_surface(const unsigned int line, const unsigned int face) const
Definition: connectivity.h:113
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:265
static const Type Invalid
static const Type Vertex
static const unsigned int invalid_unsigned_int
Definition: types.h:196
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1623
virtual unsigned int n_lines_of_surface(const unsigned int face) const
Definition: connectivity.h:87
CRS(const std::vector< std::size_t > &ptr, const std::vector< T > &col)
Definition: connectivity.h:778
unsigned int n_lines_of_surface(const unsigned int surface) const override
Definition: connectivity.h:721
const std::vector< ReferenceCell::Type > & entity_types(const unsigned int structdim) const
Definition: connectivity.h:865
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:167
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
unsigned int n_lines_of_surface(const unsigned int surface) const override
Definition: connectivity.h:595
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:330
const std::array< unsigned int, 2 > & vertices_of_nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:620
std::uint8_t geometric_entity_type
Definition: types.h:157
virtual ::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const
Definition: connectivity.h:61
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:134
const std::array< unsigned int, 2 > & vertices_of_nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:743
#define AssertIndexRange(index, range)
Definition: exceptions.h:1691
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:714
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:224
void build_entity(const unsigned int d, const std::vector< std::shared_ptr< CellTypeBase >> &cell_types, const std::vector< ReferenceCell::Type > &cell_types_index, const CRS< unsigned int > &crs, CRS< unsigned int > &crs_d, CRS< unsigned int > &crs_0, std::vector< unsigned char > &orientations, const FU &second_key_function)
#define AssertThrow(cond, exc)
Definition: exceptions.h:1576
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:644
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:239
const std::array< unsigned int, 2 > & vertices_of_nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:373
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:695
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:182
std::vector< unsigned char > & entity_orientations(const unsigned int structdim)
Definition: connectivity.h:830
std::vector< ReferenceCell::Type > cell_types
Definition: connectivity.h:917
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const
Definition: connectivity.h:74
Connectivity< T > build_connectivity(const unsigned int dim, const std::vector< std::shared_ptr< CellTypeBase >> &cell_t, const std::vector< ReferenceCell::Type > &cell_t_id, const CRS< T > &con_cv)
const std::vector< unsigned char > & entity_orientations(const unsigned int structdim) const
Definition: connectivity.h:841
void build_entity_templated(const unsigned int d, const std::vector< std::shared_ptr< CellTypeBase >> &cell_types, const std::vector< ReferenceCell::Type > &cell_types_index, const CRS< unsigned int > &crs, CRS< unsigned int > &crs_d, CRS< unsigned int > &crs_0, std::vector< unsigned char > &orientations, const FU &second_key_function)
Definition: connectivity.h:998
static const Type Pyramid
static ::ExceptionBase & ExcMessage(std::string arg1)
void determine_neighbors(const CRS< T > &con_cf, CRS< T > &con_cc)
Definition: connectivity.h:945
virtual unsigned int nth_line_of_surface(const unsigned int line, const unsigned int face) const
Definition: connectivity.h:99
static const Type Hex
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:567
unsigned int nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:728
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:462
#define Assert(cond, exc)
Definition: exceptions.h:1466
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:516
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:380
static const Type Tet
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:349
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:296
unsigned int n_lines_of_surface(const unsigned int line) const override
Definition: connectivity.h:356
CRS< T > & entity_to_entities(const unsigned int from, const unsigned int to)
Definition: connectivity.h:878
static const Type Wedge
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Point< 2 > first
Definition: grid_out.cc:4367
const CRS< T > & entity_to_entities(const unsigned int from, const unsigned int to) const
Definition: connectivity.h:897
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:208
unsigned int n_lines_of_surface(const unsigned int surface) const override
Definition: connectivity.h:469
ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:154
static const Type Line
static const Type Tri
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:379
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:588
const std::array< unsigned int, 2 > & vertices_of_nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:492
Type n_vertices_to_type(const int dim, const unsigned int n_vertices)
std::vector< ReferenceCell::Type > quad_types
Definition: connectivity.h:931
static ::ExceptionBase & ExcNotImplemented()
virtual ReferenceCell::Type type_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:441
::ArrayView< const unsigned int > vertices_of_entity(const unsigned int d, const unsigned int e) const override
Definition: connectivity.h:394
void build_intersection(const std::vector< std::shared_ptr< CellTypeBase >> &cell_types, const std::vector< ReferenceCell::Type > &cell_types_index, const CRS< unsigned int > &con_cv, const CRS< unsigned int > &con_cl, const CRS< unsigned int > &con_lv, const CRS< unsigned int > &con_cq, const CRS< unsigned int > &con_qv, const std::vector< unsigned char > &ori_cq, CRS< unsigned int > &con_ql, std::vector< unsigned char > &ori_ql, std::vector< ReferenceCell::Type > &quad_t_id)
unsigned int nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:604
unsigned int n_entities(const unsigned int d) const override
Definition: connectivity.h:281
std::vector< ReferenceCell::Type > & entity_types(const unsigned int structdim)
Definition: connectivity.h:852
T max(const T &t, const MPI_Comm &mpi_communicator)
static const Type Quad
Connectivity(const unsigned int dim, const std::vector< ReferenceCell::Type > &cell_types)
Definition: connectivity.h:823
unsigned int nth_line_of_surface(const unsigned int line, const unsigned int face) const override
Definition: connectivity.h:363
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)