Skip to content

Commit

Permalink
Merge pull request #664 from gdmcbain/663-mesh-doflocs-asarray
Browse files Browse the repository at this point in the history
super post-init for MeshLine1
  • Loading branch information
kinnala authored Jul 2, 2021
2 parents 817c357 + 405991f commit 0855dae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions skfem/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions skfem/mesh/mesh_line_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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])

Expand Down

0 comments on commit 0855dae

Please sign in to comment.