Forgot to revert to old CoonsPatch

parent 3fefc01c
Pipeline #11797 failed with stage
in 3 minutes and 45 seconds
......@@ -67,46 +67,13 @@ class CoonsPatch(object):
for name, c in self.edges.items():
c.points = np.asarray(c.points, dtype=self.dtype)
def _linear(self, i, j, u0, u1, v0, v1):
u = self._get_u_from_ij(i, j, u0, u1)
v = self._get_v_from_ij(i, j, v0, v1)
return u, v
def _linear(self, i, den):
return i * den
def _cubic(self, i, j, u0, u1, v0, v1):
u, v = self._linear(i, j, u0, u1, v0, v1)
def _cubic(self, i, den):
u = i * den
u = 3*u**2 - 2.*u**3
v = 3 * v ** 2 - 2. * v ** 3
return u, v
def _edge_u(self, iedge):
# Get s
s = self._edge_s(iedge)
# return u as normalized s
return s/s[-1]
def _edge_s(self, iedge):
# Get edge points
ps = self.edges[self._names[iedge]].points.copy()
# Compute ds as 3 component vector
ds_vec = np.diff(ps, axis=0)
# Compute ds vector (n-1)
ds = np.linalg.norm(ds_vec, axis=1)
# Computing s as sum of ds
s = np.zeros(len(ds)+1)
s[1:] = np.cumsum(ds)
return s
def _get_u_or_v_from_ij(self, i, j, nj, u0, u1):
return u0[i]*j/(nj-1)+u1[i]*(1-j/(nj-1))
def _get_u_from_ij(self, i, j, u0, u1):
return self._get_u_or_v_from_ij(i, j, self.nj, u0, u1)
def _get_v_from_ij(self, i, j, v0, v1):
return self._get_u_or_v_from_ij(j, i, self.ni, v0, v1)
return u
def update(self):
......@@ -122,17 +89,14 @@ class CoonsPatch(object):
P01 = P0v[-1, :]
P11 = P1v[-1, :]
# get u0 and u1
u0 = self._edge_u(0)
u1 = self._edge_u(1)
# get v0 and v1
v0 = self._edge_u(2)
v1 = self._edge_u(3)
denu = 1.0/(self.ni - 1)
denv = 1.0/(self.nj - 1)
P = np.zeros((self.ni, self.nj, 3), dtype=self.dtype)
for i in range(self.ni):
u = self.dtype(self._interpolant(i, denu))
for j in range(self.nj):
u, v = self._interpolant(i, j, u0, u1, v0, v1)
v = self.dtype(self._interpolant(j, denv))
P[i,j, :] = (1 - u) * P0v[j, :] + \
u * P1v[j, :] + \
(1 - v) * Pu0[i, :] + \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment