77# Common
88import numpy as np
99import scipy .sparse as scpsp
10- import datastock as ds
1110
1211
1312from . import _utils_bsplines_operators as _operators
@@ -67,8 +66,8 @@ def get_mesh2dRect_operators(
6766 # prepare
6867
6968 nx , ny = knotsx_per_bs .shape [1 ], knotsy_per_bs .shape [1 ]
70- kR = np .tile (knotsx_per_bs , ny )
71- kZ = np .repeat (knotsy_per_bs , nx , axis = 1 )
69+ kR = np .repeat (knotsx_per_bs , ny , axis = 1 )
70+ kZ = np .tile (knotsy_per_bs , nx )
7271 nbs = nx * ny
7372
7473 if cropbs_flat is None :
@@ -219,7 +218,8 @@ def get_mesh2dRect_operators(
219218 for ir in range (nx ):
220219 for iz in range (ny ):
221220
222- iflat = ir + iz * nx
221+ # iflat = ir + iz*nx
222+ iflat = iz + ir * ny
223223 if cropbs_flat is not False and not cropbs_flat [iflat ]:
224224 continue
225225
@@ -238,8 +238,8 @@ def get_mesh2dRect_operators(
238238 if cropbs_flat is not False and not cropbs_flat [jflat ]:
239239 continue
240240
241- jr = jflat % nx
242- jz = jflat // nx
241+ jr = jflat // ny
242+ jz = jflat % ny
243243
244244 # store (i, j) and (j, i) (symmetric matrix)
245245 if jr >= ir :
@@ -277,17 +277,12 @@ def get_mesh2dRect_operators(
277277 )
278278
279279 # surface elements
280- dZ = np .repeat (knotsy_mult [1 :] - knotsy_mult [:- 1 ], nx )
280+ dZ = np .tile (knotsy_mult [1 :] - knotsy_mult [:- 1 ], nx )
281281 if geometry == 'linear' :
282- dR = np .tile (
283- knotsx_mult [1 :] - knotsx_mult [:- 1 ],
284- ny ,
285- )
282+ dR = knotsx_mult [1 :] - knotsx_mult [:- 1 ]
286283 else :
287- dR = np .tile (
288- 0.5 * (knotsx_mult [1 :]** 2 - knotsx_mult [:- 1 ]** 2 ),
289- ny ,
290- )
284+ dR = 0.5 * (knotsx_mult [1 :]** 2 - knotsx_mult [:- 1 ]** 2 )
285+ dR = np .repeat (dR , ny )
291286
292287 dS = dR * dZ
293288 if cropbs_flat is not False :
@@ -328,7 +323,7 @@ def get_mesh2dRect_operators(
328323 for ir in range (nx ):
329324 for iz in range (ny ):
330325
331- iflat = ir + iz * nx
326+ iflat = iz + ir * ny
332327 if cropbs_flat is not False and not cropbs_flat [iflat ]:
333328 continue
334329
@@ -348,8 +343,8 @@ def get_mesh2dRect_operators(
348343 if cropbs_flat is not False and not cropbs_flat [jflat ]:
349344 continue
350345
351- jr = jflat % nx
352- jz = jflat // nx
346+ jr = jflat // ny
347+ jz = jflat % ny
353348
354349 # store (i, j) and (j, i) (symmetric matrix)
355350 if jr >= ir :
@@ -401,7 +396,7 @@ def get_mesh2dRect_operators(
401396 for ir in range (nx ):
402397 for iz in range (ny ):
403398
404- iflat = ir + iz * nx
399+ iflat = iz + ir * ny
405400 if cropbs_flat is not False and not cropbs_flat [iflat ]:
406401 continue
407402
@@ -422,8 +417,8 @@ def get_mesh2dRect_operators(
422417 if cropbs_flat is not False and not cropbs_flat [jflat ]:
423418 continue
424419
425- jr = jflat % nx
426- jz = jflat // nx
420+ jr = jflat // ny
421+ jz = jflat % ny
427422
428423 # store (i, j) and (j, i) (symmetric matrix)
429424 if jr >= ir :
@@ -463,4 +458,4 @@ def get_mesh2dRect_operators(
463458
464459 raise NotImplementedError ("Integral D3N2 not implemented for deg=3!" )
465460
466- return opmat , operator , geometry
461+ return opmat , operator , geometry
0 commit comments