Exemplo n.º 1
0
 def __distributor_setup__(self, **kwargs):
     """
     A `SparseDistributor` handles the SparseFunction decomposition based on
     physical ownership, and allows to convert between global and local indices.
     """
     return SparseDistributor(kwargs['npoint'], self._sparse_dim,
                              kwargs['grid'].distributor)
Exemplo n.º 2
0
 def __shape_setup__(cls, **kwargs):
     grid = kwargs.get('grid')
     # A Grid must have been provided
     if grid is None:
         raise TypeError('Need `grid` argument')
     shape = kwargs.get('shape')
     npoint = kwargs['npoint']
     if shape is None:
         glb_npoint = SparseDistributor.decompose(npoint, grid.distributor)
         shape = (glb_npoint[grid.distributor.myrank], )
     return shape
Exemplo n.º 3
0
 def __shape_setup__(cls, **kwargs):
     grid = kwargs.get('grid')
     # A Grid must have been provided
     if grid is None:
         raise TypeError('Need `grid` argument')
     shape = kwargs.get('shape')
     npoint = kwargs['npoint']
     if shape is None:
         glb_npoint = SparseDistributor.decompose(npoint, grid.distributor)
         shape = (glb_npoint[grid.distributor.myrank],)
     return shape