@@ -118,7 +118,7 @@ def blocked():
118
118
x = create_vector_block (L_block )
119
119
scatter_local_vectors (
120
120
x ,
121
- [u .vector . array_r , p .vector .array_r ],
121
+ [u .x . petsc_vec . array_r , p .x . petsc_vec .array_r ],
122
122
[
123
123
(u .function_space .dofmap .index_map , u .function_space .dofmap .index_map_bs ),
124
124
(p .function_space .dofmap .index_map , p .function_space .dofmap .index_map_bs ),
@@ -144,10 +144,10 @@ def nested():
144
144
x = create_vector_nest (L_block )
145
145
for x1_soln_pair in zip (x .getNestSubVecs (), (u , p )):
146
146
x1_sub , soln_sub = x1_soln_pair
147
- soln_sub .vector .ghostUpdate (
147
+ soln_sub .x . petsc_vec .ghostUpdate (
148
148
addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD
149
149
)
150
- soln_sub .vector .copy (result = x1_sub )
150
+ soln_sub .x . petsc_vec .copy (result = x1_sub )
151
151
x1_sub .ghostUpdate (addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD )
152
152
153
153
A = assemble_matrix_nest (a_block , bcs = [bc ])
@@ -195,9 +195,9 @@ def monolithic():
195
195
A = assemble_matrix (J , bcs = [bc ])
196
196
A .assemble ()
197
197
b = assemble_vector (F )
198
- apply_lifting (b , [J ], bcs = [[bc ]], x0 = [U .vector ], scale = - 1.0 )
198
+ apply_lifting (b , [J ], bcs = [[bc ]], x0 = [U .x . petsc_vec ], scale = - 1.0 )
199
199
b .ghostUpdate (addv = PETSc .InsertMode .ADD , mode = PETSc .ScatterMode .REVERSE )
200
- set_bc (b , [bc ], x0 = U .vector , scale = - 1.0 )
200
+ set_bc (b , [bc ], x0 = U .x . petsc_vec , scale = - 1.0 )
201
201
assert A .getType () != "nest"
202
202
Anorm = A .norm ()
203
203
bnorm = b .norm ()
@@ -253,9 +253,9 @@ def F_block(self, snes, x, F):
253
253
offset = 0
254
254
x_array = x .getArray (readonly = True )
255
255
for var in self .soln_vars :
256
- size_local = var .vector .getLocalSize ()
257
- var .vector .array [:] = x_array [offset : offset + size_local ]
258
- var .vector .ghostUpdate (addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD )
256
+ size_local = var .x . petsc_vec .getLocalSize ()
257
+ var .x . petsc_vec .array [:] = x_array [offset : offset + size_local ]
258
+ var .x . petsc_vec .ghostUpdate (addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD )
259
259
offset += size_local
260
260
261
261
assemble_vector_block (F , self .L , self .a , bcs = self .bcs , x0 = x , scale = - 1.0 )
@@ -373,7 +373,7 @@ def blocked_solve():
373
373
x = create_vector_block (F )
374
374
scatter_local_vectors (
375
375
x ,
376
- [u .vector . array_r , p .vector .array_r ],
376
+ [u .x . petsc_vec . array_r , p .x . petsc_vec .array_r ],
377
377
[
378
378
(u .function_space .dofmap .index_map , u .function_space .dofmap .index_map_bs ),
379
379
(p .function_space .dofmap .index_map , p .function_space .dofmap .index_map_bs ),
@@ -415,10 +415,10 @@ def nested_solve():
415
415
assert x .getType () == "nest"
416
416
for x_soln_pair in zip (x .getNestSubVecs (), (u , p )):
417
417
x_sub , soln_sub = x_soln_pair
418
- soln_sub .vector .ghostUpdate (
418
+ soln_sub .x . petsc_vec .ghostUpdate (
419
419
addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD
420
420
)
421
- soln_sub .vector .copy (result = x_sub )
421
+ soln_sub .x . petsc_vec .copy (result = x_sub )
422
422
x_sub .ghostUpdate (addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD )
423
423
424
424
snes .solve (None , x )
@@ -471,7 +471,7 @@ def monolithic_solve():
471
471
U .sub (1 ).interpolate (initial_guess_p )
472
472
473
473
x = create_vector (F )
474
- x .array [:] = U .vector .array_r
474
+ x .array [:] = U .x . petsc_vec .array_r
475
475
476
476
snes .solve (None , x )
477
477
assert snes .getKSP ().getConvergedReason () > 0
@@ -574,7 +574,7 @@ def blocked():
574
574
u .interpolate (initial_guess_u )
575
575
p .interpolate (initial_guess_p )
576
576
x = create_vector_block (F )
577
- with u .vector . localForm () as _u , p .vector .localForm () as _p :
577
+ with u .x . petsc_vec . localForm () as _u , p .x . petsc_vec .localForm () as _p :
578
578
scatter_local_vectors (
579
579
x ,
580
580
[_u .array_r , _p .array_r ],
@@ -619,10 +619,10 @@ def nested():
619
619
x = create_vector_nest (F )
620
620
for x1_soln_pair in zip (x .getNestSubVecs (), (u , p )):
621
621
x1_sub , soln_sub = x1_soln_pair
622
- soln_sub .vector .ghostUpdate (
622
+ soln_sub .x . petsc_vec .ghostUpdate (
623
623
addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD
624
624
)
625
- soln_sub .vector .copy (result = x1_sub )
625
+ soln_sub .x . petsc_vec .copy (result = x1_sub )
626
626
x1_sub .ghostUpdate (addv = PETSc .InsertMode .INSERT , mode = PETSc .ScatterMode .FORWARD )
627
627
628
628
x .set (0.0 )
@@ -681,7 +681,7 @@ def monolithic():
681
681
U .sub (1 ).interpolate (initial_guess_p )
682
682
683
683
x = create_vector (F )
684
- x .array [:] = U .vector .array_r
684
+ x .array [:] = U .x . petsc_vec .array_r
685
685
686
686
snes .solve (None , x )
687
687
assert snes .getConvergedReason () > 0
0 commit comments