Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TL: generic FieldsIO class for n-dimensional rectilinear grids + VTK support #533

Merged
merged 16 commits into from
Feb 20, 2025
Merged
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