def _from_exodus(filename): """Read an Exodus .e or .exo file from `filename`""" plex = PETSc.DMPlex().createExodusFromFile(filename) boundary_ids = dmplex.getLabelIdIS("Face Sets").getIndices() plex.createLabel("boundary_ids") for bid in boundary_ids: faces = plex.getStratumIS("Face Sets", bid).getIndices() for f in faces: plex.setLabelValue("boundary_ids", f, bid) return plex
def _from_exodus(self, filename, dim=0, reorder=None): self.name = filename plex = PETSc.DMPlex().createExodusFromFile(filename) boundary_ids = dmplex.getLabelIdIS("Face Sets").getIndices() plex.createLabel("boundary_ids") for bid in boundary_ids: faces = plex.getStratumIS("Face Sets", bid).getIndices() for f in faces: plex.setLabelValue("boundary_ids", f, bid) self._from_dmplex(plex, reorder=reorder)