v0.14.0
Public Member Functions | Public Attributes | List of all members
sdf.Sphere Class Reference

Public Member Functions

def __init__ (self, Xc, Yc, Zc, diameter)
 
def sDF (self, x, y, z)
 
def gradSdf (self, x, y, z)
 
def hessSdf (self, x, y, z)
 
def __init__ (self, Xc, Yc, Zc, diameter)
 
def sDF (self, x, y, z)
 
def gradSdf (self, x, y, z)
 
def hessSdf (self, x, y, z)
 
def __init__ (self, Xc, Yc, Zc, diameter)
 
def sDF (self, x, y, z)
 
def gradSdf (self, x, y, z)
 
def hessSdf (self, x, y, z)
 

Public Attributes

 Xc
 
 Yc
 
 Zc
 
 xc
 
 yc
 
 zc
 
 radius
 

Detailed Description

Definition at line 141 of file sdf.py.

Constructor & Destructor Documentation

◆ __init__() [1/3]

def sdf.Sphere.__init__ (   self,
  Xc,
  Yc,
  Zc,
  diameter 
)

Definition at line 142 of file sdf.py.

142  def __init__(self, Xc, Yc, Zc, diameter):
143  # Initial Centroid
144  self.Xc = Xc
145  self.Yc = Yc
146  self.Zc = Zc
147 
148  # Current Centroid
149  self.xc = Xc
150  self.yc = Yc
151  self.zc = Zc
152 
153  # Indenter Dimensions
154  self.radius = diameter/2
155 

◆ __init__() [2/3]

def sdf.Sphere.__init__ (   self,
  Xc,
  Yc,
  Zc,
  diameter 
)

Definition at line 93 of file sdf.py.

93  def __init__(self, Xc, Yc, Zc, diameter):
94  # Initial Centroid
95  self.Xc = Xc
96  self.Yc = Yc
97  self.Zc = Zc
98 
99  # Current Centroid
100  self.xc = Xc
101  self.yc = Yc
102  self.zc = Zc
103 
104  # Indenter Dimensions
105  self.radius = diameter/2
106 

◆ __init__() [3/3]

def sdf.Sphere.__init__ (   self,
  Xc,
  Yc,
  Zc,
  diameter 
)

Definition at line 142 of file sdf.py.

142  def __init__(self, Xc, Yc, Zc, diameter):
143  # Initial Centroid
144  self.Xc = Xc
145  self.Yc = Yc
146  self.Zc = Zc
147 
148  # Current Centroid
149  self.xc = Xc
150  self.yc = Yc
151  self.zc = Zc
152 
153  # Indenter Dimensions
154  self.radius = diameter/2
155 

Member Function Documentation

◆ gradSdf() [1/3]

def sdf.Sphere.gradSdf (   self,
  x,
  y,
  z 
)

Definition at line 110 of file sdf.py.

110  def gradSdf(self, x, y, z):
111  a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
112  c_val_A = 1./np.sqrt(a)
113  c_val_dx = c_val_A * (x-self.xc)
114  c_val_dy = c_val_A * (y-self.yc)
115  c_val_dz = c_val_A * (z-self.zc)
116  # x, y, z
117  return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
118 

◆ gradSdf() [2/3]

def sdf.Sphere.gradSdf (   self,
  x,
  y,
  z 
)

Definition at line 165 of file sdf.py.

165  def gradSdf(self,x, y, z):
166  a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
167  c_val = np.sqrt(a)
168  c_val_A = 1./c_val
169  c_val_dx = c_val_A * (x-self.xc)
170  c_val_dy = c_val_A * (y-self.yc)
171  c_val_dz = c_val_A * (z-self.zc)
172  # x, y, z
173  #size = np.size(x)
174  #grad_array = np.empty([size,3])
175  c_val_dx = c_val_dx.reshape((-1,1))
176  c_val_dy = c_val_dy.reshape((-1,1))
177  c_val_dz = c_val_dz.reshape((-1,1))
178  grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
179  return grad_array
180 

◆ gradSdf() [3/3]

def sdf.Sphere.gradSdf (   self,
  x,
  y,
  z 
)

Definition at line 165 of file sdf.py.

165  def gradSdf(self,x, y, z):
166  a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
167  c_val = np.sqrt(a)
168  c_val_A = 1./c_val
169  c_val_dx = c_val_A * (x-self.xc)
170  c_val_dy = c_val_A * (y-self.yc)
171  c_val_dz = c_val_A * (z-self.zc)
172  # x, y, z
173  #size = np.size(x)
174  #grad_array = np.empty([size,3])
175  c_val_dx = c_val_dx.reshape((-1,1))
176  c_val_dy = c_val_dy.reshape((-1,1))
177  c_val_dz = c_val_dz.reshape((-1,1))
178  grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
179  return grad_array
180 

