コード例 #1
0
    def read(self, debug):
        """Read finite-element mesh and store in Sieve mesh object.

        @returns PETSc DMPlex mesh object containing finite-element mesh
        """
        from pylith.mpi.Communicator import mpi_comm_world
        comm = mpi_comm_world()
        if 0 == comm.rank:
            self._info.log("Reading finite-element mesh")

        # Set flags
        self.debug(debug)

        # Initialize coordinate system
        if self.coordsys is None:
            raise ValueError("Coordinate system for mesh is unknown.")

        from pylith.mpi.Communicator import petsc_comm_world
        from pylith.topology.Mesh import Mesh
        mesh = Mesh(dim=self.coordsys.getSpaceDim(), comm=petsc_comm_world())
        mesh.setCoordSys(self.coordsys)

        # Read mesh
        ModuleMeshIO.read(self, mesh)
        return mesh