AssemblerBase::reset_sparsity is nowhere used
AssemblerBase::reset_sparsity
parameter is nowhere used (in a contradiction with documentation). Actual criterion for building sparsity pattern in AssemblerBase::init_global_tensor
is
58 if (A.size(0) == 0)
59 {
60 Timer t0("Build sparsity");
...
133 }
134 else
135 {
136 // If tensor is not reset, check that dimensions are correct
...
146 }
Comments (9)
-
-
reporter Actually, is the criterion
A.size(0) == 0
intended? Is the intention that user must initialize new tensor to assemble something with different pattern? -
It will soon not be possible to re-initialise a matrix/vector. This was discussed previously on the mailing list.
A.size(0) == 0
is true if the matrix has not been initialised. -
reporter @garth-wells According to the
GenericTensor
interface, proper check should beA.empty()
instead ofA.size(0) == 0
. (Use case: user (me) implementsGenericMatrix
and non-zerosize(0)
is known from construction time but tensor still needs initialization...)Bug report: at least
PETScMatrix::empty()
,EpetraMatrix::empty()
anduBLASMatrix::empty()
seems to not work:from dolfin import * mesh = UnitSquareMesh(3, 3) V = FunctionSpace(mesh, 'CG', 1) u, v = TrialFunction(V), TestFunction(V) a = inner(grad(u), grad(v))*dx L = v*dx for A in [uBLASDenseMatrix(), uBLASSparseMatrix(), PETScMatrix(), EpetraMatrix()]: print A.str(False), A.empty(), A.size(0) AssemblerBase().init_global_tensor(A, Form(a)) print A.str(False), A.empty(), A.size(0) for b in [uBLASVector(), PETScVector(), EpetraVector()]: print b.str(False), b.empty(), b.size(0) AssemblerBase().init_global_tensor(b, Form(L)) print b.str(False), b.empty(), b.size(0)
-
@blechta 'GenericTensor::empty' makes more sense in this context. Maybe you could make pull request that cleans this up?
-
reporter @garth-wells: Ok.
-
reporter -
assigned issue to
-
assigned issue to
-
reporter Fixes in pull request #126 and pull request #127. If the latter is merged, a deprecation issue should be filed.
-
- changed status to resolved
- Log in to comment
We need to keep this for a bit to avoid breaking code. It would be good if a warning could be issued when it's used. It's not a function, so it'll take something a bit cleverer to print a warning.