From 6c010cf2ea38b814a57bf8248839d1325ee1d467 Mon Sep 17 00:00:00 2001 From: Swapneel Amit Pathak Date: Wed, 22 Nov 2023 17:01:16 +0100 Subject: [PATCH] feat(Field): add `VertexField` to support data at vertices --- discretisedfield/vertex_field.py | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 discretisedfield/vertex_field.py diff --git a/discretisedfield/vertex_field.py b/discretisedfield/vertex_field.py new file mode 100644 index 00000000..b2a11013 --- /dev/null +++ b/discretisedfield/vertex_field.py @@ -0,0 +1,44 @@ +from discretisedfield import Field + + +class VertexField(Field): + def _repr_html_(self): + pass # @Martin + + def __call__(self, point): + raise NotImplementedError + + def diff(self, direction, order=1, restrict2valid=True): + """Maybe this is slighly wrong and we should ask Claas about this.""" + super().diff(direction, order=order, restrict2valid=restrict2valid) + + def integrate(self, direction=None, cumulative=False): + """Maybe this is slighly wrong and we should ask Claas about this.""" + super().integrate(direction=direction, cumulative=cumulative) + + def line(self, p1, p2, n): + pass # @Martin + + def __getitem__(self, item): + raise NotImplementedError + + def to_vtk(self): + pass # @Martin + + def mpl(self): + pass # @Swapneel + + def hv(self): + pass # @Swapneel + + # NOTE: We are ignoring all the FFTs for now. + + def to_xarray(self, name="field", unit=None): + pass # @Swapneel + + @classmethod + def from_xarray(cls, xa): + raise NotImplementedError + + +# TODO: reimplement the _as_array functions. @Swapneel