Skip to content
Snippets Groups Projects
Commit 17319775 authored by Franck Pérignon's avatar Franck Pérignon
Browse files

Fix tests, all ok except advec_scales, veloc_correc

parent d25d4e07
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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:
......
......@@ -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
......
......@@ -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
......
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