12 def sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
13 for indenter
in list_indenters[:]:
15 return list_indenters[0].sDF(x,y,z)
18 def grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
19 return list_indenters[0].gradSdf(x,y,z)
22 def hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
23 return list_indenters[0].hessSdf(x,y,z)
28 def __init__(self,Xc,Yc,Zc,shift,indentationDepth):
47 def sDF(self, x, y, z):
48 return np.subtract(y,self.
shift)
51 dx = np.zeros_like(x).reshape((-1, 1))
52 dy = np.ones_like(y).reshape((-1, 1))
53 dz = np.zeros_like(z).reshape((-1, 1))
54 return np.hstack([dx, dy, dz])
57 zeros = np.zeros_like(x).reshape((-1, 1))
58 return np.hstack([zeros
for _
in range(6)])
61 def __init__(self, Xc, Yc, Zc, diameter, indentationDepth):
79 def sDF(self, x, y, z):
80 return np.sqrt((x - self.
xc)**2 + (y - self.
yc)**2) - self.
radius
83 a = (x-self.
xc)**2 + (y-self.
yc)**2
84 c_val_A = 1./np.sqrt(a)
85 c_val_dx = c_val_A * (x-self.
xc)
86 c_val_dy = c_val_A * (y-self.
yc)
87 c_val_dz = np.zeros_like(c_val_dy)
89 return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
92 a = (x-self.
xc)**2 + (y-self.
yc)**2
93 c_val_A = 1./np.sqrt(a)
94 c_val_B = 1./(a**(3./2.))
95 Hxx = c_val_A - c_val_B * (x-self.
xc)**2
96 Hxy = -c_val_B * (x-self.
xc)*(y-self.
yc)
97 Hyy = c_val_A - c_val_B * (y-self.
yc)**2
98 zeros = np.zeros_like(Hxx).reshape((-1,1))
100 return np.hstack([Hxx.reshape((-1,1)), Hxy.reshape((-1,1)), zeros, Hyy.reshape((-1,1)), zeros, zeros])
105 def __init__(self, Xc, Yc, Zc, diameter, indentationDepth):
123 return np.sqrt((x - self.
xc)**2 + (y - self.
yc)**2 + (z - self.
zc)**2) - self.
radius
126 a = (x-self.
xc)**2 + (y-self.
yc)**2 + (z-self.
zc)**2
127 c_val_A = 1./np.sqrt(a)
128 c_val_dx = c_val_A * (x-self.
xc)
129 c_val_dy = c_val_A * (y-self.
yc)
130 c_val_dz = c_val_A * (z-self.
zc)
132 return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
135 x, y, z = x-self.
xc, y-self.
yc, z-self.
zc
136 denom = (x**2 + y**2 + z**2)**(3/2)
137 sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
138 Hxx = -x**2/denom + 1/sqrt_denom
141 Hyy = -y**2/denom + 1/sqrt_denom
143 Hzz = -z**2/denom + 1/sqrt_denom
145 return np.hstack([Hxx.reshape((-1,1)), Hxy.reshape((-1,1)), Hzx.reshape((-1,1)), Hyy.reshape((-1,1)), Hzy.reshape((-1,1)), Hzz.reshape((-1,1))])
149 offset = (t / indentationEndTime)
if (t <= indentationEndTime)
else 1
150 obj.yc = obj.Yc + (obj.depth * offset)
if (obj.Yc < 0)
else obj.Yc - (obj.depth * offset)
151 obj.xc, obj.zc, obj.t = obj.Xc, obj.Zc, t
155 return 0
if obj.t == t
else yDirection(t, obj)
163 indentationEndTime = 1
168 list_indenters.append(
CylinderZ(0.0,-0.5-r, 0.0, 2*r, 0))