diff --git a/skfem/mesh/mesh.py b/skfem/mesh/mesh.py index 1e0436955..883a61536 100644 --- a/skfem/mesh/mesh.py +++ b/skfem/mesh/mesh.py @@ -349,13 +349,8 @@ def __post_init__(self): if self.sort_t: self.t = np.sort(self.t, axis=0) - if not isinstance(self.doflocs, ndarray): - # for backwards compatibility: support standard lists - self.doflocs = np.array(self.doflocs, dtype=np.float64) - - if not isinstance(self.t, ndarray): - # for backwards compatibility: support standard lists - self.t = np.array(self.t, dtype=np.int64) + self.doflocs = np.asarray(self.doflocs, dtype=np.float64, order="K") + self.t = np.asarray(self.t, dtype=np.int64, order="K") M = self.elem.refdom.nnodes diff --git a/skfem/mesh/mesh_line_1.py b/skfem/mesh/mesh_line_1.py index 8ea3d6712..ef85502c8 100644 --- a/skfem/mesh/mesh_line_1.py +++ b/skfem/mesh/mesh_line_1.py @@ -20,7 +20,9 @@ class MeshLine1(Mesh): def __post_init__(self): - if len(self.doflocs.shape) == 1: + super().__post_init__() + + if self.doflocs.ndim == 1: # support flat arrays self.doflocs = np.array([self.doflocs]) @@ -29,8 +31,6 @@ def __post_init__(self): tmp = np.arange(self.doflocs.shape[1] - 1, dtype=np.int64) self.t = np.vstack((tmp, tmp + 1)) - super().__post_init__() - def __mul__(self, other): return MeshQuad1.init_tensor(self.p[0], other.p[0])