def calculate_stationary_points(self):
fp_raw=[]
border=5 #don't check points close to simplex border
delta=1e-12
for x,y in zip(self.trimesh.x[border:-border], self.trimesh.y[border:-border]):
start=self.xy2ba(x,y)
fp_try=np.array([])
sol=scipy.optimize.root(self.f,start,args=(0,),method="hybr")#,xtol=1.49012e-10,maxfev=1000
if sol.success:
fp_try=sol.x
#check if FP is in simplex
if not math.isclose(np.sum(fp_try), 1.,abs_tol=2.e-3):
continue
if not np.all((fp_try>-delta) & (fp_try <1+delta)):#only if fp in simplex
continue
else:
continue
#only add new fixed points to list
if not np.array([np.allclose(fp_try,x,atol=1e-7) for x in fp_raw]).any():
fp_raw.append(fp_try.tolist())
#add fixed points in correct coordinates to fixpoints list
fp_raw=np.array(fp_raw)
if fp_raw.shape[0]>0:
self.fixpoints=self.corners.T.dot(np.array(fp_raw).T).T
else:
self.fixpoints=np.array([])
评论列表
文章目录