Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper checking for np.array == None #48

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 18 additions & 18 deletions calfem/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def beam2t(ex, ey, ep, eq=None):
Ke = G.T*Kle*G
fe = G.T*fle

if eq == None:
if eq is None:
return Ke
else:
return Ke, fe
Expand Down Expand Up @@ -1301,7 +1301,7 @@ def beam3e(ex, ey, ez, eo, ep, eq=None):
Ke = G.T*Kle*G
fe = G.T*fle

if eq == None:
if eq is None:
return Ke
else:
return Ke, fe
Expand Down Expand Up @@ -1468,7 +1468,7 @@ def beam3s(ex, ey, ez, eo, ep, ed, eq=None, n=None):
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, x, 1]
])*m+np.array([-qx*x**2/(2*EA), qy*x**4/(24*EIz), qz*x**4/(24*EIy), -qw*x**2/(2*GKv)]).reshape(4, 1)).T

if n == None:
if n is None:
return es
else:
return es, edi, eci
Expand Down Expand Up @@ -1498,7 +1498,7 @@ def flw2te(ex, ey, ep, D, eq=None):

"""
t = ep[0]
if eq == None:
if eq is None:
eq = 0.

exm = np.asmatrix(ex)
Expand Down Expand Up @@ -1608,7 +1608,7 @@ def flw2qe(ex, ey, ep, D, eq=None):
K = np.zeros((5, 5))
f = np.zeros((5, 1))

if eq == None:
if eq is None:
k1 = flw2te([ex[0], ex[1], xc], [ey[0], ey[1], yc], ep, D)
K = assem(np.array([1, 2, 5]), K, k1)
k1 = flw2te([ex[1], ex[2], xc], [ey[1], ey[2], yc], ep, D)
Expand All @@ -1631,7 +1631,7 @@ def flw2qe(ex, ey, ep, D, eq=None):
Ke = Ke1
fe = fe1

if eq == None:
if eq is None:
return Ke
else:
return Ke, fe
Expand Down Expand Up @@ -1672,7 +1672,7 @@ def flw2qs(ex, ey, ep, D, ed, eq=None):
xm = sum(ex)/4
ym = sum(ey)/4

if eq == None:
if eq is None:
q = 0
else:
q = eq
Expand All @@ -1692,7 +1692,7 @@ def flw2qs(ex, ey, ep, D, ed, eq=None):
ex4 = np.array([ex[3], ex[0], xm])
ey4 = np.array([ey[3], ey[0], ym])

if eq == None:
if eq is None:
k1 = flw2te(ex1, ey1, ep, D)
K = assem(En[0], K, k1)
k1 = flw2te(ex2, ey2, ep, D)
Expand Down Expand Up @@ -1758,7 +1758,7 @@ def flw2i4e(ex, ey, ep, D, eq=None):
ir = ep[1]
ngp = ir*ir

if eq == None:
if eq is None:
q = 0
else:
q = eq
Expand Down Expand Up @@ -1847,7 +1847,7 @@ def flw2i4e(ex, ey, ep, D, eq=None):
Ke1 = Ke1+B.T*D*B*detJ*wp[i].item()
fe1 = fe1+N[i, :].T*detJ*wp[i]

if eq == None:
if eq is None:
return Ke1*t
else:
return Ke1*t, fe1*t*eq
Expand Down Expand Up @@ -2007,7 +2007,7 @@ def flw2i8e(ex, ey, ep, D, eq=None):
ir = ep[1]
ngp = ir*ir

if eq == None:
if eq is None:
q = 0
else:
q = eq
Expand Down Expand Up @@ -2311,7 +2311,7 @@ def flw3i8e(ex, ey, ez, ep, D, eq=None):
ir = ep[0]
ngp = ir*ir*ir

if eq == None:
if eq is None:
q = 0
else:
q = eq
Expand Down Expand Up @@ -2683,14 +2683,14 @@ def plante(ex, ey, ep, D, eq=None):
Ke = B.T*Dm*B*A*t
fe = A/3*np.mat([bx, by, bx, by, bx, by]).T*t

if eq == None:
if eq is None:
return Ke
else:
return Ke, fe.T

else:
info("Error ! Check first argument, ptype=1 or 2 allowed")
if eq == None:
if eq is None:
return None
else:
return None, None
Expand Down Expand Up @@ -3069,7 +3069,7 @@ def planqe(ex, ey, ep, D, eq=None):
K, f = assem(np.array([7, 8, 1, 2, 9, 10]), K, ke1, f, fe1)
Ke, fe = statcon(K, f, np.array([[9], [10]]))

if eq == None:
if eq is None:
return Ke
else:
return Ke, fe
Expand Down Expand Up @@ -3189,7 +3189,7 @@ def plani4e(ex, ey, ep, D, eq=None):
t = ep[1]
ir = ep[2]
ngp = ir*ir
if eq == None:
if eq is None:
q = np.zeros((2, 1))
else:
q = np.reshape(eq, (2, 1))
Expand Down Expand Up @@ -3383,7 +3383,7 @@ def soli8e(ex, ey, ez, ep, D, eqp=None):
ir = ep[0]
ngp = ir*ir*ir

if eqp == None:
if eqp is None:
eq = np.zeros((3, 1))
else:
eq = eqp
Expand Down Expand Up @@ -4419,4 +4419,4 @@ def beam2crd(ex=None, ey=None, ed=None, mag=None):
excd[i, :] = xyc[0, :]+mag*cd[0, :]
eycd[i, :] = xyc[1, :]+mag*cd[1, :]

return excd, eycd
return excd, eycd