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

add ghosts update skip flag for custom operators.

parent d1825861
No related branches found
No related tags found
No related merge requests found
......@@ -28,42 +28,21 @@ from hysop.core.graph.graph import op_apply
class CustomOperatorBase:
@debug
def __new__(
cls,
func,
invars=None,
outvars=None,
extra_args=None,
variables=None,
ghosts=None,
**kwds,
):
return super().__new__(
cls,
input_fields=None,
output_fields=None,
input_params=None,
output_params=None,
**kwds,
)
def __new__(cls, func, invars=None, outvars=None,
extra_args=None, variables=None, ghosts=None,
do_update_ghosts=True, **kwds):
return super().__new__(cls,
input_fields=None, output_fields=None,
input_params=None, output_params=None,
**kwds)
@debug
def __init__(
self,
func,
invars=None,
outvars=None,
extra_args=None,
variables=None,
ghosts=None,
**kwds,
):
check_instance(
invars, (tuple, list), values=(Field, Parameter), allow_none=True
)
check_instance(
outvars, (tuple, list), values=(Field, Parameter), allow_none=True
)
def __init__(self, func, invars=None, outvars=None,
extra_args=None, variables=None, ghosts=None, do_update_ghosts=True, **kwds):
check_instance(invars, (tuple, list), values=(Field, Parameter),
allow_none=True)
check_instance(outvars, (tuple, list), values=(Field, Parameter),
allow_none=True)
check_instance(extra_args, tuple, allow_none=True)
check_instance(
variables,
......@@ -73,6 +52,7 @@ class CustomOperatorBase:
allow_none=True,
)
check_instance(ghosts, int, allow_none=True)
check_instance(do_update_ghosts, bool,)
input_fields, output_fields = {}, {}
input_params, output_params = {}, {}
if invars is not None:
......@@ -93,6 +73,7 @@ class CustomOperatorBase:
if not extra_args is None:
self.extra_args = extra_args
self._ghosts = ghosts
self._do_update_ghosts = do_update_ghosts
super().__init__(
input_fields=input_fields,
output_fields=output_fields,
......@@ -138,7 +119,7 @@ class CustomOperatorBase:
for vd in self.output_discrete_fields[_v]:
doutvar.append(vd)
gh = self.output_discrete_fields[_v].build_ghost_exchanger()
if gh is not None:
if gh is not None and self._do_update_ghosts:
self.ghost_exchanger.append(gh)
elif isinstance(v, Parameter):
doutparam.append(v)
......
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