MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / transfer_meshtag

Function transfer_meshtag

python/dolfinx/mesh.py:683–715  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

681
682
683def 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
718def uniform_refine(

Callers 2

test_refine_cell_meshtagFunction · 0.90

Calls 3

transfer_cell_meshtagMethod · 0.80
MeshTagsClass · 0.70

Tested by 2

test_refine_cell_meshtagFunction · 0.72