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

fix bug in method setting for operators

parent 3200aecb
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from parmepy.operator.continuous import Operator
from parmepy.f2py import fftw2py
from parmepy.operator.discrete.diffusion_fft import DiffusionFFT
from parmepy.constants import debug
from parmepy.methods_keys import SpaceDiscretisation, GhostUpdate
import numpy as np
......@@ -35,7 +36,8 @@ class Diffusion(Operator):
"""
# The only available method at the time is fftw
if method is None:
method = 'fftw'
method = {SpaceDiscretisation: 'fftw', GhostUpdate: True}
## input/output field, solution of the problem
self.vorticity = vorticity
## Global resolution for vorticity
......@@ -50,7 +52,7 @@ class Diffusion(Operator):
def discretize(self):
# The only available solver is fftw
if self.method is not 'fftw':
if self.method[SpaceDiscretisation] is not 'fftw':
print self.method
raise AttributeError("Method not yet implemented.")
......
......@@ -24,8 +24,7 @@ class Differential(DiscreteOperator):
## return object.__new__(cls, *args, **kw)
@debug
def __init__(self, invar, outvar,
method={SpaceDiscretisation: FD_C_4, GhostUpdate: True}):
def __init__(self, invar, outvar, method=None):
"""
@param[in] invar : input field
@param[in,out] outvar : Grad of the input field.
......@@ -36,6 +35,8 @@ class Differential(DiscreteOperator):
"""
self.invar = invar
self.outvar = outvar
if method is None:
method = {SpaceDiscretisation: FD_C_4, GhostUpdate: True}
DiscreteOperator.__init__(self, [self.invar, self.outvar],
method=method)
self.input = [self.invar]
......
......@@ -5,6 +5,7 @@ Abstract interface for discrete operators.
from abc import ABCMeta, abstractmethod
from parmepy.constants import debug
from parmepy.tools.timers import Timer, ManualFunctionTimer
from parmepy.methods_keys import GhostUpdate
class DiscreteOperator(object):
......@@ -40,6 +41,8 @@ class DiscreteOperator(object):
if method is None:
method = {}
self.method = method
if not GhostUpdate in method:
method[GhostUpdate] = True
self.name = self.__class__.__name__
## Object to store computational times of lower level functions
self.timer = Timer(self)
......
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