Skip to content

Commit

Permalink
TL: last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tlunet committed Jan 18, 2025
1 parent 8ee8815 commit e80ae17
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pySDC/helpers/fieldsIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def setHeader(self, nVar):
self.nItems = self.nVar

@property
def hinfos(self):
def hInfos(self):
"""Array representing the grid structure to be written in the binary file."""
return [np.array([self.nVar], dtype=np.int64)]

Expand Down Expand Up @@ -380,8 +380,8 @@ def setHeader(self, nVar, coordX):
----
When used in MPI decomposition mode, `coordX` **must** be the global grid.
"""
grids = self.setupCoords(coordX=coordX)
self.header = {"nVar": int(nVar), **grids}
coords = self.setupCoords(coordX=coordX)
self.header = {"nVar": int(nVar), **coords}
self.nItems = nVar * self.nX

@property
Expand Down Expand Up @@ -414,12 +414,12 @@ def nX(self):
return self.header["coordX"].size

@staticmethod
def setupCoords(**grids):
def setupCoords(**coords):
"""Utility function to setup grids in multuple dimensions, given the keyword arguments"""
grids = {name: np.asarray(grid, dtype=np.float64) for name, grid in grids.items() if name.startswith("grid")}
for name, grid in grids.items():
assert grid.ndim == 1, f"{name} must be one dimensional"
return grids
coords = {name: np.asarray(coord, dtype=np.float64) for name, coord in coords.items()}
for name, coord in coords.items():
assert coord.ndim == 1, f"{name} must be one dimensional"
return coords

# -------------------------------------------------------------------------
# MPI-parallel implementation
Expand Down Expand Up @@ -511,8 +511,11 @@ def initialize(self):
try:
super().initialize()
except AssertionError as e:
print(f"{type(e): {e}}")
self.comm.Abort()
if self.MPI_ON:
print(f"{type(e)}: {e}")
self.comm.Abort()
else:
raise e

if self.MPI_ON:
self.comm.Barrier() # Important, should not be removed !
Expand Down

0 comments on commit e80ae17

Please sign in to comment.