@@ -169,9 +169,10 @@ def add_value_constraints(self, w=1.0):
169169 wt = np .ones (size .shape [0 ])
170170 wt *= w
171171 self .add_constraints_to_least_squares (
172- N [mask , :] * wt [:, None ] ,
173- points [mask , 3 ] * wt ,
172+ N [mask , :],
173+ points [mask , 3 ],
174174 self .support .elements [elements [mask ], :],
175+ w = wt ,
175176 name = "value" ,
176177 )
177178
@@ -199,17 +200,17 @@ def minimise_grad_steepness(self, w=0.1, maskall=True, wtfunc=None):
199200 d2 = self .support .evaluate_shape_d2 (elements [mask ])
200201 # d2 is [ele_idx, deriv, node]
201202 wt = np .ones (d2 .shape [0 ])
202-
203203 wt *= w # * self.support.element_size[mask]
204204 if callable (wtfunc ):
205205 logger .info ("Using function to weight gradient steepness" )
206206 wt = wtfunc (self .support .barycentre ) * self .support .element_size [mask ]
207207 idc = self .support .elements [elements [mask ]]
208208 for i in range (d2 .shape [1 ]):
209209 self .add_constraints_to_least_squares (
210- d2 [:, i , :] * wt [ i , None , None ] ,
210+ d2 [:, i , :],
211211 np .zeros (d2 .shape [0 ]),
212212 idc [:, :],
213+ w = wt ,
213214 name = f"grad_steepness_{ i } " ,
214215 )
215216
@@ -247,9 +248,10 @@ def minimise_edge_jumps(
247248 if wtfunc :
248249 wt = wtfunc (tri_cp )
249250 self .add_constraints_to_least_squares (
250- const_cp * wt [:, None ] ,
251+ const_cp ,
251252 np .zeros (const_cp .shape [0 ]),
252253 tri_cp ,
254+ w = wt ,
253255 name = f"shared element jump cp{ i } " ,
254256 )
255257
0 commit comments