◆ hessSdf() [1/3]

def sdf.Sphere.hessSdf (   self,
  x,
  y,
  z 
)

Definition at line 119 of file sdf.py.

119  def hessSdf(self, x, y, z):
120  x, y, z = x-self.xc, y-self.yc, z-self.zc
121  denom = (x**2 + y**2 + z**2)**(3/2)
122  sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
123  Hxx = -x**2/denom + 1/sqrt_denom
124  Hzx = -x*z/denom
125  Hxy = -x*y/denom
126  Hyy = -y**2/denom + 1/sqrt_denom
127  Hzy = -y*z/denom
128  Hzz = -z**2/denom + 1/sqrt_denom
129  # xx, yx, zx, yy, zy, zz
130  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))])
131 
132 
133 # Define Indenters below

◆ hessSdf() [2/3]

def sdf.Sphere.hessSdf (   self,
  x,
  y,
  z 
)

Definition at line 181 of file sdf.py.

181  def hessSdf(self,x, y, z):
182  x = x-self.xc
183  y = y-self.yc
184  z = z-self.zc
185  Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
186  Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
187  Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
188  Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
189  Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
190  Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
191  # xx, yx, zx, yy, zy, zz
192  Hxx = Hxx.reshape((-1,1))
193  Hzx = Hzx.reshape((-1,1))
194  Hxy = Hxy.reshape((-1,1))
195  Hyy = Hyy.reshape((-1,1))
196  Hzy = Hzy.reshape((-1,1))
197  Hzz = Hzz.reshape((-1,1))
198  hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
199 
200  return hess_array
201 
202 
203 
204 # Define Indenters below

◆ hessSdf() [3/3]

def sdf.Sphere.hessSdf (   self,
  x,
  y,
  z 
)

Definition at line 181 of file sdf.py.

181  def hessSdf(self,x, y, z):
182  x = x-self.xc
183  y = y-self.yc
184  z = z-self.zc
185  Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
186  Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
187  Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
188  Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
189  Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
190  Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
191  # xx, yx, zx, yy, zy, zz
192  Hxx = Hxx.reshape((-1,1))
193  Hzx = Hzx.reshape((-1,1))
194  Hxy = Hxy.reshape((-1,1))
195  Hyy = Hyy.reshape((-1,1))
196  Hzy = Hzy.reshape((-1,1))
197  Hzz = Hzz.reshape((-1,1))
198  hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
199 
200  return hess_array
201 
202 
203 
204 # Define Indenters below

◆ sDF() [1/3]

def sdf.Sphere.sDF (   self,
  x,
  y,
  z 
)

Definition at line 107 of file sdf.py.

107  def sDF(self, x, y, z):
108  return np.sqrt((x - self.xc)**2 + (y - self.yc)**2 + (z - self.zc)**2) - self.radius
109 

◆ sDF() [2/3]

def sdf.Sphere.sDF (   self,
  x,
  y,
  z 
)

Definition at line 156 of file sdf.py.

156  def sDF(self, x, y, z):
157  dx = np.subtract(x, self.xc)
158  dy = np.subtract(y, self.yc)
159  dz = np.subtract(z, self.zc)
160  a = (dx)**2+(dy)**2 + (dz)**2
161  gap = np.sqrt(a) - self.radius
162 
163  return gap
164 

◆ sDF() [3/3]

def sdf.Sphere.sDF (   self,
  x,
  y,
  z 
)

Definition at line 156 of file sdf.py.

156  def sDF(self, x, y, z):
157  dx = np.subtract(x, self.xc)
158  dy = np.subtract(y, self.yc)
159  dz = np.subtract(z, self.zc)
160  a = (dx)**2+(dy)**2 + (dz)**2
161  gap = np.sqrt(a) - self.radius
162 
163  return gap
164 

Member Data Documentation

◆ radius

sdf.Sphere.radius

Definition at line 154 of file sdf.py.

◆ Xc

sdf.Sphere.Xc

Definition at line 144 of file sdf.py.

◆ xc

sdf.Sphere.xc

Definition at line 149 of file sdf.py.

◆ Yc

sdf.Sphere.Yc

Definition at line 145 of file sdf.py.

◆ yc

sdf.Sphere.yc

Definition at line 150 of file sdf.py.

◆ Zc

sdf.Sphere.Zc

Definition at line 146 of file sdf.py.

◆ zc

sdf.Sphere.zc

Definition at line 151 of file sdf.py.


The documentation for this class was generated from the following file: