def read(self, debug, interpolate): """ Read finite-element mesh and store in Sieve mesh object. @returns PETSc 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) self.interpolate(interpolate) # 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.spaceDim(), comm=petsc_comm_world()) mesh.coordsys(self.coordsys) # Read mesh ModuleMeshIO.read(self, mesh) return mesh
def test_coordsys(self): """ Test coordsys(). """ from spatialdata.geocoords.CSCart import CSCart cs = CSCart() cs.inventory.spaceDim = 2 cs._configure() mesh = Mesh() mesh.coordsys(cs) self.assertEqual(cs.spaceDim(), mesh.coordsys().spaceDim()) return
def test_coordsys(self): """ Test coordsys(). """ mesh = self._getMesh() submesh = Mesh(mesh=mesh, label="bc") self.assertEqual(2, submesh.coordsys().spaceDim()) return