Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ step_*.png
*_data.json
!_dataRef.json
*.pysdc
*.vtr

# Created by https://www.gitignore.io

Expand Down
1 change: 1 addition & 0 deletions etc/environment-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
- sympy>=1.0
- numba>=0.35
- dill>=0.2.6
- vtk
- pip
- pip:
- qmat>=0.1.8
16 changes: 6 additions & 10 deletions pySDC/helpers/blocks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import numpy as np


class BlockDecomposition(object):
"""
Class decomposing a cartesian space domain (1D to 3D) into a given number of processors.
Expand Down Expand Up @@ -92,16 +95,9 @@ def __init__(self, nProcs, gridSizes, algo="Hybrid", gRank=None, order="C"):

@property
def ranks(self):
gRank, order = self.gRank, self.order
assert gRank is not None, "gRank attribute need to be set"
dim, nBlocks = self.dim, self.nBlocks
if dim == 1:
return (gRank,)
elif dim == 2:
div = nBlocks[-1] if order == "C" else nBlocks[0]
return (gRank // div, gRank % div)
else:
raise NotImplementedError(f"dim={dim}")
assert self.gRank is not None, "gRank attribute needs to be set"
cart = np.arange(np.prod(self.nBlocks)).reshape(self.nBlocks, order=self.order)
return list(np.argwhere(cart == self.gRank)[0])

@property
def localBounds(self):
Expand Down
Loading