def _translate(self, vector): """ Test for ticket:298. >>> from fipy import * >>> m = PeriodicGrid3DLeftRight(nx=2, ny=2, nz=1) + [[-1], [0], [0]] >>> orderedCellVertexIDs = [[13, 14, 16, 17], ... [12, 13, 15, 16], ... [10, 11, 13, 14], ... [9, 10, 12, 13], ... [4, 5, 7, 8], ... [3, 4, 6, 7], ... [1, 2, 4, 5], ... [0, 1, 3, 4]] >>> print(numerix.allclose(m._orderedCellVertexIDs, orderedCellVertexIDs)) # doctest: +PROCESSOR_0 True >>> print(CellVariable(mesh=m, value=m.cellCenters[0])) [-0.5 0.5 -0.5 0.5] """ newCoords = self.vertexCoords + vector newmesh = self.__class__(**self.args) from fipy.meshes.mesh import Mesh Mesh.__init__(newmesh, newCoords, self.faceVertexIDs, self._nonPeriodicCellFaceIDs, communicator=self.communicator) newmesh._makePeriodic() return newmesh
def _translate(self, vector): """ Test for ticket:298. >>> from fipy import * >>> m = PeriodicGrid3DLeftRight(nx=2, ny=2, nz=1) + [[-1], [0], [0]] >>> orderedCellVertexIDs = [[13, 14, 16, 17], ... [12, 13, 15, 16], ... [10, 11, 13, 14], ... [9, 10, 12, 13], ... [4, 5, 7, 8], ... [3, 4, 6, 7], ... [1, 2, 4, 5], ... [0, 1, 3, 4]] >>> print(numerix.allclose(m._orderedCellVertexIDs, orderedCellVertexIDs)) # doctest: +PROCESSOR_0 True >>> print(CellVariable(mesh=m, value=m.cellCenters[0])) [-0.5 0.5 -0.5 0.5] """ newCoords = self.vertexCoords + vector newmesh = self.__class__(**self.args) from fipy.meshes.mesh import Mesh Mesh.__init__(newmesh, newCoords, self.faceVertexIDs, self._nonPeriodicCellFaceIDs, communicator=self.communicator) newmesh._makePeriodic() return newmesh
def __init__(self, dx = 1., dy = 1., dz = 1., nx = None, ny = None, nz = None, overlap=2, communicator=parallelComm, _RepresentationClass=_Grid3DRepresentation, _TopologyClass=_Grid3DTopology): builder = _NonuniformGrid3DBuilder() self.args = { 'dx': dx, 'dy': dy, 'dz' :dz, 'nx': nx, 'ny': ny, 'nz': nz, 'overlap': overlap, 'communicator': communicator } builder.buildGridData([dx, dy, dz], [nx, ny, nz], overlap, communicator) ([self.dx, self.dy, self.dz], [self.nx, self.ny, self.nz], self.dim, scale, self.globalNumberOfCells, self.globalNumberOfFaces, self.overlap, self.offset, self.numberOfVertices, self.numberOfFaces, self.numberOfCells, self.shape, self.physicalShape, self._meshSpacing, self.numberOfXYFaces, self.numberOfXZFaces, self.numberOfYZFaces, self.numberOfHorizontalRows, self.numberOfVerticalColumns, self.numberOfLayersDeep, vertices, faces, cells, self.Xoffset, self.Yoffset, self.Zoffset) = builder.gridData Mesh.__init__(self, vertices, faces, cells, communicator=communicator, _RepresentationClass=_RepresentationClass, _TopologyClass=_TopologyClass) self._setScale(scaleLength = scale)
def __init__(self, dx = 1., dy = 1., dz = 1., nx = None, ny = None, nz = None, overlap=2, communicator=parallelComm, _RepresentationClass=_Grid3DRepresentation, _TopologyClass=_Grid3DTopology): builder = _NonuniformGrid3DBuilder() self.args = { 'dx': dx, 'dy': dy, 'dz': dz, 'nx': nx, 'ny': ny, 'nz': nz, 'overlap': overlap, } builder.buildGridData([dx, dy, dz], [nx, ny, nz], overlap, communicator) ([self.dx, self.dy, self.dz], [self.nx, self.ny, self.nz], self.dim, scale, self.globalNumberOfCells, self.globalNumberOfFaces, self.overlap, self.offset, self.numberOfVertices, self.numberOfFaces, self.numberOfCells, self.shape, self.physicalShape, self._meshSpacing, self.numberOfXYFaces, self.numberOfXZFaces, self.numberOfYZFaces, self.numberOfHorizontalRows, self.numberOfVerticalColumns, self.numberOfLayersDeep, vertices, faces, cells, self.Xoffset, self.Yoffset, self.Zoffset) = builder.gridData Mesh.__init__(self, vertices, faces, cells, communicator=communicator, _RepresentationClass=_RepresentationClass, _TopologyClass=_TopologyClass) self._setScale(scaleLength = scale)
def setstate(mesh, state): """Populate a new `Mesh` from ``pickled`` persistent storage. """ from fipy.meshes.mesh import Mesh Mesh.__init__(mesh, **state)
def setstate(mesh, state): """Populate a new `Mesh` from ``pickled`` persistent storage. """ from fipy.meshes.mesh import Mesh Mesh.__init__(mesh, **state)