diff --git a/HySoP/hysop/operator/redistribute.py b/HySoP/hysop/operator/redistribute.py index d0781b5bc764f988f95115da3adfa8283100d9ab..befce9d4d0b8e2951482347d51c7fa0d6eb1b37e 100644 --- a/HySoP/hysop/operator/redistribute.py +++ b/HySoP/hysop/operator/redistribute.py @@ -74,7 +74,7 @@ class Redistribute(Operator): """ assert self.domain is not None for v in self.variables: - assert v.domain == self.domain + assert v.domain is self.domain super(Redistribute, self).setup(rwork, iwork) def _check_operator(self, op): @@ -145,8 +145,13 @@ class Redistribute(Operator): self.variables = [v for v in vlist] assert len(self.variables) > 0 + + # Variables is converted to a dict to be coherent with + # computational operators ... + self.variables = {key: None for key in self.variables} + # All variables must have the same domain - self.domain = self.variables[0].domain + self.domain = self.variables.keys()[0].domain for v in self.variables: assert v.domain is self.domain @@ -162,7 +167,7 @@ class Redistribute(Operator): v.discretize(result) elif isinstance(current, Computational): self._check_operator(current) - vref = self.variables[0] + vref = self.variables.keys()[0] vcurrent = current.variables result = vcurrent[vref] # We ensure that all vars have diff --git a/HySoP/hysop/problem/transport.py b/HySoP/hysop/problem/transport.py index 61da310892ad16d30e8f3450bb0c4e58608afb11..3c54afcbc6865f84b10208beff6f02bf8485d8b2 100644 --- a/HySoP/hysop/problem/transport.py +++ b/HySoP/hysop/problem/transport.py @@ -13,7 +13,7 @@ class TransportProblem(Problem): def __init__(self, operators, simulation, monitors=None, dumpFreq=100, name=None): super(TransportProblem, self).__init__( - operators, simulation, monitors, + operators, simulation, monitors=monitors, dumpFreq=dumpFreq, name="TransportProblem") self.advection, self.velocity = None, None for op in self.operators: diff --git a/HySoP/hysop/tools/profiler.py b/HySoP/hysop/tools/profiler.py index 99e3a9b506bbb3b37d4e532692ae0a707bcf1d7e..332db961ee5a31101f20618757ff91ee30d56514 100644 --- a/HySoP/hysop/tools/profiler.py +++ b/HySoP/hysop/tools/profiler.py @@ -15,8 +15,7 @@ def profile(f): """args[0] contains the object""" t0 = ftime() res = f(*args, **kwargs) - prof = args[0].profiler[f.func_name] - prof += ftime() - t0 + args[0].profiler[f.func_name] += ftime() - t0 return res return deco @@ -55,7 +54,7 @@ class Profiler(object): self._comm = comm self._comm_size = comm.Get_size() self._comm_rank = comm.Get_rank() - for p in xrange(self._comm_size): + for _ in xrange(self._comm_size): self.table.append([]) self._elems = {} self._obj = obj diff --git a/HySoP/hysop/tools/tests/test_profiler.py b/HySoP/hysop/tools/tests/test_profiler.py index 88cd64aca9bf3d292140d2b27c00afdfa90473e1..3db879d12d11dfd6d384c47b56573f2ca7fff052 100644 --- a/HySoP/hysop/tools/tests/test_profiler.py +++ b/HySoP/hysop/tools/tests/test_profiler.py @@ -2,12 +2,13 @@ Unitary tests for parmepy.tools.profiler module """ from parmepy.tools.profiler import Profiler, profile, FProfiler, ftime +from parmepy.mpi import main_comm class A_class(object): def __init__(self): self.name = 'A_class' - self.profiler = Profiler(self) + self.profiler = Profiler(self, main_comm) self.profiler += FProfiler('manual') self.n = 0