Skip to content

Commit 04fdedc

Browse files
committed
Preparation for PDAE stuff (?)
1 parent be4f248 commit 04fdedc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pySDC/implementations/datatype_classes/MultiComponentMesh.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import numpy as np
2+
13
from pySDC.implementations.datatype_classes.mesh import mesh
24

35

@@ -13,9 +15,15 @@ class MultiComponentMesh(mesh):
1315

1416
components = []
1517

16-
def __new__(cls, init, *args, **kwargs):
17-
if isinstance(init, tuple):
18+
def __new__(cls, init, val=0.0, offset=0, buffer=None, strides=None, order=None, *args, **kwargs):
19+
if isinstance(init, tuple) and isinstance(init[0], int):
1820
obj = super().__new__(cls, ((len(cls.components), init[0]), *init[1:]), *args, **kwargs)
21+
elif isinstance(init, tuple) and isinstance(init[0], tuple):
22+
obj = np.ndarray.__new__(
23+
cls, (len(cls.components), *init[0]), dtype=init[2], buffer=buffer, offset=offset, strides=strides, order=order
24+
)
25+
obj.fill(val)
26+
obj._comm = init[1]
1927
else:
2028
obj = super().__new__(cls, init, *args, **kwargs)
2129

0 commit comments

Comments
 (0)