Create cell mesh tags on a refined mesh from parent mesh tags. Args: meshtag: Mesh tags on the coarse, parent mesh. msh1: The refined mesh. parent_cell: Index of the parent cell for each cell in the refined mesh. parent_facet: Index of the local paren
(
meshtag: MeshTags,
msh1: Mesh,
parent_cell: npt.NDArray[np.int32],
parent_facet: npt.NDArray[np.int8] | None = None,
)
| 681 | |
| 682 | |
| 683 | def transfer_meshtag( |
| 684 | meshtag: MeshTags, |
| 685 | msh1: Mesh, |
| 686 | parent_cell: npt.NDArray[np.int32], |
| 687 | parent_facet: npt.NDArray[np.int8] | None = None, |
| 688 | ) -> MeshTags: |
| 689 | """Create cell mesh tags on a refined mesh from parent mesh tags. |
| 690 | |
| 691 | Args: |
| 692 | meshtag: Mesh tags on the coarse, parent mesh. |
| 693 | msh1: The refined mesh. |
| 694 | parent_cell: Index of the parent cell for each cell in the |
| 695 | refined mesh. |
| 696 | parent_facet: Index of the local parent facet for each cell |
| 697 | in the refined mesh. Only required for transfer tags on |
| 698 | facets. |
| 699 | |
| 700 | Returns: |
| 701 | Mesh tags on the refined mesh. |
| 702 | """ |
| 703 | if meshtag.dim == meshtag.topology.dim: |
| 704 | mt = _cpp.refinement.transfer_cell_meshtag( |
| 705 | meshtag._cpp_object, msh1.topology._cpp_object, parent_cell |
| 706 | ) |
| 707 | return MeshTags(mt) |
| 708 | elif meshtag.dim == meshtag.topology.dim - 1: |
| 709 | assert parent_facet is not None |
| 710 | mt = _cpp.refinement.transfer_facet_meshtag( |
| 711 | meshtag._cpp_object, msh1.topology._cpp_object, parent_cell, parent_facet |
| 712 | ) |
| 713 | return MeshTags(mt) |
| 714 | else: |
| 715 | raise RuntimeError("MeshTag transfer is supported on on cells or facets.") |
| 716 | |
| 717 | |
| 718 | def uniform_refine( |