About `dolfinx.fem.petsc.assemble_matrix` API

There are two APIs aboutthe matrix assembling operation in dolfinx 0.9.0.


The above one has no parameter A: Mat, and the bellow has it. What is the difference between them? And again the intruction for Parameters has no A: Mat. When I use the following sentences
image
the code editor prompts Unexpected argument .
So how can I use the function with parameter A: Mat?

The one with A as input expects a PETS Matrix that you will add the contributions of the form a to. This is useful if you need too assemble the matrix multiple times, is it avoids reallocation of memory.

See for instance

Test problem 2: Flow past a cylinder (DFG 2D-3 benchmark) — FEniCSx tutorial (Step 1 in temporal loop)
The standard way of compiling code with DOLFINx — FEniCS Workshop

Thanks for your comments, Mr. dokken.
By the way, when using the function

is it required to call A.assemble() after the sentence to get the matrix assembled?

That is required for both APIs. It takes care of the parallel communication/accumulation of data.