Skip to content
Snippets Groups Projects
Commit 7a2e882a authored by EXT Jean-Matthieu Etancelin's avatar EXT Jean-Matthieu Etancelin
Browse files

updaet cusom ghosts. simulation write parameters with freq

parent 32c72873
No related branches found
No related tags found
2 merge requests!24Resolve "Add python3.x support",!15WIP: Resolve "HySoP with tasks"
......@@ -57,7 +57,9 @@ class PythonCustomOperator(HostOperator):
if not it[1] is None:
is_input, (field, td, req) = it
min_ghosts = (max(g, self._ghosts) for g in req.min_ghosts.copy())
max_ghosts = (min(g, self._ghosts) for g in req.max_ghosts.copy())
req.min_ghosts = min_ghosts
req.max_ghosts = max_ghosts
return requirements
@debug
......
......@@ -224,16 +224,17 @@ class Simulation(object):
for (io_params, params, kwds) in self._parameters_to_write:
if self.mpi_params.rank == io_params.io_leader:
if (io_params.fileformat is IO.ASCII):
kwds = kwds.copy()
f = kwds.pop('file')
formatter = kwds.pop('formatter')
values = npw.asarray(tuple(map(lambda x: x.item() if x.size == 1 else x,
(p() for p in params))))
values = npw.array2string(values, max_line_width=npw.inf,
formatter=formatter, legacy='1.13', **kwds)
values = '\n'+values[1:-1]
f.write(values)
f.flush()
if ((self.current_iteration % io_params.frequency) == 0):
kwds = kwds.copy()
f = kwds.pop('file')
formatter = kwds.pop('formatter')
values = npw.asarray(tuple(map(lambda x: x.item() if x.size == 1 else x,
(p() for p in params))))
values = npw.array2string(values, max_line_width=npw.inf,
formatter=formatter, legacy='1.13', **kwds)
values = '\n'+values[1:-1]
f.write(values)
f.flush()
else:
msg = 'Unknown format {}.'.format(fileformat)
raise ValueError(msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment